Skip to main content

Function Schema Generator

A zero-dependency Python micro-tool that uses reflection (inspect) to automatically generate function calling JSON schemas for OpenAI (GPT-4o, Groq, Ollama) and Anthropic (Claude 3/3.5) directly from your Python functions.

Installation

pip install function-schema-generator

Usage

import json
from function_schema_generator import generate_openai_schema, generate_anthropic_schema

def get_stock_price(ticker: str, currency: str = "USD"):
    """Fetches the current stock price for a given ticker symbol."""
    pass

# Generate OpenAI Format
openai_schema = generate_openai_schema(get_stock_price)
print("OpenAI Schema:\n", json.dumps(openai_schema, indent=2))

# Generate Anthropic (Claude) Format
anthropic_schema = generate_anthropic_schema(get_stock_price)
print("Anthropic Schema:\n", json.dumps(anthropic_schema, indent=2))

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

function_schema_generator-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

function_schema_generator-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file function_schema_generator-0.1.0.tar.gz.

File metadata

File hashes

Hashes for function_schema_generator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fbea4718fbc541d731c2e5f9d1f6edc7bb3601e5bd27faf651224a9b6c23fe00
MD5 b09515c1c214c2a185eb58a8c66673c7
BLAKE2b-256 ce85897dce3b3802cdb2a42366cd3e140b03908cb4502802142ef292315416e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for function_schema_generator-0.1.0.tar.gz:

Publisher: publish.yml on Encephos/function-schema-generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file function_schema_generator-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for function_schema_generator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e3d5111956df1a73066d7dbb9d9b84008d42a602f45f7d87a0c0903040c4a34
MD5 2cad0ce169192d2a985ba8b9dc59e49d
BLAKE2b-256 eac416971df44d514cfcf89b2ae0331800f88274976fd6181769d0f97d55f48e

See more details on using hashes here.

Provenance

The following attestation bundles were made for function_schema_generator-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Encephos/function-schema-generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page