This project implements a structured LLM Output workflow. It demonstrates how Pydantic can structure output so it can be used for tasks such as user-input, data and LLM-ouput validation, as well as improving trace/span evals (among many others).
The repo is structured with:
-
A Jupyter Notebook (
pydantic_user_input_validation.ipynb) for ideation, design, and experimentation related to user-input validation and error handling -
A Jupyter Notebook (
pydantic_llm_response_validation.ipynb) for ideation, design, and experimentation related to LLM-output validation and error handling
- Install dependencies
pip install -r requirements.txt- Set Antropic or OpenAI API key
In a
.envfile in the project root:
ANTHROPIC_API_KEY="your_api_key_here"
OPENAI_API_KEY="your_api_key_here"