You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update model to gpt-4.1 and add LiquidJS reference
- Changed all examples from gpt-4o-mini to gpt-4.1
- Added note explaining that Vapi uses LiquidJS for variable substitution
- Clarified that {{ }} syntax follows Liquid template language conventions
VAP-11219
Co-Authored-By: Claude <[email protected]>
Copy file name to clipboardExpand all lines: fern/chat/variable-substitution.mdx
+14-10Lines changed: 14 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,10 @@ When using sessions with the Chat API, understanding how variable substitution w
10
10
11
11
**Key concept:** Variables are substituted at session creation time and "baked into" the stored assistant configuration. Template placeholders like `{{name}}` are replaced with actual values and no longer exist in the session.
12
12
13
+
<Note>
14
+
Vapi uses [LiquidJS](https://liquidjs.com/) for variable substitution. The `{{ }}` syntax follows Liquid template language conventions, giving you access to filters, conditionals, and other Liquid features beyond simple variable replacement.
15
+
</Note>
16
+
13
17
---
14
18
15
19
## How variable substitution works
@@ -19,7 +23,7 @@ When using sessions with the Chat API, understanding how variable substitution w
19
23
When you create a session with `assistantOverrides.variableValues`, the system:
20
24
21
25
1. Takes your assistant's template variables (e.g., `"Hello {{name}} from {{company}}"`)
22
-
2. Substitutes all `{{}}` placeholders with provided values
26
+
2. Substitutes all `{{}}` placeholders using LiquidJS
23
27
3. Stores the **pre-substituted assistant** in the session
24
28
4. Saves the original variable values in `session.metadata.variableValues` for reference
25
29
@@ -69,7 +73,7 @@ If your assistant's system prompt was `"You are a helpful assistant for {{name}}
69
73
When you send a chat request with a `sessionId`:
70
74
71
75
1. The system loads the session's pre-substituted assistant
72
-
2. Any `variableValues` in the chat request are processed, but **there are no `{{}}` placeholders left** to substitute
76
+
2. Any `variableValues` in the chat request are processed, but **there are no `{{}}` placeholders left** to substitute
73
77
3. New variable values have **no effect** on already-substituted text
74
78
75
79
---
@@ -166,7 +170,7 @@ The assistant still responds with "John" and "Acme Corp" because the original te
166
170
167
171
### Provide fresh templates to use new values
168
172
169
-
To use different variable values mid-session, provide a new template with `{{}}` placeholders along with the new values:
173
+
To use different variable values mid-session, provide a new template with `{{}}` placeholders along with the new values:
170
174
171
175
<CodeBlocks>
172
176
```bash title="cURL"
@@ -179,7 +183,7 @@ curl -X POST https://api.vapi.ai/chat \
179
183
"assistantOverrides": {
180
184
"model": {
181
185
"provider": "openai",
182
-
"model": "gpt-4o-mini",
186
+
"model": "gpt-4.1",
183
187
"systemPrompt": "You are a helpful assistant for {{name}} at {{company}}. Be very formal."
0 commit comments