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)
|
bot = Assistant(llm=llm_cfg, function_list=tools)
|
||||||
|
|
||||||
# Streaming generation
|
# 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
|
# Initialize responses variable before the loop in case the loop doesn't run
|
||||||
final_responses = None
|
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
|
# The loop assigns the latest response to final_responses
|
||||||
final_responses = responses
|
final_responses = responses
|
||||||
|
|
||||||
# Pretty-print the final response object
|
# Pretty-print the final response object
|
||||||
if final_responses:
|
if final_responses:
|
||||||
print(json.dumps(final_responses, indent=2)) # Use indent=2 (or 4) for pretty printing
|
print(json.dumps(final_responses, indent=2)) # Use indent=2 (or 4) for pretty printing
|
||||||
|
print(final_responses['content'])
|
||||||
else:
|
else:
|
||||||
print("No response received from the agent.")
|
print("No response received from the agent.")
|
Loading…
x
Reference in New Issue
Block a user