tool_use #1
9
main.py
9
main.py
@ -578,9 +578,12 @@ def answer_question_tools_api(
|
|||||||
for tool_call in assistant_message["tool_calls"]:
|
for tool_call in assistant_message["tool_calls"]:
|
||||||
tool_name = tool_call["function"]["name"]
|
tool_name = tool_call["function"]["name"]
|
||||||
tool_args = tool_call["function"]["arguments"]
|
tool_args = tool_call["function"]["arguments"]
|
||||||
tool_response = tool_manager.get_tool(tool_name).execute(tool_args)
|
if tool_name is not None and tool_args is not None:
|
||||||
conversation_history.append({"role": "tool", "content": tool_response})
|
tool_response = tool_manager.get_tool(tool_name).execute(tool_args)
|
||||||
logger.info(f"API Tool response: {tool_response}")
|
conversation_history.append({"role": "tool", "content": tool_response})
|
||||||
|
logger.info(f"API Tool response: {tool_response}")
|
||||||
|
else:
|
||||||
|
logger.warning(f"Skipping tool call due to missing tool name or arguments: {tool_call}")
|
||||||
else:
|
else:
|
||||||
if "<reply>" in assistant_message["content"].lower():
|
if "<reply>" in assistant_message["content"].lower():
|
||||||
reply_content = re.search(
|
reply_content = re.search(
|
||||||
|
Loading…
Reference in New Issue
Block a user