How can I call `defaul tools` like transfercall fr...
# support
m
I am using customllm in the vapi assistant. How can I call the defaults like transfercall tool with warm transfer in side the custom llm?
v
Hi there! đŸ‘‹ I can definitely help you with calling default tools like
transferCall
from your custom LLM in Vapi, including implementing warm transfers! Here's how you can do this: ### 1. Add the Default Tools to Your Model's Tools Array First, you need to add the
transferCall
tool to your model's
tools
array in your configuration:
Copy code
json
{
  "model": {
    "provider": "openai",
    "model": "gpt-3.5-turbo",
    "messages": [
      {
        "role": "system",
        "content": "You are an assistant. When the user asks to be transferred, use the transferCall function."
      }
    ],
    "tools": [
      {
        "type": "transferCall",
        "destinations": [
          {
            "type": "number",
            "number": "+1234567890"
          }
        ]
      }
    ]
  }
}
### 2. Handle the Tool Call in Your Custom LLM When your custom LLM detects the need for a call transfer, you need to send a function call payload back to Vapi. Here's how to handle it:
Copy code
javascript
if (functionName === "transferCall" && payload.destination) {
  const functionCallPayload = {
    function_call: {
      name: "transferCall",
      arguments: {
        destination: payload.destination,
      },
    },
  };
  res.write(`data: ${JSON.stringify(functionCallPayload)}\n\n`);
  // Skip further processing for this chunk
  continue;
}
### 3. Implementing Warm Transfer To implement a warm transfer (which provides context to the recipient), you need to add a
transferPlan
object to your configuration. Here's an example for a warm transfer with a message: ```json { "type": "transferCall", "destinations": [ { "type": "number", "number": "+1234567890", "transferPlan": { "mode": "warm-transfer-with-message", "message": "Hi, we have customer {{firstName}} calling about {{issueType}}. Can you assist them?" } } ], "function": { "name": "transferCall",
"description": "Use this function to transfer the call with a warm introduction to the specified destination." } } ``` Vapi supports several warm transfer modes: - **warm-transfer-with-message**: Sends a custom message to the recipient - **warm-transfer-with-summary**: Provides a summary of the call using the transcript - **warm-transfer-with-twiml**: Uses TwiML instructions for more complex scenarios - **warm-transfer-wait-for-operator-to-speak-first-and-then-say-message**: Delays the warm message until after the operator speaks Would you like more specific information about any of these steps or warm transfer modes? Sources: - [How to call default tools from customLlm in Vapi?](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1335181348285054996) - [How to use the transfercall tool in Vapi?](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1328028159949537341) - [How to perform a warm transfer using the transfercall tool in Vapi?](https://docs.vapi.ai/call-forwarding) - [How to integrate customLlm and default tools within the Vapi assistant?](https://docs.vapi.ai/tools/default-tools)
m
Okay this is my understanding, I can create a transferCall tool with transferCallPlan to define the warm transfer, but how can I call this default tool - transferCall tool from my customLLM?
@User
k
You will need to properly set up the assistant’s tools array and make sure that your custom LLM can call the tool with the required parameters.