Skip to content

paquino11/output-structure-llm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to Get Structured Output from LLMs Applications Using Pydantic and Instrutor

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.

Installation

Prerequisites

Setup

  1. Clone the repository:
git clone https://github.com/paquino11/output-structure-llm
cd output-structure-llm
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate
  1. Install the required packages:
pip install -r requirements.txt
  1. Set up the environment variables:
  • Create a .env file and add the following:
ANTHROPIC_API_KEY=your_anthropic_api_key

Usage

  1. Ensure you have a resume.pdf file in the root directory of the project.
  2. Run the script:
python3 output_structure.py
  1. Check the output in the resume.json file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages