Skip to content

Commit ca5f45d

Browse files
committed
Fixed tool calling
1 parent 5d1ca06 commit ca5f45d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

interpreter/core/llm/run_tool_calling_llm.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def run_tool_calling_llm(llm, request_params):
3939
last_tool_id = 0
4040
for i, message in enumerate(request_params["messages"]):
4141
if "function_call" in message:
42+
last_tool_id += 1
4243
function = message.pop("function_call")
4344
message["tool_calls"] = [
4445
{
@@ -55,8 +56,6 @@ def run_tool_calling_llm(llm, request_params):
5556
message["role"] = "tool"
5657
message["tool_call_id"] = "toolu_" + str(last_tool_id)
5758

58-
last_tool_id += 1
59-
6059
request_params["messages"] = [m for m in request_params["messages"] if m != None]
6160

6261
# Add OpenAI's recommended function message

numbers.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1
2+
2
3+
3

0 commit comments

Comments
 (0)