A Python tool to generate Pydantic response schemas using various LLM APIs
Project description
LLM Schema Generator
A Python library that generates Pydantic response schemas based on user descriptions using various LLM providers (OpenAI, Anthropic Claude, Google Gemini).
Installation
Install from PyPI:
pip install schema_gen_ai
Example: Using OpenAI
from schema_gen_ai import generate_schema
schema_code = generate_schema( description="Extract name, age, and occupation from a person's bio", provider="openai", api_key="your_openai_api_key", # Or set OPENAI_API_KEY env var model="gpt-4o-mini" # Optional )
print(schema_code)
Example: Using gemini
from schema_gen_ai import generate_schema
schema_code = generate_schema( description="Extract name, age, and occupation from a person's bio", provider="gemini", api_key="your_gemini_api_key", # Or set GOOGLE_API_KEY env var model="gemini-2.5-flash" # Optional )
print(schema_code)
Example: Using OpenAI
from schema_gen_ai import generate_schema
schema_code = generate_schema( description="Extract name, age, and occupation from a person's bio", provider="claude", api_key="your_claude_api_key", # Or set ANTHROPIC_API_KEY env var model="claude-sonnet-4-5-20250929" # Optional )
print(schema_code)
Project details
Release history Release notifications | RSS feed
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 schema_gen_ai-0.1.0.tar.gz.
File metadata
- Download URL: schema_gen_ai-0.1.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
236f73cbe8f254503854cf8eab6726abad0a8bc536452b5d907feda13074efad
|
|
| MD5 |
ab4cb16e9e4bab7386970ed6438fdb87
|
|
| BLAKE2b-256 |
282ae915d9f190093378803502440d4dc7ba30e36afe24ebfe79fcd8311f06b5
|
File details
Details for the file schema_gen_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: schema_gen_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
912826bd042fa277bec3df930d5941427933e43ca3d644cdbfc583d7b73a6bd3
|
|
| MD5 |
4904f1870e894111c9f5df0f41b896b0
|
|
| BLAKE2b-256 |
fb583cbf4cde21308628800f45c977ed53120b793c0b7dcb48909749ba3d8252
|