Creating a Flow from the Script/Conversation
To create a structured flow from your script or conversation, you need to break down the entire interaction into distinct steps and define the prompts, tools, and transitions between each step. Here’s a step-by-step guide on how to do this: Step 1: Outline the Conversation Flow Start by outlining the entire conversation, identifying the key stages, and determining the primary objectives for each stage. Example Conversation Flow:- Personalized Welcome
- Determine Age
- Categorize Age
- Transfer Call
- Personalized Welcome
- Prompt: “Hi there! Thanks for your interest in our health insurance services. I’m here to help find the best options for you. How may I assist you today?”
- Next Step: Determine Age
- Determine Age
- Prompt: “To provide you with the most suitable insurance options, could you please tell me your age or the age of the person needing insurance?”
- Next Step: Categorize Age
- Categorize Age
- Prompt: “Thank you for providing that information. Let me check the best options for you.”
- Tool/Action: yes_or_no (to determine if age is 65 and above or below 65)
- Next Step if yes (65 and above): Transfer Call (Medicare)
- Next Step if no (below 65): Transfer Call (General Health Insurance)
- Transfer Call
- Prompt for 65 and above: “Based on your age, I’ll connect you with our Medicare specialist who can provide you with the best options. Please hold while I transfer your call.”
- Prompt for below 65: “I’ll connect you with our health insurance expert who can guide you through our plans. Please hold while I transfer your call.”
- Tool/Action: transfer_call (to connect the user to the appropriate licensed agent)
- End of Flow
API Structure Explanation
The API structure for the conditional prompting system is designed to guide the AI voice agent through a conversation flow. Here’s a breakdown of its main components:1
General Prompt
The
general_prompt is a string that provides overall instructions and guidelines for the AI voice agent. It typically includes:- Identity: Defines the role and persona of the AI voice agent.
- Style Guidelines: Instructions on how to communicate (e.g., be concise, use variety in language).
- Response Guidelines: General rules for handling user interactions (e.g., adapting to errors, staying in character).
- Guardrails & Compliance: Rules that the AI must follow to ensure compliance with the laws and regulations.
2
Steps
The
steps array contains individual objects that represent each stage of the conversation. Each step includes:step_id: A unique identifier for the step.prompt: Instructions or questions for the AI to use at this stage of the conversation.next_step: Indicates which step to move to next. This can be a single step ID or an object with conditional next steps.tools(optional): An array of function definitions that the AI can use at this step.
Note: The agent progresses to the next step or a specific step in two cases:Important: If a step’s prompt doesn’t have any tools or perform any actions, the agent will remain at that step and use the same prompt.
- When the
extract_datafunction is executed.- When the
yes_or_nofunction is executed.
3
Tools
The steps array contains individual objects that represent each stage of the conversation. Each step includes:Tools are defined within steps and represent functions that the AI can call to get a deterministic output. Each tool has:
type: Usually set to “function”.function: An object describing the function, including:name: The name of the function (e.g., “yes_or_no”, “extract_data”).description: A brief explanation of what the function does.parameters: An object describing the input parameters for the function.
4
Actions
Actions in the API structure represent specific operations that the AI voice agent can perform or request to be performed. Unlike tools, which are function calls, actions are typically predefined commands that trigger specific behaviors or processes in the system.Key points about actions:
- They are usually simple commands (e.g.,
transfer_call,hangup_call). - Actions are typically mentioned in the prompt of a step, instructing the AI when to use them.
- They don’t require parameter definitions like tools do.
- Actions are often used for system-level operations or to transition between different states of the conversation.