From ca5f45de4e78b88058ce81b875615ead544eccac Mon Sep 17 00:00:00 2001 From: killian <63927363+KillianLucas@users.noreply.github.com> Date: Thu, 25 Jul 2024 00:54:03 -0700 Subject: [PATCH] Fixed tool calling --- interpreter/core/llm/run_tool_calling_llm.py | 3 +-- numbers.txt | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 numbers.txt diff --git a/interpreter/core/llm/run_tool_calling_llm.py b/interpreter/core/llm/run_tool_calling_llm.py index cfc20e9d66..932c3c00ae 100644 --- a/interpreter/core/llm/run_tool_calling_llm.py +++ b/interpreter/core/llm/run_tool_calling_llm.py @@ -39,6 +39,7 @@ def run_tool_calling_llm(llm, request_params): last_tool_id = 0 for i, message in enumerate(request_params["messages"]): if "function_call" in message: + last_tool_id += 1 function = message.pop("function_call") message["tool_calls"] = [ { @@ -55,8 +56,6 @@ def run_tool_calling_llm(llm, request_params): message["role"] = "tool" message["tool_call_id"] = "toolu_" + str(last_tool_id) - last_tool_id += 1 - request_params["messages"] = [m for m in request_params["messages"] if m != None] # Add OpenAI's recommended function message diff --git a/numbers.txt b/numbers.txt new file mode 100644 index 0000000000..01e79c32a8 --- /dev/null +++ b/numbers.txt @@ -0,0 +1,3 @@ +1 +2 +3