Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
node_modules/
dist/
.env
.DS_Store
.DS_Store
.tool-versions
26 changes: 23 additions & 3 deletions fern/assistants/dynamic-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ These variables are automatically filled based on the current (UTC) time, so you
| `{{year}}` | Current year (UTC) | 2024 |
| `{{customer.number}}` | Customer's phone number | +1xxxxxxxxxx |
| `{{customer.X}}` | Any other customer property | |
| `{{transport.conversationType}}` | Whether the conversation is over `chat` or `voice` | `chat` |
| `{{transport.X}}` | Any other transport-related property | |

## Advanced date and time usage

Expand Down Expand Up @@ -116,13 +118,13 @@ Outputs: `Monday, January 01, 2024, 03:45 PM`
| `%H:%M` | 15:45 | 24-hour time |
| `%A` | Monday | Day of week |
| `%b %d, %Y` | Jan 01, 2024 | Abbrev. Month Day |
```


## Using dynamic variables in the dashboard

To use dynamic variables in the dashboard, include them in your prompts or messages using double curly braces. For example:

```
```liquid
Hello, {{name}}!
```

Expand All @@ -131,4 +133,22 @@ When you start a call, you must provide a value for each variable (like `name`)
<Note>
Always use double curly braces (`{{variableName}}`) to reference dynamic variables in your prompts and messages.
</Note>
</rewritten_file>

## Setting assistant prompt using conversation type

Using the `transport.conversationType` variable in your assistant's system prompt, you can modify how it behaves in chats or calls:

```liquid
[Identity]
You are a helpful assistant, talking with a customer via {{transport.conversationType}}.

[Response Guidelines]
{% if transport.conversationType == "chat" -%}
- Format numbers naturally; eg, a US phone number could be +1 (555) 123-4567
- Use Markdown formatting for lists (both unordered and ordered)
{%- elsif transport.conversationType == "voice" -%}
- Always spell numbers in words; eg, 256 should be 'two hundred and fifty six'
- Only ask one question at a time
- Never use Markdown format; write everything as if it is being said aloud
{%- endif -%}
```
Loading