This commit is contained in:
2026-02-19 11:33:17 -06:00
parent e15057e75e
commit 42a9b5289f

View File

@@ -60,5 +60,12 @@ async def llm_call(
try:
return response.parse()
except Exception:
# Fallback: sanitize control characters and parse manually
return response_model.model_validate_json(_sanitize_json(response.content))
# Fallback: extract content and parse manually
# response.content could be a string or a list of Text objects
content = response.content
if isinstance(content, list):
# Extract text from list of Text objects
content = "".join([chunk.text if hasattr(chunk, 'text') else str(chunk) for chunk in content])
elif not isinstance(content, str):
content = str(content)
return response_model.model_validate_json(_sanitize_json(content))