Dynamic prompts

By default, prompt expansion happens at the beginning of the conversation, as part of agent’s initialization.

Alternatively, you can use dynamic_prompt advanced configuration variable to re-generate prompt for specific agent dynamically, on each user utterance.

{
    "dynamic_prompt": true
}

When dynamic prompts are enabled, the following additional variables may be used in prompt expansion:

Variable

Type

Description

user_utterance

string

Last user utterance

user_utterance_count

integer

Starts with zero and is incremented with every user utterance

user_message_count

integer

Similar to user_utterance_count, but ignore "fake" messages generated by NO-USER-INPUT or DTMF events.

duration

integer

Duration of the call in seconds

The following example demonstrates the use of dynamic prompts in an outbound dialer agent to ensure that the call is answered by a real human, and not IVR’s or an answering machine.

{{#if ("your call is important" in user_utterance or
       "stay on the line" in user_utterance or
       "wait while we connect" in user_utterance or
       "NO-USER-INPUT" in user_utterance)}}
    {{#if duration < 40}}
        Say "Waiting for human to join"
    {{#else}}
        End the call
    {{/if}}
{{#else}}
    Introduce yourself.
    Inform user that his car was evacuated.
    ...
{{/if}}