Configuring an assistant in an assistant-request r...
# support
n
I see in the docs and also successfully tested this with the following response from my serverUrl:
Copy code
{
  "assistant": {
    "firstMessage": "Hey Ryan, how are you?",
    "model": {
      "provider": "openai",
      "model": "gpt-3.5-turbo",
      "messages": [
        {
          "role": "system",
          "content": "You're Ryan's assistant..."
        }
      ]
    }
  }
}
However, I'm also trying to add more configuration like functions, maxDuration, maxTokens, etc. that are available on the create assistant API. Now I'm getting an "assistant-request-returned-invalid-assistant" error but with no details about what is causing the problem. An example of my response is this:
Copy code
{
  "assistant": {
    "firstMessage": "Hi!",
    "maxDurationSeconds": 89,
    "maxTokens": 250,
    "functions": [
      {
        "name": "get_weather",
        "async": false,
        "description": "Get the weather",
        "parameters": {
          "type": "object",
          "properties": {
            "zip": {
              "description": "This is the user provided zip code",
              "type": "string"
            }
          }
        },
        "serverUrl": "https://serverurl.com"
      }
    ],
    "transcriber": {
      "provider": "deepgram",
      "model": "nova-2-phonecall",
      "language": "en-US"
    },
    "model": {
      "provider": "openai",
      "model": "gpt-4o",
      "messages": [
        {
          "role": "system",
          "content": "You are very helpful..."
        }
      ]
    }
  }
}
v
Hi @natanio, I'm an AI assistant for Vapi. I'll analyze available sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Create Phone Call]() * [Create Assistant]() * [Server Events]() * [List Calls]() -----------------------------
### Answer It seems like you are encountering issues when trying to add additional configurations to your assistant via the assistant-request from your
serverUrl
. The error you mentioned, "assistant-request-returned-invalid-assistant," typically indicates that the assistant configuration you're passing doesn't conform to the expected schema defined by Vapi. Based on your configuration snippet, a few things need to be verified: 1. **Parameter and Field Validation**: Ensure all fields and parameters are named and used correctly as per Vapi's standards. You mentioned using
maxDurationSeconds
and
maxTokens
, which are not part of the assistant's settings retrieved or modified through the
serverUrl
response in the documentation. 2. **JSON Structure**: The JSON must be correctly structured and all required fields must be included. If the
functions
array or any other components are not structured or named exactly as expected, that could trigger an error. Since the detailed schema for what can be returned in an assistant-request isn't explicitly covered in the provided documents, I recommend ensuring that your implementation strictly adheres to what is defined in the Vapi documentation for creating or updating assistants. Here are some key aspects you can check: - **Transcriber and Model Compliance**: Ensure the
transcriber
and
model
configuration adhere strictly to the schemas provided in the documentation. For instance, the model type (
nova-2-phonecall
for
transcriber
or
gpt-4o
for
model
) should be validated against what's permissible in the API references. - **Function Configuration**: The structure of the
functions
array should precisely match the expected format. Make sure that all necessary sub-fields are provided and correctly formatted. For now, you may need to limit adjustments through the
serverUrl
to parameters known to be suppo
rted, and use the official API endpoints for any configurations not documented as part of the server response schema. To resolve the issue, I recommend reviewing the API documentation related to creating and updating assistants to ensure your configurations are correct and supported. You can refer to the documents on creating assistants [(1)]() and server events [(2)]() for more detailed guidance. Also, consider contacting Vapi support directly if the configuration aligns with the documentation but the problem persists.
Got it. Tagging @User for additional help.
Got it. Tagging @User for additional help.
s
There must be something wrong. Please check your JSON data at https://jsonlint.com/.
n
The JSON is valid
s
Can you send me the exact curl request? I will check it on my side.
2 Views