---
title: "Pydantic models for JSON responses"
slug: pydantic-models-for-json-responses
canonical_url: https://mimansajaiswal.github.io/posts/pydantic-models-for-json-responses/
collection: Blurbs
published_at: 2024-01-05T00:00:00.000Z
updated_at: 2024-11-24T00:00:00.000Z
tags: 
  - Code
  - Libraries
author: "Mimansa Jaiswal"
---

## Navigation Context

- Canonical URL: https://mimansajaiswal.github.io/posts/pydantic-models-for-json-responses/
- You are here: Home > Posts > Blurbs > Pydantic models for JSON responses

### Useful Next Links
- [Home](https://mimansajaiswal.github.io/)
- [Publications](https://mimansajaiswal.github.io/papers/)
- [Blurbs](https://mimansajaiswal.github.io/collections/blurbs/)
- [Fieldnotes](https://mimansajaiswal.github.io/collections/fieldnotes/)
- [Personal](https://mimansajaiswal.github.io/collections/personal/)
- [Research](https://mimansajaiswal.github.io/collections/research/)

After fumbling around with various bloaty or experimental libraries, I was recommended to test out `instructor` and it has been possibly the best library I could have asked for. It is clean, small, clearly scoped, does not do anything on its own, has no hidden endpoints.

This is very much a recommend!

[

Instructor - Multi-Language Library for Structured LLM Outputs | Python, TypeScript, Go, Ruby - Instructor

Get structured, validated data from any LLM with Instructor - the #1 library for LLM data extraction. Supports 15+ providers (OpenAI, Anthropic, Google, Ollama, DeepSeek) in 6 languages. Built on type-safe schemas with automatic retries, streaming, and nested object support.

![title](https://www.google.com/s2/favicons?domain=python.useinstructor.com)

https://python.useinstructor.com/

![title](https://python.useinstructor.com/assets/images/social/index.png)

](https://python.useinstructor.com/)

Bookmark for [https://python.useinstructor.com/](https://python.useinstructor.com/)

* * *

## Cite This Page

```
@article{jaiswal2024pydanticmodelsf,
  title   = {Pydantic models for JSON responses},
  author  = {Jaiswal, Mimansa},
  journal = {mimansajaiswal.github.io},
  year    = {2024},
  month   = {Jan},
  url     = {https://mimansajaiswal.github.io/posts/pydantic-models-for-json-responses/}
}
```