Skip to main content

Module llm_response

Module llm_response 

Source
Expand description

Helpers for extracting structured content embedded in free-form LLM prose.

LLMs are prompted to return JSON but often wrap it in prose or markdown fences. This module provides the bracket-matching extraction step shared by callers that parse a JSON array out of a raw LLM response; each caller keeps its own policy for what to do when extraction fails (empty-result fallback vs. hard error).

Functionsยง

extract_json_array_slice
Extract the substring spanning the first [ and the last ] in raw.