Discover and explore top open-source AI tools and projects—updated daily.
tanchongminStructured output framework for LLM outputs
Top 76.3% on SourcePulse
StrictJSON is a Python framework designed to enforce structured output from Large Language Models (LLMs), primarily by parsing responses as YAML and validating them against Pydantic schemas. It supports a wide range of data types and offers LLM-based error correction for up to three retries, aiming to streamline LLM interactions for developers and researchers.
How It Works
The core innovation is the parse_yaml function, which treats LLM output as YAML. This approach leverages YAML's conciseness and better handling of code blocks compared to JSON. The framework automatically converts a user-defined output_format into a Pydantic schema, which is then used for validation. This allows for robust data type checking and error correction, ensuring the LLM's output conforms to the desired structure.
Quick Start & Requirements
pip install strictjsonparse_yaml.ipynb, strict_json.ipynbHighlighted Details
type: int, type: ensure <requirement>).strict_json_async).Maintenance & Community
discord.gg/bzp87AHJy5.Licensing & Compatibility
Limitations & Caveats
The README notes that smaller versions of Llama 3.2 and 3.1 models may not work well with YAML parsing. Type checking is not supported when using OpenAI JSON Mode.
10 months ago
1 week
567-labs
noamgat
imaurer