Skip to content
FindOpenSource

Outlines

Library for constraining LLM output to a specific structure - JSON schema, regex, grammar - guaranteeing valid, parseable results.

Overview

Outlines controls what tokens an LLM is allowed to generate at each step, guaranteeing the final output matches a JSON schema, regular expression, or context-free grammar exactly, rather than hoping a model follows formatting instructions in a prompt. This eliminates a common class of LLM application bugs caused by malformed or unparseable model output.

Outlines is a fit for teams that need guaranteed-valid structured output from an LLM - populating a database record, calling a function with the right argument types - a different technical approach (constrained generation at the token level) than Instructor (also in this catalog), which achieves structured output through function-calling APIs instead.

Categories
AI & Machine Learning
Keywords
structured-outputllm-generationjson-schema
Languages
Python
License
Apache-2.0

Spotted an error? Suggest an edit on GitHub.