Expand description
Provider-Neutral Output Normalization
PSP-5 Phase 4: Extracts structured content (JSON objects, JSON arrays) from raw LLM responses regardless of provider-specific formatting quirks.
Supported extraction strategies (tried in order):
- Fenced JSON code block:
json ... - Generic fenced code block:
...containing JSON - Direct JSON: response body starts with
{or[ - Embedded JSON: first
{to last matching}in wrapper text
The module is provider-agnostic by design. Provider family classification is available for diagnostics and telemetry but does not change extraction behavior.
Structs§
- Normalization
Error - Error returned when normalization cannot extract a JSON body.
- Normalized
Output - Result of a successful normalization.
Enums§
- Extraction
Method - Which extraction strategy succeeded.
- Provider
Family - Provider family for diagnostics and telemetry.
Functions§
- extract_
and_ deserialize - Convenience: extract JSON and deserialize into
Tin one step. - extract_
json - Extract a JSON body from a raw LLM response.