Skip to content

Commit 8c56f0f

Browse files
committed
feat: extract text from content blocks in BasicOrchestrator
1 parent 9dda6bd commit 8c56f0f

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

amplifier_module_loop_basic/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,17 @@ async def execute_single_tool(tc: Any, group_id: str) -> tuple[str, str]:
343343

344344
# If we have content (no tool calls), we're done
345345
if content:
346-
final_content = content
346+
# Extract text from content blocks
347+
if isinstance(content, list):
348+
text_parts = []
349+
for block in content:
350+
if hasattr(block, "text"):
351+
text_parts.append(block.text)
352+
elif isinstance(block, dict) and "text" in block:
353+
text_parts.append(block["text"])
354+
final_content = "\n\n".join(text_parts) if text_parts else ""
355+
else:
356+
final_content = content
347357
if hasattr(context, "add_message"):
348358
# Store structured content from response.content (our Pydantic models)
349359
response_content = getattr(response, "content", None)

0 commit comments

Comments
 (0)