Skip to content

Pydantic Program#

Tip

The Pydantic Program is a lower-level abstraction for structured output extraction. The default way to perform structured output extraction is with our LLM classes, which lets you plug these LLMs easily into higher-level workflows. Check out our structured output starter guide.

A pydantic program is a generic abstraction that takes in an input string and converts it to a structured Pydantic object type.

Because this abstraction is so generic, it encompasses a broad range of LLM workflows. The programs are composable and be for more generic or specific use cases.

There's a few general types of Pydantic Programs:

  • Text Completion Pydantic Programs: These convert input text into a user-specified structured object through a text completion API + output parsing.
  • Function Calling Pydantic Program: These convert input text into a user-specified structured object through an LLM function calling API.
  • Prepackaged Pydantic Programs: These convert input text into prespecified structured objects.

Text Completion Pydantic Programs#

See the example notebook on LLM Text Completion programs

Function Calling Pydantic Programs#

Prepackaged Pydantic Programs#