Is it possible to have a toolsId run async
# support
a
Heyvstar Thank you for creating the ticket! A member of our team will reach out to you shortly.
v
You can continue this conversation by mentioning me in the message.
@vstar To set one of your toolIds to use asynchronous processing (
async: true
), you will need to configure the parameters for that specific tool accordingly. Since you have not provided the exact toolIds or the context in which they are used, I can't give you a precise code snippet. However, the general approach would be to set the
async
parameter to
true
in the configuration of the tool that requires asynchronous operation. Here's a conceptual example:
Copy code
javascript
// Assuming toolId1 requires default synchronous operation and toolId2 requires asynchronous operation.

const toolId1Config = {
  // ... other parameters for toolId1
};

const toolId2Config = {
  // ... other parameters for toolId2
  async: true // Setting async to true for this tool
};

// Now you would use these configurations in the API call or function call for each tool.
If you can provide me with the specific details or if you need to call a function with these configurations, I can assist you further.
v
@Vapi Here is the toolsId 2da5ce83-b311-4f71-be5f-78d8559065bf I need it to pass the call data into our CRM without waiting for a response from server or user/caller
v
@vstar To ensure that the tool with the ID
2da5ce83-b311-4f71-be5f-78d8559065bf
passes the call data into your CRM asynchronously, you would typically set the
async
parameter to
true
within the configuration of the API call associated with this tool. However, since I don't have the specific details of the API or function you're using, I'll provide a general example:
Copy code
javascript
// Configuration for the tool to pass data to CRM asynchronously
const toolConfig = {
  toolId: "2da5ce83-b311-4f71-be5f-78d8559065bf",
  async: true, // This ensures the operation is performed asynchronously
  // ... include other necessary parameters for the tool
};

// Now you would use this configuration in the API call or function call for the tool.
If this tool is part of a specific API or function that you are calling through VAPI, please provide the details of the API or function, and I can guide you on how to set the
async
parameter correctly within that context. If there's a specific function you need to call with this configuration, please let me know so I can assist you further.
v
can you give me an example of where that line of code would go, relative to my existing code "temperature": 0.1, "toolIds": [ "28ac2a2d-5454-4390-b0b0-d9a97baf0b73", "2da5ce83-b311-4f71-be5f-78d8559066bf" ], "tools": [ { "type": "transferCall", "async": false, "destinations": [ @Vapi
v
@vstar Certainly! Based on your existing code snippet, it looks like you're configuring a set of tools to be used in a certain process. To set the
async
parameter for the tool with ID
2da5ce83-b311-4f71-be5f-78d8559066bf
to
true
, you would modify the
tools
array by adding a configuration object for that tool. Here's how you can integrate it:
Copy code
json
{
  "temperature": 0.1,
  "toolIds": [
    "28ac2a2d-5454-4390-b0b0-d9a97baf0b73",
    "2da5ce83-b311-4f71-be5f-78d8559066bf"
  ],
  "tools": [
    {
      "type": "transferCall",
      "async": false,
      "destinations": [
        // ... your existing destination configurations
      ]
    },
    {
      "toolId": "2da5ce83-b311-4f71-be5f-78d8559066bf",
      "async": true,
      // ... any additional configuration specific to this tool
    }
  ]
}
In this example, I've added a new object to the
tools
array for the tool with the ID
2da5ce83-b311-4f71-be5f-78d8559066bf
and set its
async
property to
true
. This indicates that when this tool is called, it should perform its operation asynchronously. Please ensure that the additional configuration required for this tool (such as endpoints, data to be passed, etc.) is included where I've commented
// ... any additional configuration specific to this tool
. If you need further assistance with the specific configuration or have other questions, feel free to ask!
v
here is the error I got { "message": [ "assistant.model.each value in tools.type must be one of the following values: dtmf, endCall, transferCall, voicemail, output, make, ghl, bash, computer, textEditor, function" ], @Vapi
v
@vstar The error message you received indicates that the
type
field for each tool in the
tools
array must be one of the specified values. It seems that the configuration object I provided earlier was missing the
type
field, which is required. Let's correct that by adding the
type
field with an appropriate value for the tool you're configuring. Since you want to pass call data into your CRM, you might be using a
function
type or another relevant type depending on the operation you're performing. Here's an updated example with the
type
field included:
Copy code
json
{
  "temperature": 0.1,
  "toolIds": [
    "28ac2a2d-5454-4390-b0b0-d9a97baf0b73",
    "2da5ce83-b311-4f71-be5f-78d8559066bf"
  ],
  "tools": [
    {
      "type": "transferCall",
      "async": false,
      "destinations": [
        // ... your existing destination configurations
      ]
    },
    {
      "type": "function", // Assuming the tool is a function type
      "toolId": "2da5ce83-b311-4f71-be5f-78d8559066bf",
      "async": true,
      // ... any additional configuration specific to this tool
    }
  ]
}
Please replace
"type": "function"
with the correct type for the operation you're trying to perform with the tool
2da5ce83-b311-4f71-be5f-78d8559066bf
. If it's not a function, use the appropriate type from the list provided in the error message. If you're unsure about the type of operation that corresponds to passing call data into your CRM, you may need to consult the documentation for the API or service you're using, or reach out to their support for more information.
v
{ "type": "function", "toolId": "2da5ce83-b311-4f71-be5f-78d8559066bf", "async": "true" }, now here is the error: "message": [ "assistant.model.each value in tools.property toolId should not exist" ], "error": "Bad Request", "statusCode": 400 @Vapi
v
@vstar The error message indicates that the
toolId
property should not be present in the
tools
array. Instead, each tool configuration should only contain the properties that are specific to the type of tool you are using. Since you're trying to configure a function, you should not include
toolId
in the configuration. Instead, you should specify the function name and any parameters it requires. Here's how you might adjust the configuration:
Copy code
json
{
  "temperature": 0.1,
  "toolIds": [
    "28ac2a2d-5454-4390-b0b0-d9a97baf0b73"
    // Removed the second toolId since it should not be specified here
  ],
  "tools": [
    {
      "type": "transferCall",
      "async": false,
      "destinations": [
        // ... your existing destination configurations
      ]
    },
    {
      "type": "function",
      "functionName": "YourFunctionNameHere", // Replace with your actual function name
      "async": true,
      "parameters": {
        // ... any parameters your function requires
      }
    }
  ]
}
In this updated configuration: - I've removed the
toolId
from the
tools
array. - I've added a placeholder for
functionName
which you should replace with the actual name of the function you want to call. - The
parameters
object should contain any parameters that your function requires to operate. Please ensure that you replace
"YourFunctionNameHere"
with the actual name of the function you're trying to call and fill in the
parameters
with the correct values as needed. If you're still unsure about the correct configuration, please consult the documentation for the API or service you're using, or reach out to their support for more detailed guidance.
v
@Vapi
Copy code
{
  "message": [
    "assistant.model.each value in tools.property functionName should not exist"
  ],
  "error": "Bad Request",
  "statusCode": 400
}
@Shubham Bajaj can you help with this?
s
@vstar Could you please provide additional details regarding the issue you are encountering, and the error responses you are receiving? This information will help me to better understand your situation.
v
Hey @Shubham Bajaj @Vapi so the real issue I have been trying to figure out the last few days is the assistant doesn't trigger the tools/functions . That is my main thing, if there is a way to have it trigger the tools when it is needed. Here is a call: afa1e021-93bd-4dc9-930b-f1985ad7a43f and I have many others The prompt tells it to run the 'Not Interested' tool & even provided the toolsId in the prompting, then say the endCallMessage. But the assistant only says the endCall message and ends the call. The issue is when it doesn't trigger the tool, it keeps the contact in the call queue even though they say not interested or do not qualify for our service. Here's all the different ways I've tried: - Changed the content prompt so many times - Changed how the tool is written in the prompt: ''Not-Intested''' tool, Not-Interested tool, Not-Interested ([toolsId]) tool, - Created a custom function tools & tried async true & false - Used the Vapi toolsId & tried async true & false It just does trigger the tool for some reason in the JSON structure
s
@vstar Your prompt token length is 4,859, which is quite substantial. It is important to note that any length greater than or equal to 2,500 tokens may encounter performance issues. I recommend either breaking down your prompt into smaller segments or reducing the overall length to a minimum of 3,000 tokens. While the former approach is likely to be effective most of the time, the latter may not yield consistent results. Therefore, I kindly urge you to consider reducing your prompt length and testing it accordingly. https://cdn.discordapp.com/attachments/1333880245681393756/1335841132340318318/Screenshot_2025-02-03_at_10.42.45_AM.png?ex=67a1a280&is=67a05100&hm=258c59e837028334274c58f0f7a165f51058423925a5ac600d384fc974c766d8&