Skip to main content

Dynamic Pydantic is the easiest way to create and validate AI agent tools and databases.

Project description

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.

Project details


Download files

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

Source Distribution

dynamic_pydantic-0.1.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

dynamic_pydantic-0.1.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file dynamic_pydantic-0.1.1.tar.gz.

File metadata

  • Download URL: dynamic_pydantic-0.1.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.13

File hashes

Hashes for dynamic_pydantic-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4d639666813ab2cb4a6cdf3dd335ae5df30bf923276d140e4a42502bb7a44716
MD5 dfcb5f1a1a3c7948204fb9e799d609ea
BLAKE2b-256 bba01248cb9c96356b89c47a4c98155d1be44b54c95cc5a84e37e49c604e52fa

See more details on using hashes here.

File details

Details for the file dynamic_pydantic-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dynamic_pydantic-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2cced4af063b18301f5a0cbd2b95e4bead47d0db645372b9b3d503af13db621d
MD5 8489d9cd5df69e9cc210c1a1a2ec0ac8
BLAKE2b-256 acfb2de80149987f5f264cdd3af7b6ab56dfc21ae1e650d8d9555fd9c4af4354

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page