π First Release
Welcome to the initial release of PydanticPrompt! This library provides a simple way to document Pydantic models for structured LLM outputs using standard Python docstrings.
β¨ Key Features
- Easy Documentation: Use standard Python docstrings to document your Pydantic model fields
- LLM-Ready Format: Convert your model documentation to an LLM-friendly format with a single method call
- Type Inference: Automatic type detection and formatting, including nested and complex types
- Validation Rules: Option to include validation constraints in the formatted output
- Documentation Warnings: Automatic warnings for undocumented fields
π¦ Installation
pip install pydantic-prompt
π Requirements
- Python 3.11 or higher
- Pydantic 2.0 or higher
π Basic Usage
from pydantic import BaseModel, Field
from pydantic_prompt import prompt_schema
@prompt_schema
class User(BaseModel):
username: str
"""The user's login name"""
email: str = Field(pattern=r"[^@]+@[^@]+\.[^@]+")
"""Valid email address for the user"""
age: int = Field(ge=0)
"""User age in years"""
# Get formatted documentation for an LLM prompt
schema_doc = User.format_for_llm(include_validation=True)
print(schema_doc)
Output:
User:
- username (str): The user's login name
- email (str): Valid email address for the user [Constraints: pattern: [^@]+@[^@]+\.[^@]+]
- age (int): User age in years [Constraints: ge: 0]
π Documentation
For more detailed documentation, usage examples, and advanced features, please visit:
https://github.com/OpenAdaptAI/PydanticPrompt
π Feedback and Contributions
This is the first release of PydanticPrompt. We welcome your feedback, bug reports, feature requests, and contributions!
π Release Notes
This v0.1.1 release is functionally identical to v0.1.0 but includes CI workflow improvements for automated PyPI publishing.
What's Changed
- Initial Implementation of PydanticPrompt Library by @abrichr in #1
- Update README.md by @abrichr in #2
- Fix CI workflow to trigger on version tags by @abrichr in #3
New Contributors
Full Changelog: https://github.com/OpenAdaptAI/PydanticPrompt/commits/v0.1.1