dynamic-pydantic


Namedynamic-pydantic JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryDynamic Pydantic is the easiest way to create and validate AI agent tools and databases.
upload_time2024-12-28 04:11:35
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT License Copyright (c) 2024 Luka Filipovic Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords instructor pydantic ai agents
VCS
bugtrack_url
requirements python-dotenv pydantic instructor litellm
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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
```bash
uv pip install dynamic-pydantic
```

## Contributing
Start contributing by cloning the repository:
```bash
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.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dynamic-pydantic",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "instructor, pydantic, AI Agents",
    "author": null,
    "author_email": "Luka <luka@lukafilipovic.com>",
    "download_url": "https://files.pythonhosted.org/packages/bb/a0/1248cb9c96356b89c47a4c98155d1be44b54c95cc5a84e37e49c604e52fa/dynamic_pydantic-0.1.1.tar.gz",
    "platform": null,
    "description": "# Dynamic Pydantic\r\n**Dynamic Pydantic is the easiest way for AI agents to create and validate tools and databases in runtime.**\r\n\r\nIt is a provides a powerful approach to creating pydantic models dynamically for any given task.\r\n\r\nThe project leverages Instructor and Pydantic to generate models dynamically based on provided prompt and context.\r\n\r\n## Installation\r\n```bash\r\nuv pip install dynamic-pydantic\r\n```\r\n\r\n## Contributing\r\nStart contributing by cloning the repository:\r\n```bash\r\ngit clone https://github.com/lukafilipxvic/dynamic-pydantic.git\r\n```\r\n\r\n## Usage\r\nThis package simplifies the interaction between language models and pydantic's ```create_model()``` function.\r\nBelow is a basic example showcasing the generation of a Pydantic schema with Cerebras' Llama 3.3 70b inference.\r\n\r\nDynamic Pydantic works with any OpenAI-compatible endpoint via LiteLLM.\r\n\r\n```\r\nfrom dynamic_pydantic import dynamic_model\r\n\r\ngenModel = dynamic_model(prompt='User = Name, Age')\r\n\r\nprint(f'{genModel.schema_json()}')\r\n\r\n# {\"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\"}\r\n\r\n```\r\n\r\n## License\r\nThis project is licensed under the terms of the MIT license.\r\n\r\nFor more details, refer to the LICENSE file in the repository.\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Luka Filipovic  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Dynamic Pydantic is the easiest way to create and validate AI agent tools and databases.",
    "version": "0.1.1",
    "project_urls": {
        "Changelog": "https://github.com/lukafilipxvic/dynamic-pydantic/blob/main/CHANGELOG.md",
        "Releases": "https://github.com/lukafilipxvic/dynamic-pydantic/releases",
        "Repository": "https://github.com/lukafilipxvic/dynamic-pydantic"
    },
    "split_keywords": [
        "instructor",
        " pydantic",
        " ai agents"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "acfb2de80149987f5f264cdd3af7b6ab56dfc21ae1e650d8d9555fd9c4af4354",
                "md5": "8489d9cd5df69e9cc210c1a1a2ec0ac8",
                "sha256": "2cced4af063b18301f5a0cbd2b95e4bead47d0db645372b9b3d503af13db621d"
            },
            "downloads": -1,
            "filename": "dynamic_pydantic-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8489d9cd5df69e9cc210c1a1a2ec0ac8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 3860,
            "upload_time": "2024-12-28T04:11:34",
            "upload_time_iso_8601": "2024-12-28T04:11:34.079218Z",
            "url": "https://files.pythonhosted.org/packages/ac/fb/2de80149987f5f264cdd3af7b6ab56dfc21ae1e650d8d9555fd9c4af4354/dynamic_pydantic-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bba01248cb9c96356b89c47a4c98155d1be44b54c95cc5a84e37e49c604e52fa",
                "md5": "dfcb5f1a1a3c7948204fb9e799d609ea",
                "sha256": "4d639666813ab2cb4a6cdf3dd335ae5df30bf923276d140e4a42502bb7a44716"
            },
            "downloads": -1,
            "filename": "dynamic_pydantic-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "dfcb5f1a1a3c7948204fb9e799d609ea",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 5608,
            "upload_time": "2024-12-28T04:11:35",
            "upload_time_iso_8601": "2024-12-28T04:11:35.241935Z",
            "url": "https://files.pythonhosted.org/packages/bb/a0/1248cb9c96356b89c47a4c98155d1be44b54c95cc5a84e37e49c604e52fa/dynamic_pydantic-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-28 04:11:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lukafilipxvic",
    "github_project": "dynamic-pydantic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "python-dotenv",
            "specs": []
        },
        {
            "name": "pydantic",
            "specs": []
        },
        {
            "name": "instructor",
            "specs": []
        },
        {
            "name": "litellm",
            "specs": []
        }
    ],
    "lcname": "dynamic-pydantic"
}
        
Elapsed time: 0.95307s