Dynamic Variables | Hume API

Using variables in your prompt

To set up dynamic variables, first include placeholders for them in your system prompt. Use double curly braces ({{variable_name}}) to mark where each variable should appear in the text. This allows EVI to replace these placeholders dynamically with the specified values.

Sample prompt with dynamic variables

Address the user by their name, {{name}}.
If relevant, reference their age: {{age}}.
It is {{is_philosopher}} that this user is a philosopher.

Assigning values in session settings

After adding placeholders for dynamic variables in your prompt, set their values by sending a Session Settings message over the WebSocket within an active Chat session. This message includes a variables parameter, with each key matching a placeholder in your prompt and each value specifying the text EVI will use.

Session settings

{
  "type": "session_settings",
  "variables": {
    "name": "David Hume",
    "age": 65,
    "is_philosopher": true
  }
}

Default dynamic variables

Hume provides built-in dynamic variables that are automatically populated and can be referenced in system prompts without needing to set their values in SessionSettings. The currently supported default variable is:

You can reference now in your system prompt to dynamically include the current UTC date and time.