Tool Call with Cerebras
# support
d
0ec0be18-f3c9-46b2-9cf2-7ad61e14b799 conversation ID I’m encountering an error during an AI conversation where the model fails to generate tool calls for the "checkMeetingSlots" function, integrated with the Google Calendar API. Here’s the rundown: Setup: Using Cerebras (llama-3.3-70b) as the LLM and Vapi as the stitching provider. Context: The AI (Emily Thompson) is scheduling a meeting with a client (John Smith) for a property valuation on Wednesday, April 3, 2025, 9:00 AM to 5:00 PM GMT+1. Function Call: The "checkMeetingSlots" tool is called with: URL: https://sales-stack-web-production.api.holofy.io/v1/browser/tools/google-calendar/check-slots Method: POST Parameters: project_id: "67ea53573368dc6a30cbc185" start_time: "2025-04-03T09:00:00+01:00" end_time: "2025-04-03T17:00:00+01:00" Error Logs (March 31, 2025): 08:41:49:335 [LOG] Model request started (attempt #1, llama-3.3-70b, cerebras) 08:41:49:544 [LOG] Model request cost (attempt #1, $0, 3903 prompt, 0 completion) 08:41:49:544 [WARN] Model request failed (attempt #1, reason: Failed to generate tool_calls. Exception: No valid function calls generated) 08:41:49:545 [CHECKPOINT] Model request failed Issue: The model fails to generate a valid tool call, halting the conversation flow. The error suggests a problem with either the prompt or how Vapi stitches the tool call with Cerebras. Could you please check on your side: Is there an issue with how Vapi handles the "checkMeetingSlots" function with Cerebras? Are there known compatibility issues with this model and tool calls? Could the API endpoint or server setup (timeout: 20s, secret: 122) be causing a glitch? I’ve tried debugging the prompt and parameters, but the error persists. Any insights or logs from your system would help! Thanks in advance.
@Shubham Bajaj thank you in advance 🙂
v
Hi there! I understand you're facing issues with the "checkMeetingSlots" function using Cerebras (llama-3.3-70b) and Vapi. I'm unable to provide specific information about how Vapi handles the "checkMeetingSlots" function with Cerebras specifically or access logs for your conversation ID. However, I can help with information about compatibility issues with llama-3.3-70b, potential API/server setup issues, and debugging steps for tool calls. ## Compatibility Issues with llama-3.3-70b and Tool Calls There are some indications of potential compatibility issues between llama-3.3-70b and tool calls: - A user reported issues using
meta llama 3.3 70B
with the Vapi dashboard and Together AI, specifically with the model input field for custom models [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342659054115356803). - While several
llama
models are listed as available within the Vapi ecosystem (including
llama-3.3-70b-versatile
), there have been some issues with specific
llama
models [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334534504324403230). - Vapi removed certain
llama3
models with "tool-use-preview" in their names from
GroqModel.model
, suggesting potential issues with tool use in those specific models [Vapi changelog](https://docs.vapi.ai/changelog/2024/12/30). - There are known issues with Vapi defined tools and the chat completion endpoint, where "Vapi built tools get removed from the chat completions endpoint" [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1339871158975336498). ## API Endpoint/Server Setup Issues Your API endpoint or server setup could be causing glitches:
- **Server URL Configuration**: The server URL is essential for VAPI to send HTTP requests to process data and execute functions. If not correctly set up, it could cause issues [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1296435541952303124). - **Timeout Issues**: Your specified timeout of 20 seconds might be insufficient. If your server takes too long to respond, VAPI might time out waiting for the response [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/125000684231196775). - **Server Configuration**: Monitor your server for CPU, memory, and bandwidth usage. If your application relies on third-party services or APIs, check their status as they could be a bottleneck [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1332286268805087272). ## Debugging Tool Calls in Vapi Here are some steps to debug tool calls: 1. **Check Tool Call Configuration**: - Verify if the tool is set to
synchronous
instead of
async
[Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342315282198298729). - Set the
async
parameter to
true
within the configuration of the API call [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1333880245681393756). 2. **Examine Logs and Errors**: - Check Vapi logs to identify any errors in the automation flow [Vapi documentation](https://docs.vapi.ai/tools/GHL). - Access logs through the VAPI Dashboard by navigating to Logs or Reporting Section [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334280135683084328). 3. **Ensure Correct Response Format**:
- The tool call response must be in the correct format: a string without line breaks or stringified JSON [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342315282198298729). - Ensure the tool call ID is included in the response [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342315282198298729). - For simple messages, ensure it's wrapped in the correct JSON response format that VAPI expects [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1325000684231196775). 4. **Address Issues with Vapi Defined Tools**: - If using Vapi defined tools, include them in your custom LLM tools and when the model requests them, send a done stream back to Vapi with the function name [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1339871158975336498). Is there anything specific from these suggestions you'd like me to elaborate on further? Sources: - [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342659054115356803) - [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334534504324403230) - [Vapi changelog](https://docs.vapi.ai/changelog/2024/12/30) - [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1339871158975336498) - [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1296435541952303124) - [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/125000684231196775) - [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1332286268805087272) - [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342315282198298729)
d
Hey would appreciate if you had time today
@Shubham Bajaj
Can't see any logs beyond what's here so can't really debug it
a
looking into it.
d
@User Thank you so much!
@Shubham Bajaj if you have the time please let me know as we cannot operate this at all without fixing the tool call
a
This appears to be a model-specific issue with how the Cerebras implementation of Llama-3.3-70b handles function calling, rather than an issue with your specific function definition or configuration. The Cerebras Llama-3.3-70b model failed to generate proper JSON-formatted tool calls. Instead of producing the expected JSON structure for the tool call, it attempted to use a direct function call syntax:
Copy code
"message": "Failed to generate tool_calls. Please adjust your prompt. See 'failed_generation' for more details. Exception: No valid function calls generated",
    "type": "invalid_request_error",
    "param": "",
    "code": "tool_use_failed",
    "failed_generation": "checkMeetingSlots(projectId=67c00337a34d504e2593ccbe, startTime=2025-04-01T11:00:00+03:00, endTime=2025-04-01T11:30:00+03:00)"
  },
  "code": "tool_use_failed",
  "param": "",
  "type": "invalid_request_error",
  "message": "Failed to generate tool_calls. Please adjust your prompt. See 'failed_generation' for more details. Exception: No valid function calls generated",
The most immediate solution is to use a different model provider like OpenAI or Anthropic that properly supports the expected JSON format for function/tool calls. You can try to report this issue to Cerebras as it appears to be a limitation or bug in their implementation of function calling in the Llama-3.3-70b model.
This issue has been appearing to other users as well.
m
@Shubham Bajaj When I attach a tool to an assistant via the Vapi dashboard, everything works as expected, the function call is made, the response is returned correctly, and the same JSON is passed along. However, when I try the exact same setup in a phone call, it doesn't work.
If the issue were with Cerebras, it shouldn't work on the Vapi dashboard either. So it seems like the problem might lie elsewhere :/
@Shubham Bajaj I tried using Cerebras directly by installing the npm package and passing the exact same tool structure with the LLaMA 3.3-70B model, it's working fine. So it seems like the issue is with VAPI, not Cerebras. Could you please check on your end? Thanks
d
@Shubham Bajaj 👀
@Shubham Bajaj
a
Hey, can you share the working call ID so I could compare and understand if there is something wrong on our side? Then, what is wrong?
d
0ec0be18-f3c9-46b2-9cf2-7ad61e14b799 call ID
Error Logs (March 31, 2025): 08:41:49:335 [LOG] Model request started (attempt #1, llama-3.3-70b, cerebras) 08:41:49:544 [LOG] Model request cost (attempt #1, $0, 3903 prompt, 0 completion) 08:41:49:544 [WARN] Model request failed (attempt #1, reason: Failed to generate tool_calls. Exception: No valid function calls generated) 08:41:49:545 [CHECKPOINT] Model request failed Issue: The model fails to generate a valid tool call, halting the conversation flow.
Simply put something happens in tool calling when it’s being sent to cerebras
When we do it separately it works
So somehow in the process from Vapi it gets changed
@Shubham Bajaj if you need more info please let us know
@Shubham Bajaj 3649b5c7-8e1a-4746-bb7c-bf28da01d6fd this is the call id in which function call is working
@Shubham Bajaj any update?
👀
@Shubham Bajaj hello
@Shubham Bajaj ??
a
Hi, checking if this is resolved/solved for you?
d
it's not
a
looking into it.
The Llama-3.3-70b model generated a function call in Python-like syntax with named parameters, but the API expected a properly structured JSON object following the OpenAI function calling convention.