sacred-roseS
VAPI4mo ago
sacred-rose

Widget Chat API System Prompt Overriding

Question 1: Do the Widget Chat APIs support a system prompt field?
How can we add a prompt in the Widget Chat API to tell the assistant it’s text chat, not a voice call?

Scenario
We want to reuse the same assistant prompt for both voice assistants and widget chatbot (through calling the Widget Chat API):
curl -X POST https://api.vapi.ai/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "assistantId": "your-assistant-id",
    "input": "Explain how to set up API authentication in detail",
    "stream": true
  }'

Right now the assistant replies as if it’s in a voice call. We want to add an override (or maybe additional is better) system prompt to make sure it knows this is text chat.


Question 2: We’re also considering Pass Dynamic Variables so the assistant can detect the mode in text chat. For example:

You are a helpful {{chatMode}} customer support agent

In the Widget Chat API we can set:

"assistantOverrides": {
  "variableValues": {
    "chatMode": "text chat"
  }
}

So the question is: if we only modify the prompt in the front-end GUI for the voice assistant, how can we do the same variable substitution so the voice assistant knows it’s in voice mode?
Was this page helpful?