Can anyone help with tool / function calling? I've...
# archive-prompt-sharing
s
Can anyone help with tool / function calling? I've found it to be super unreliable. About 50% of the time it'll fail to call the function when it would be appropriate. When it does call it, 50% of the time it'll use nonsense syntax that ends up getting spoken aloud. Very jarring UX! It also seems to stumble over itself a lot when it does correctly call the function, i.e. it starts talking, then stops like it's been interrupted, even though there's no input from the caller side. Perhaps it's being interrupted by the automatic "success" message that comes back from the client? It also doesn't seem to be able to interleave the async function calls within its output (e.g. when telling a story) but only at the start or end of an output. Tho perhaps this is just a limitation I don't know about? I'm using GPT 4o, temperature 0.7, and have some guidance in the prompt. The tool calls are being handled by the client not a server URL (Python Daily Call SDK). Example, for async function showLightingEffect: Correct tool call:
Copy code
{
  "role": "tool_calls",
  "time": 1738463714599,
  "message": "",
  "toolCalls": [
    {
      "id": "call_jL7bgBeUYjLfQtPQz0H0KuPQ",
      "type": "function",
      "function": {
        "name": "showLightingEffect",
        "arguments": "{\"effectName\": \"magical_spell\"}"
      }
    }
  ],
  "secondsFromStart": 5.5
}
Examples of incorrect syntax that's just spoken aloud:
Copy code
"Showing lighting effect"
"I'll just cast our spell to equal sign multi tool use dot parallel. "
"JSON, recipient name, functions dot play sound effect, parameters versus effect name, rain"
The part of my prompt that hints the tool use:
Copy code
"Add immersion to stories by using the showLightingEffect function to create lighting effects. Be very sure to use the correct technical syntax for invoking the functions."