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

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.0.tar.gz (6.0 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.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dynamic_pydantic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4bbcb811440b1dcfd23a57c051bfacfa18ea68fa190718e81d9cc22af5abf250
MD5 f308ef2ba63ea6b6f8cbf28c80d8e8d6
BLAKE2b-256 b796ab673d4e681d27561dfb8c4c59c7a17d04af2a33376fcd491c2a4552eeba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dynamic_pydantic-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 244bfb4a5541f68ca7ad15cb7e2af2e0f1bd361b37cc7c5d9210f0c4515b7139
MD5 8ba2c82e0454680142e025ee9c33b205
BLAKE2b-256 184131105ca70563e9546e326ad27c22699414a032e2fcb8fadd32e292eb48bc

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