Build robust output parsers for structured LLM responses. ## Expected Output Format {{output_format}} ## Common Failure Modes {{failure_modes}} ## Recovery Requirements {{recovery_requirements}} Implement a resilient parsing system: ```python class OutputParser: def parse(self, raw_output: str) -> ParsedOutput: """ 1. Attempt strict parsing 2. Apply fuzzy matching for near-misses 3. Use LLM-based repair for broken outputs 4. Validate against schema 5. Return structured result or detailed error """ pass def repair(self, broken_output: str, error: ParseError) -> str: """Use LLM to fix malformed output""" pass ``` Include: - Regex and JSON parsing strategies - Schema validation with Pydantic - Retry logic with modified prompts - Metrics for parse success rates
LLM Output Parser Builder
U
@
Build resilient LLM output parsers with fuzzy matching, LLM-based repair, schema validation, and comprehensive error handling.
65 copies0 forks
Details
Category
CodingUse Cases
Output parsingError handlingSchema validation
Works Best With
claude-sonnet-4-20250514gpt-4o
Created Shared