MCPcopy Index your code
hub / github.com/idank/explainshell / process_llm_result

Function process_llm_result

explainshell/extraction/llm/response.py:77–92  ·  view source on GitHub ↗

Parse and validate a raw LLM response string. Returns (data_dict, raw_content). Raises ExtractionError on parse failure or validation failure.

(content: str)

Source from the content-addressed store, hash-verified

75
76
77def process_llm_result(content: str) -> tuple[dict, str]:
78 """Parse and validate a raw LLM response string.
79
80 Returns (data_dict, raw_content).
81 Raises ExtractionError on parse failure or validation failure.
82 """
83 data = parse_json_response(content)
84 try:
85 validate_llm_response(data)
86 except ValueError as e:
87 raise ExtractionError(
88 str(e),
89 raw_response=content,
90 reason_class=FailureReason.INVALID_SCHEMA,
91 ) from e
92 return data, content
93
94
95def extract_text_from_lines(

Callers 6

finalizeMethod · 0.90
_call_llmMethod · 0.90
test_invalid_schemaMethod · 0.90
test_valid_responseMethod · 0.90

Calls 3

ExtractionErrorClass · 0.90
parse_json_responseFunction · 0.85
validate_llm_responseFunction · 0.85