This project demonstrates how to obtain consistent, structured output from Large Language Models (LLMs) using Pydantic and Instructor libraries. The example provided extracts key details from a software engineer's resume in PDF format and outputs the data in a structured JSON format.
- Python 3.x
- API Key for Anthropic API
- Clone the repository:
git clone https://github.com/paquino11/output-structure-llm
cd output-structure-llm
- Create a virtual environment:
python -m venv venv
source venv/bin/activate
- Install the required packages:
pip install -r requirements.txt
- Set up the environment variables:
- Create a
.env
file and add the following:
ANTHROPIC_API_KEY=your_anthropic_api_key
- Ensure you have a resume.pdf file in the root directory of the project.
- Run the script:
python3 output_structure.py
- Check the output in the
resume.json
file.