diff --git a/README.md b/README.md index bc18a09..21fe1f2 100644 --- a/README.md +++ b/README.md @@ -297,89 +297,3 @@ mypy pydantic_prompt ## License MIT -``` - -# Updated PR Description - -``` -# Initial Implementation of PydanticPrompt Library - -This PR introduces PydanticPrompt, a lightweight Python library for documenting Pydantic models for LLM interactions using standard Python docstrings. - -## Overview - -PydanticPrompt allows developers to document their Pydantic models with standard Python docstrings and then easily format that documentation for inclusion in LLM prompts, providing a clean, consistent way to describe expected outputs for large language models. - -## Key Features - -- **Simple decorator interface** (`@prompt_schema`) -- **Uses standard Python docstrings** for field documentation -- **Automatic type inference** including generics and nested models -- **Optional validation rule display** -- **Warnings for undocumented fields** -- **Seamless integration** with existing Pydantic models - -## Implementation Details - -- Core functionality built around field inspection and docstring extraction -- Uses Pydantic's JSON schema for validation rule discovery -- Modern type annotations with mypy validation -- Automated CI setup with GitHub Actions -- Comprehensive linting with Ruff - -## Example Usage - -```python -from pydantic import BaseModel, Field -from pydantic_prompt import prompt_schema - -@prompt_schema -class UserProfile(BaseModel): - name: str - """The full name of the user""" - - age: int = Field(ge=0) - """User's age in years - must be a positive integer""" - - email: str = Field(pattern=r"[^@]+@[^@]+\.[^@]+") - """Valid email address that will be used for communication""" - -# In an LLM prompt -prompt = f""" -Extract a UserProfile from this text according to this schema: - -{UserProfile.format_for_llm(include_validation=True)} - -Text: John Doe is 32 years old, contact him at john.doe@example.com -""" -``` - -## Test Results - -All tests are passing: - -``` -====================================================================== test session starts ====================================================================== -platform linux -- Python 3.12.1, pytest-8.3.5, pluggy-1.5.0 -- /workspaces/PydanticPrompt/.venv/bin/python -cachedir: .pytest_cache -rootdir: /workspaces/PydanticPrompt -configfile: pyproject.toml -testpaths: tests -collected 4 items - -tests/test_pydantic_prompt.py::test_basic_docstring_extraction PASSED [ 25%] -tests/test_pydantic_prompt.py::test_optional_fields PASSED [ 50%] -tests/test_pydantic_prompt.py::test_validation_rules PASSED [ 75%] -tests/test_pydantic_prompt.py::test_nested_models PASSED [100%] - -======================================================================= 4 passed in 0.13s ======================================================================= -``` - -## Changes Made - -- Created core implementation with docstring extraction -- Added comprehensive type hints with mypy validation -- Set up CI with GitHub Actions for automated testing -- Added linting script for consistent code style -- Implemented warnings for undocumented fields -- Created detailed documentation and examples \ No newline at end of file