From 3ed082e69a7e9bd3f159f1db21f70a554fec5c8a Mon Sep 17 00:00:00 2001 From: Dean Wampler Date: Thu, 7 Aug 2025 11:57:46 -0400 Subject: [PATCH] Incorporated suggested code modification Signed-off-by: Dean Wampler --- docs/source/getting_started/demo_script.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/source/getting_started/demo_script.py b/docs/source/getting_started/demo_script.py index 117251ecd..777fc78c2 100644 --- a/docs/source/getting_started/demo_script.py +++ b/docs/source/getting_started/demo_script.py @@ -52,14 +52,16 @@ agent = Agent( prompt = "How do you do great work?" print("prompt>", prompt) +use_stream = True response = agent.create_turn( messages=[{"role": "user", "content": prompt}], session_id=agent.create_session("rag_session"), - stream=True, + stream=use_stream, ) -# NOTE: `AgentEventLogger().log(response)` only works with streaming responses. -# So, if you change the value for `stream` to `False` in the `create_turn` call, -# comment out the following two lines! -for log in AgentEventLogger().log(response): - log.print() +# Only call `AgentEventLogger().log(response)` for streaming responses. +if use_stream: + for log in AgentEventLogger().log(response): + log.print() +else: + print(response)