Raises ValueError if data is missing 'options' or options have wrong types.
(data: dict)
| 64 | |
| 65 | |
| 66 | def 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 | |
| 77 | def process_llm_result(content: str) -> tuple[dict, str]: |
no outgoing calls