Skip to content

Commit de43c43

Browse files
authored
Update README
2 parents da94cd0 + f6b5230 commit de43c43

File tree

1 file changed

+0
-86
lines changed

1 file changed

+0
-86
lines changed

README.md

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -297,89 +297,3 @@ mypy pydantic_prompt
297297
## License
298298

299299
MIT
300-
```
301-
302-
# Updated PR Description
303-
304-
```
305-
# Initial Implementation of PydanticPrompt Library
306-
307-
This PR introduces PydanticPrompt, a lightweight Python library for documenting Pydantic models for LLM interactions using standard Python docstrings.
308-
309-
## Overview
310-
311-
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.
312-
313-
## Key Features
314-
315-
- **Simple decorator interface** (`@prompt_schema`)
316-
- **Uses standard Python docstrings** for field documentation
317-
- **Automatic type inference** including generics and nested models
318-
- **Optional validation rule display**
319-
- **Warnings for undocumented fields**
320-
- **Seamless integration** with existing Pydantic models
321-
322-
## Implementation Details
323-
324-
- Core functionality built around field inspection and docstring extraction
325-
- Uses Pydantic's JSON schema for validation rule discovery
326-
- Modern type annotations with mypy validation
327-
- Automated CI setup with GitHub Actions
328-
- Comprehensive linting with Ruff
329-
330-
## Example Usage
331-
332-
```python
333-
from pydantic import BaseModel, Field
334-
from pydantic_prompt import prompt_schema
335-
336-
@prompt_schema
337-
class UserProfile(BaseModel):
338-
name: str
339-
"""The full name of the user"""
340-
341-
age: int = Field(ge=0)
342-
"""User's age in years - must be a positive integer"""
343-
344-
email: str = Field(pattern=r"[^@]+@[^@]+\.[^@]+")
345-
"""Valid email address that will be used for communication"""
346-
347-
# In an LLM prompt
348-
prompt = f"""
349-
Extract a UserProfile from this text according to this schema:
350-
351-
{UserProfile.format_for_llm(include_validation=True)}
352-
353-
Text: John Doe is 32 years old, contact him at [email protected]
354-
"""
355-
```
356-
357-
## Test Results
358-
359-
All tests are passing:
360-
361-
```
362-
====================================================================== test session starts ======================================================================
363-
platform linux -- Python 3.12.1, pytest-8.3.5, pluggy-1.5.0 -- /workspaces/PydanticPrompt/.venv/bin/python
364-
cachedir: .pytest_cache
365-
rootdir: /workspaces/PydanticPrompt
366-
configfile: pyproject.toml
367-
testpaths: tests
368-
collected 4 items
369-
370-
tests/test_pydantic_prompt.py::test_basic_docstring_extraction PASSED [ 25%]
371-
tests/test_pydantic_prompt.py::test_optional_fields PASSED [ 50%]
372-
tests/test_pydantic_prompt.py::test_validation_rules PASSED [ 75%]
373-
tests/test_pydantic_prompt.py::test_nested_models PASSED [100%]
374-
375-
======================================================================= 4 passed in 0.13s =======================================================================
376-
```
377-
378-
## Changes Made
379-
380-
- Created core implementation with docstring extraction
381-
- Added comprehensive type hints with mypy validation
382-
- Set up CI with GitHub Actions for automated testing
383-
- Added linting script for consistent code style
384-
- Implemented warnings for undocumented fields
385-
- Created detailed documentation and examples

0 commit comments

Comments
 (0)