tool_call
This commit is contained in:
parent
671569026e
commit
559040f7ce
@ -176,11 +176,11 @@ async def enhanced_generate_stream_response(
|
|||||||
("stop_reason" in msg.response_metadata and msg.response_metadata["stop_reason"] == "tool_use")
|
("stop_reason" in msg.response_metadata and msg.response_metadata["stop_reason"] == "tool_use")
|
||||||
):
|
):
|
||||||
for args in function_call.values():
|
for args in function_call.values():
|
||||||
new_content = f"[{message_tag}] {args['function_name']}\n{args['arguments']}"
|
new_content += f"[{message_tag}] {args['function_name']}\n{args['arguments']}\n"
|
||||||
message_tag = "TOOL_CALL_FINISH"
|
message_tag = "TOOL_CALL_FINISH"
|
||||||
elif isinstance(msg, ToolMessage) and len(msg.content) > 0:
|
elif isinstance(msg, ToolMessage) and len(msg.content) > 0:
|
||||||
message_tag = "TOOL_RESPONSE"
|
message_tag = "TOOL_RESPONSE"
|
||||||
new_content = f"[{message_tag}] {msg.name}\n{msg.text}"
|
new_content = f"[{message_tag}] {msg.name}\n{msg.text}\n"
|
||||||
|
|
||||||
# 只有当有新内容时才发送chunk
|
# 只有当有新内容时才发送chunk
|
||||||
if new_content:
|
if new_content:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user