Response Parsing¶
Response parsing utilities for LLM structured outputs.
Provides generic parsing and validation for structured responses from language models.
Functions¶
- arshai.llms.utils.response_parsing.convert_typeddict_to_basemodel(typeddict_class)[source]¶
Convert a TypedDict class to a BaseModel class for Azure OpenAI SDK compatibility.
- arshai.llms.utils.response_parsing.extract_text_from_structure(instance, text_fields=None)[source]¶
Extract text content from a structured response for pattern matching.
- arshai.llms.utils.response_parsing.parse_to_structure(content, structure_type)[source]¶
Parse response content into the specified structure type.
- Parameters:
- Return type:
TypeVar(T)- Returns:
Instance of the structure type
- Raises:
ValueError – If parsing fails or content doesn’t match structure