Skip to content

Files

Latest commit

f4defbf · Mar 31, 2025

History

History
65 lines (43 loc) · 2.17 KB

README.md

File metadata and controls

65 lines (43 loc) · 2.17 KB

Mastering structured output with LangChain

Binder

Articles

The notebooks in this repo are described in the following series of blog posts:

  1. Mastering Structured Output in LLMs 1: JSON output with LangChain
  2. Mastering Structured Output in LLMs 2: Revisiting LangChain and JSON
  3. Mastering Structured Output in LLMs 3: LangChain and XML

Setup and Installation

This project uses Poetry for dependency management. Follow these steps to get started:

  1. Install Poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 -
  1. Clone this repository and navigate to the project directory:
git clone git@github.com:adocherty/langchain-structured-output-evaluation.git
cd langchain-structured-output-evaluation
  1. Create a virtual environment and install dependencies:
poetry install
  1. Activate the virtual environment:
poetry shell
  1. Launch Jupyter to run the notebooks:
jupyter notebook

Running Examples

These examples can be run on Binder: Binder

See index.ipynb for a description and link to the notebooks.

Notes

httpx has been fixed to version 0.27.2 to avoid a bug due to changed parameters https://community.openai.com/t/error-with-openai-1-56-0-client-init-got-an-unexpected-keyword-argument-proxies/1040332

Requirements

  • Python 3.12
  • Poetry for dependency management
  • Ollama installed locally for running local LLMs
  • Anthropic API key for Claude access (optional)
  • Fireworks.ai API key for cloud models (optional)