Skip to content

Commit ab0b88a

Browse files
DanieleMorottiniv-hertz
authored andcommitted
Removed lines to avoid duplicate output in REPL utility (#928)
In the REPL utility, the final output was printed after the streaming, causing a duplication issue. I only removed the lines within the stream mode that printed the final output. It should not affect any other use case of the utility. It solves a comment done in #784 .
1 parent b6aba55 commit ab0b88a

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/agents/repl.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from openai.types.responses.response_text_delta_event import ResponseTextDeltaEvent
66

77
from .agent import Agent
8-
from .items import ItemHelpers, TResponseInputItem
8+
from .items import TResponseInputItem
99
from .result import RunResultBase
1010
from .run import Runner
1111
from .stream_events import AgentUpdatedStreamEvent, RawResponsesStreamEvent, RunItemStreamEvent
@@ -50,9 +50,6 @@ async def run_demo_loop(agent: Agent[Any], *, stream: bool = True) -> None:
5050
print("\n[tool called]", flush=True)
5151
elif event.item.type == "tool_call_output_item":
5252
print(f"\n[tool output: {event.item.output}]", flush=True)
53-
elif event.item.type == "message_output_item":
54-
message = ItemHelpers.text_message_output(event.item)
55-
print(message, end="", flush=True)
5653
elif isinstance(event, AgentUpdatedStreamEvent):
5754
print(f"\n[Agent updated: {event.new_agent.name}]", flush=True)
5855
print()

0 commit comments

Comments
 (0)