Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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))

About

Automatically generate OpenAI and Anthropic Tool Calling schemas directly from Python function signatures. Zero dependencies.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages