From 42a9b5289f13201360aab05bcb9cc0fe38d7a6aa Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Thu, 19 Feb 2026 11:33:17 -0600 Subject: [PATCH] fix --- workflows/lib/llm.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/workflows/lib/llm.py b/workflows/lib/llm.py index d65c510..037dabd 100644 --- a/workflows/lib/llm.py +++ b/workflows/lib/llm.py @@ -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))