1"""Exceptions for structured output handling."""
2
3from __future__ import annotations
4
5from lexigram.ai.llm.exceptions import ExtractionError
6
7
8class StructuredOutputError(ExtractionError):
9 """Base exception for structured output errors."""
10
11 CODE = "AI_STRUCTURED_OUTPUT_ERROR"
12 _code: str = "LEX_ERR_LLM_017"
13
14
15class ParseError(StructuredOutputError):
16 """Raised when response cannot be parsed."""
17
18 CODE = "AI_PARSE_ERROR"
19 _code: str = "LEX_ERR_LLM_018"
20
21
22class SchemaValidationError(StructuredOutputError):
23 """Raised when parsed response fails validation."""
24
25 CODE = "AI_SCHEMA_VALIDATION_ERROR"
26 _code: str = "LEX_ERR_LLM_019"