silky-coral
silky-coral3mo ago

Bug in PATCH /assistant/{id} — System Prompt (messages) Reset Unexpectedly

Description: When using the PATCH /assistant/{id} endpoint to update only the model type (e.g. changing model.model from gemini-1.5-pro to gemini-1.5-flash), the messages field (specifically the system prompt) is getting reset to its default value, even though it is not included in the request payload. Expected Behavior: If messages is not provided in the PATCH request, the existing system prompt should remain unchanged. Actual Behavior: Vapi automatically resets messages to a default value to empty Steps to Reproduce: 1. Create an assistant with a custom messages system prompt. 2. Send a PATCH request to update only the model name: { "model": { "provider": "google", "model": "gemini-1.5-pro" } } 3. Observe that messages has reverted to the default prompt. Impact: This breaks existing assistant logic where the prompt holds domain-specific behavior or branding, leading to unexpected assistant behavior after seemingly safe updates. Screenshot (for reference): Attached. Request: Please ensure that the messages field is not reset unless explicitly provided in the PATCH payload.
No description
2 Replies
Vapi Support Bot
The current Vapi API documentation does not specify that omitting the messages field in a PATCH /assistant/{id} request should preserve its value, but typically, optional fields should remain unchanged if not provided. As a workaround, to avoid your system prompt being reset, always include the existing messages value in your PATCH payload when updating other fields:
{
"model": {
"provider": "google",
"model": "gemini-1.5-pro"
},
"messages": [ /* your current system prompt here */ ]
}
{
"model": {
"provider": "google",
"model": "gemini-1.5-pro"
},
"messages": [ /* your current system prompt here */ ]
}
This ensures your custom prompt is retained until the API behavior is clarified or fixed. Source: - Vapi API Reference – Update Assistant (PATCH)
⤵️ Mention @Vapi Support Bot for follow-ups 🐥
Sahil
Sahil3mo ago
Hey Akash, this is note and bug. When you update the nested fields of the assistant, you have to supply the complete object. You have to merge the updated and non-updated fields because they are part of second-level nesting inside the assistant schema. Currently, we don't have any circular reference control on this. this is note and bug -> this is not a bug*

Did you find this page helpful?