Skip to content

Commit 327828e

Browse files
committed
fix(python): fix non-streaming agent logging
1 parent d06047e commit 327828e

File tree

1 file changed

+7
-5
lines changed
  • implementations/python/python/ockam/agents

1 file changed

+7
-5
lines changed

implementations/python/python/ockam/agents/agent.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -503,11 +503,13 @@ async def complete_chat(
503503
f"Sending {len(input_context)} messages from agent '{self.name}' to model '{self.model.original_name}'"
504504
)
505505
response = await self.model.complete_chat(tools=self.tool_specs, messages=input_context, stream=stream)
506-
messages = [choice.message for choice in response.choices]
507-
plural = "s" if len(messages) > 1 else ""
508-
self.logger.info(
509-
f"Received {len(messages)} message{plural} from model '{self.model.original_name}' for agent '{self.name}'"
510-
)
506+
507+
if not stream:
508+
messages = [choice.message for choice in response.choices]
509+
plural = "s" if len(messages) > 1 else ""
510+
self.logger.info(
511+
f"Received {len(messages)} message{plural} from model '{self.model.original_name}' for agent '{self.name}'"
512+
)
511513

512514
if stream:
513515
tool_calls: Dict[int, ToolCall] = {}

0 commit comments

Comments
 (0)