compass.utilities.parsing.llm_response_as_json#

llm_response_as_json(content)[source]#

Parse a raw LLM response into JSON-compatible data

Parameters:

content (str) – Response text expected to contain a JSON object, possibly with Markdown fences or Python boolean literals.

Returns:

dict – Parsed JSON structure. When parsing fails, the function returns an empty dictionary.

Notes

The parser strips Markdown code fences, coerces Python-style booleans to lowercase JSON literals, and logs the raw response on decode failure. The logging includes guidance for increasing token limits or updating prompts.