Print response as plain text
This commit is contained in:
parent
e9bb97c644
commit
fabbe2035b
@ -41,15 +41,16 @@ tools = [
|
||||
bot = Assistant(llm=llm_cfg, function_list=tools)
|
||||
|
||||
# Streaming generation
|
||||
messages = [{'role': 'user', 'content': 'https://qwenlm.github.io/blog/ Sumarize the latest developments of Qwen'}]
|
||||
messages = [{'role': 'user', 'content': 'fetch https://qwenlm.github.io/blog/ and give me a summery of the energy efficiency of training and inference 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):
|
||||
for responses in bot.run(messages=messages, enable_thinking=True,max_tokens=8192):
|
||||
# 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
|
||||
print(final_responses['content'])
|
||||
else:
|
||||
print("No response received from the agent.")
|
Loading…
x
Reference in New Issue
Block a user