MCPcopy Create free account
hub / github.com/idank/explainshell / validate_llm_response

Function validate_llm_response

explainshell/extraction/llm/response.py:66–74  ·  view source on GitHub ↗

Raises ValueError if data is missing 'options' or options have wrong types.

(data: dict)

Source from the content-addressed store, hash-verified

64
65
66def validate_llm_response(data: dict) -> None:
67 """Raises ValueError if data is missing 'options' or options have wrong types."""
68 if "options" not in data:
69 raise ValueError("LLM response missing 'options' key")
70 if not isinstance(data["options"], list):
71 raise ValueError("'options' must be a list")
72 for item in data["options"]:
73 if not isinstance(item, dict):
74 raise ValueError(f"Each option must be a dict, got {type(item)}")
75
76
77def process_llm_result(content: str) -> tuple[dict, str]:

Callers 5

test_valid_passesMethod · 0.90
process_llm_resultFunction · 0.85

Calls

no outgoing calls

Tested by 4

test_valid_passesMethod · 0.72