Raise value error if research pick next tool isn't a dictionary

This will give a better error message with response content than the
failed to get errors from non dictionary response we were getting
earlier.
This commit is contained in:
Debanjum
2025-06-03 21:43:42 -07:00
parent 65d9ad6cb2
commit d618f2d650

View File

@@ -198,6 +198,8 @@ async def apick_next_tool(
try:
response = load_complex_json(response)
if not isinstance(response, dict):
raise ValueError(f"Expected dict response, got {type(response).__name__}: {response}")
selected_tool = response.get("tool", None)
generated_query = response.get("query", None)
scratchpad = response.get("scratchpad", None)