diff --git a/agentic_search.py b/agentic_search.py index 58759a1..c409a67 100644 --- a/agentic_search.py +++ b/agentic_search.py @@ -1,3 +1,4 @@ +import json # Import the json module from qwen_agent.agents import Assistant # Define LLM @@ -40,7 +41,15 @@ tools = [ bot = Assistant(llm=llm_cfg, function_list=tools) # Streaming generation -messages = [{'role': 'user', 'content': 'https://qwenlm.github.io/blog/ Introduce the latest developments of Qwen'}] +messages = [{'role': 'user', 'content': 'https://qwenlm.github.io/blog/ Sumarize the latest developments of Qwen'}] +# Initialize responses variable before the loop in case the loop doesn't run +final_responses = None for responses in bot.run(messages=messages): - pass -print(responses) + # The loop assigns the latest response to final_responses + final_responses = responses + +# Pretty-print the final response object +if final_responses: + print(json.dumps(final_responses, indent=2)) # Use indent=2 (or 4) for pretty printing +else: + print("No response received from the agent.") \ No newline at end of file