https://retellai.com/?utm_source=discord&utm_medium=seo logo
Multiple tool calls invoked while an agent is stil...
# ❓・bug-report
m
I have a problem with tool calls not stopping and the AI invoking a tool multiple times while it's in process of reading the response. The workflow is stuck and doesn't continue after this. I am trying to compare against ElevenLabs, and the prompt works as expected there - only a single tool call is made, and the workflow continues. The agent is backed by OpenAI gpt-4o in both cases. Can you provide information on how the OpenAI tool invocation is being done (what parameters are sent for the tool invocation) so I can debug further? An example call is call_551572ca8c3e1728f529d424862 . This seems like a problem with turn-taking and reading the streaming response and should not be related to the prompt or OpenAI -- the model cannot force a turn on its own, and the 'parallel_tool_calls' flag (that I have checked we do set to false in other implementations) can only cause multiple tools to be invoked, but not a single tool to be invoked in multiple turns without user input.
@User any help here is appreciated - I hope it's a simple configuration that I am missing or have overlooked. I can provide more calls examples if necessary.
And one more thing: we are using strict function calling in both cases.
c
show us the detailed logs and you’ll be able to see which parameters are being sent
@Colin - Integrations @ Retell AI thanks for engaging. I've provided the relevant agent info above. Let us know if you need anything else!
c
so it looks like somethings wrong with your prompting, you need to explicitly state “call this function ONE time then say ‘…’”
you can ask gpt or claude to review your prompt and see what’s going on
but also check the description of your custom function because that tells the llm when to call the function
m
I am trying to understand why the LLM takes a few turns in a row.
As you can see, there is no user input between the tool invocations, which is something GPT cannot do on its own (take multiple turns in a row).
Otherwise - I have tested the prompt against gpt-4o in isolation (without a voice stack), and I cannot get multiple tool invocations (obviously, as I get only a single response out of the LLM). While it does support invoking multiple different tools in a single turn, this is not what happens here.
Or, are these instances of the same tool invoked within a single turn? In general, how do you set the
parallel_tool_calls
flag when invoking OpenAI? This could help determine if this is the problem.
c
it’s because it’s yielding on the tool result then starting a new line and then doing it again
that’s why you must tell it to say it first then once you get the result say something ekse
m
This is precisely my question. What causes the turn-taking to yield? I am migrating a prompt that's tried and tested with ElevenLabs. I want to understand what the differences in turn-taking are. I am designing a bot that speaks over the phone. I do not expect my end-users to care about tool invocations or speak over the bot. I'm restating an earlier question; this would help me debug and rule out one of the possibilities. When invoking OpenAI, does the retell platform pass the
parallel_tool_calls
flag as true or false?
And, after further research: are you perchance passing the
n
parameter that can possibly generate multiple responses to OpenAI? I see that every tool invocation comes with a corresponding message, as if the retell.ai conversational engine receives 3 responses and tries to spell back all 3 to the end-user.
@Colin - Integrations @ Retell AI it was a problem with the system prompt indeed - and the gpt model version. I can reproduce the behavior I get with retell when invoking OpenAI with
gpt-4o-2024-11-20
. Invoking with
gpt-4o
actually resolves to
gpt-4o-2024-08-06
on the OpenAI side. The model differences influence tool calling (and the model not going back to force a user's turn). One final ask: can you confirm what is sent to OpenAI when I have selected
gpt-4o
in retell's console for an agent's LLM - an explicit latest version (like 2024-11-20), or just
gpt-4o
? Thanks for all the asisstance provided.