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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file function_schema_generator-0.1.0.tar.gz.
File metadata
- Download URL: function_schema_generator-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbea4718fbc541d731c2e5f9d1f6edc7bb3601e5bd27faf651224a9b6c23fe00
|
|
| MD5 |
b09515c1c214c2a185eb58a8c66673c7
|
|
| BLAKE2b-256 |
ce85897dce3b3802cdb2a42366cd3e140b03908cb4502802142ef292315416e5
|
Provenance
The following attestation bundles were made for function_schema_generator-0.1.0.tar.gz:
Publisher:
publish.yml on Encephos/function-schema-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
function_schema_generator-0.1.0.tar.gz -
Subject digest:
fbea4718fbc541d731c2e5f9d1f6edc7bb3601e5bd27faf651224a9b6c23fe00 - Sigstore transparency entry: 2596969016
- Sigstore integration time:
-
Permalink:
Encephos/function-schema-generator@228fdf8f1ce1459c4b86d5df609984a05f7585ea -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Encephos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@228fdf8f1ce1459c4b86d5df609984a05f7585ea -
Trigger Event:
release
-
Statement type:
File details
Details for the file function_schema_generator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: function_schema_generator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e3d5111956df1a73066d7dbb9d9b84008d42a602f45f7d87a0c0903040c4a34
|
|
| MD5 |
2cad0ce169192d2a985ba8b9dc59e49d
|
|
| BLAKE2b-256 |
eac416971df44d514cfcf89b2ae0331800f88274976fd6181769d0f97d55f48e
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
function_schema_generator-0.1.0-py3-none-any.whl -
Subject digest:
7e3d5111956df1a73066d7dbb9d9b84008d42a602f45f7d87a0c0903040c4a34 - Sigstore transparency entry: 2596969124
- Sigstore integration time:
-
Permalink:
Encephos/function-schema-generator@228fdf8f1ce1459c4b86d5df609984a05f7585ea -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Encephos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@228fdf8f1ce1459c4b86d5df609984a05f7585ea -
Trigger Event:
release
-
Statement type: