Setup assistant voice and max duration on the fly ...
# support
m
Hi, I'm trying to create assistants on the fly on inbound calls. I'm receiving the
assistant-request
events all right and I'm able to respond with a personalized
assistant
.
Copy code
{
  assistant: {
    firstMessage: "...",
    model: { provider: "openai", model: "gpt-4o", messages: [...] },
  }
}
and that part is working ok. Now when I'm trying to tweak other settings:
Copy code
{
  assistant: {...},
  voice {
    provider: "cartesia",
    voiceId: "a3520a8f-226a-428d-9fcd-b0a4711a6829",
  }
  maxDurationSeconds: 30,
}
these settings are not applied. Is there a way to do that? I couldn't find anything in the doc, I only referred to https://docs.vapi.ai/api-reference/assistants/create assuming this object was used across the board. Thanks
v
Hi there! I see you're trying to configure voice settings and max duration for assistants created on the fly. Based on the documentation I found, there might be an issue with how you're structuring your response object. For setting the voice provider and voiceId, you should include the voice configuration inside the assistant object, not as a separate property at the same level. Similarly, maxDurationSeconds should be configured differently. Here's how your configuration should look:
Copy code
json
{
  "assistant": {
    "firstMessage": "...",
    "model": { 
      "provider": "openai", 
      "model": "gpt-4o", 
      "messages": [...] 
    },
    "voice": {
      "provider": "cartesia",
      "voiceId": "a3520a8f-226a-428d-9fcd-b0a4711a6829"
    },
    "maxDurationSeconds": 30
  }
}
For the maxDurationSeconds parameter specifically, you can also use the assistantOverrides approach in some contexts:
Copy code
json
{
  "assistantOverrides": {
    "maxDurationSeconds": 120
  }
}
The maxDurationSeconds parameter defines how long the assistant will wait before interrupting (useful for IVR systems), and Vapi now supports values up to 43,200 seconds (12 hours) [as noted in their changelog](https://docs.vapi.ai/changelog/2024/10/19). If you're still having issues with this configuration, it might be worth checking if the assistant-request event handler has specific requirements that differ from the standard assistant creation API. Sources: - [Vapi Documentation](https://docs.vapi.ai/examples/voice-widget) - [Vapi Community](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1335807780287676456) - [Vapi Changelog](https://docs.vapi.ai/changelog/2024/10/19)
Message marked as helpful by @Maphe! 🎉
m
all right that seems to be working, is there a way to override the voice speed as well?
ok I found
experimentalControls
for cartesia voice specifically in the changelog, so now my only remaining question is, when the experimental control becomes non-experimental anymore, does is break the assistant or is it just gonna gracefully ignore the setting?
k
Hello Maphe, This is up to how Cartesia handles taking it out of experimental. We'll do our best to handle it on our end or inform you of any changes you would need to make in the changelog.