prompt update with AssitantOverride
# support
s
Hi there, I am trying to override the assistant's initial prompt when launching it from my application, but it doesn't work, any advice? I am inserting a topic (as a variable) into the prompt. Here is the code! Thanks everyone for your support! assistantOverrides: { systemPrompt: "You are a helpful assistant. The topic for this conversation is " + topic + ". Please discuss this topic with the user, providing guidance, asking relevant questions, and offering constructive feedback related to the topic." }, config: { mode: "call", call: { config: { showCallControls: true, enableVideo: true, // Enable video for full experience parentElement: "#vapi-container" // Specify container for the widget } }, initialMessage: "My name is Amy, and I see you would like to talk about " + topic + "... let's get into it." } };
v
Hey there! It looks like you're trying to override the initial prompt for your voice AI assistant, but it's not working as expected. Here are a few things to check: 1. **Variable Definition**: Make sure that the
topic
variable is defined and has a value before you use it in your
systemPrompt
and
initialMessage
. If
topic
is undefined or empty, it could lead to issues. 2. **Correct JSON Structure**: Ensure that your JSON structure is correctly formatted. The
assistantOverrides
and
config
should be properly nested within the main configuration object. 3. **API Request**: When sending this configuration to the VAPI API, ensure that you are using the correct endpoint and that your request is properly formatted. If the API request fails, the assistant may revert to a default prompt. 4. **Check for Errors**: Look for any error messages in your console or logs that might indicate what went wrong during the setup. 5. **Testing with Static Values**: As a troubleshooting step, try replacing
topic
with a static string to see if the prompt works without the variable. This can help you determine if the issue is with the variable itself. If you follow these steps and still encounter issues, feel free to share any error messages or additional details, and I'll be happy to help further! 😊 Sources: - [Vapi Dynamic Variables](https://docs.vapi.ai/assistants/dynamic-variables) - [Vapi Quickstart Dashboard](https://docs.vapi.ai/quickstart/dashboard) - [Vapi & Discord Documentation Discussion](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1333350360932421682)
s
can I get feedbak on syntax of the script I posted along with my ticket?
p
The issue is that in your configuration, you're directly setting systemPrompt at the root level of assistantOverrides, but the system prompt needs to be nested within the model object. Here's how you should structure your configuration:
Copy code
"assistantOverrides": {
    "model": {
      "provider": "openai",
      "messages": [
        {
          "role": "system",
          "content": "insert-your-system-prompt-here"
        }
      ]
    },
    "firstMessage": "insert-first-message-here"
  }
The key difference is that systemPrompt needs to be nested within the model object in the assistantOverrides. The system analyzes the model configuration and applies the system prompt from there rather than from the root level.
s
@shayanrmt Do let me know if you require further help!!
3 Views