Skip to content

Commit

Permalink
Fixed tool calling
Browse files Browse the repository at this point in the history
  • Loading branch information
KillianLucas committed Jul 25, 2024
1 parent 5d1ca06 commit ca5f45d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions interpreter/core/llm/run_tool_calling_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = [
{
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions numbers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1
2
3

0 comments on commit ca5f45d

Please sign in to comment.