Skip to main content

Dynamic Pydantic

Dynamic Pydantic is the easiest way for AI agents to create and validate tools and databases in runtime.

It is a provides a powerful approach to creating pydantic models dynamically for any given task.

The project leverages Instructor and Pydantic to generate models dynamically based on provided prompt and context.

Installation

uv pip install dynamic-pydantic

Contributing

Start contributing by cloning the repository:

git clone https://github.com/lukafilipxvic/dynamic-pydantic.git

Usage

This package simplifies the interaction between language models and pydantic's create_model() function. Below is a basic example showcasing the generation of a Pydantic schema with Cerebras' Llama 3.3 70b inference.

Dynamic Pydantic works with any OpenAI-compatible endpoint via LiteLLM.

from dynamic_pydantic import dynamic_model

genModel = dynamic_model(prompt='User = Name, Age')

print(f'{genModel.schema_json()}')

# {"properties": {"Name": {"default": null, "description": "The user's name", "title": "Name", "type": "string"}, "Age": {"default": null, "description": "The user's age", "title": "Age", "type": "integer"}}, "title": "User", "type": "object"}

License

This project is licensed under the terms of the MIT license.

For more details, refer to the LICENSE file in the repository.

Metadata

Release files for dynamic-pydantic 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dynamic-pydantic 0.1.1
File Size Uploaded
dynamic_pydantic-0.1.1.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dynamic-pydantic 0.1.1
File Interpreter ABI Platform
dynamic_pydantic-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / dynamic_pydantic-0.1.1.tar.gz

Download URL dynamic_pydantic-0.1.1.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4d639666813ab2cb4a6cdf3dd335ae5df30bf923276d140e4a42502bb7a44716
BLAKE2b-256 checksum
How to use checksums
bba01248cb9c96356b89c47a4c98155d1be44b54c95cc5a84e37e49c604e52fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.13

Release files / dynamic_pydantic-0.1.1-py3-none-any.whl

Download URL dynamic_pydantic-0.1.1-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cced4af063b18301f5a0cbd2b95e4bead47d0db645372b9b3d503af13db621d
BLAKE2b-256 checksum
How to use checksums
acfb2de80149987f5f264cdd3af7b6ab56dfc21ae1e650d8d9555fd9c4af4354
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.13

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release 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