Gen AI Management
With Teneo Gen AI Management, users can build, manage, and visualize Gen AI agents that are capable of performing numerous runtime tasks. This framework enables users to craft underlying Gen AI prompts through guided UIs, modular implementation, and with full platform support, thus streamlining development, enhancing collaboration, and delivering secure, resilient, and brand-aligned AI interactions.
The sections on this page provide information about the various aspects of Gen AI Management in Teneo:
Concept
Gen AI Management is native in Teneo and facilitates the implementation of Gen AI driven runtime Tasks with designated guided UIs and bring Gen AI usage across a solution to life.
Users can easily build, manage, and modify Generative AI agents in a modular way, implementing Gen AI driven tasks through specific guided UI processes, where the system is in charge of composing the final prompt, ensuring it is secure, complete, robust, functional, and on brand.
Users can create Personalities and Goals to perform specific Gen AI Tasks. This way, it is possible to:
- Generate a Gen AI Output and send it as a response to the end-user
- Annotate user inputs with the Gen AI Annotator and use the annotations in the matching process with Gen AI matches
- Store Gen AI results in a variable with the Gen AI Action for internal logic or tasks
With the Generative AI features, the workload can be split between members of a team based on their roles/responsibilities to reduce the cognitive load and make the development more efficient. The users can connect to the Gen AI service of their choice and multiple connections can be defined for different purposes.
The Gen AI Overview graphically visualizes all use of Gen AI throughout the solution, as well as allowing for easier troubleshooting, maintenance, and navigation help. The Overview can be used to explore usage across the solution, to validate that the correct personalities or handlers are in use for each goal and to see in which flows Gen AI is in use. The Gen AI Overview is also where you can see the final prompt that is to be sent to the Gen AI system for a given Task.
The user has full freedom when defining Personalities, Goals and Tasks, but recommendations of what should be included in each section to compose the final prompt are given in tooltips in Teneo Studio and in the UI section of this page.
Personalities
A custom Personality interacts with the end-user by giving output in a flexible and imaginative way based on the specifications in the Personality, Goal, and Output sections.
The System Personality, available out-of-the-box, is designed to boost efficiency and perform various tasks that are not shown to the end-user. You can annotate a user input to be used in a Match or perform an Action with the help of the System Personality.
Users can create as many Custom Personalities as they need for their various use cases.
There is only ever 1 System Personality.
Any Personality can be associated with as many Goals as needed.
Custom Personality
A Personality defines the tone, style, and behavioral traits of a Gen AI agent. It acts as the narrative layer that shapes how the AI communicates with end-users and provides guidelines on how to best reflect the company brand. Personalities are especially important when the Gen AI prompt is exposed to end users, such as in customer support or brand engagement scenarios. For tasks not involving generating text to be displayed directly to the user, consider using the System Personality instead.
Personalities can be associated with one or more Goals, ensuring consistency across tasks and easier maintenance. It is also possible to adjust the agent's tone of voice, with parameters Creativity, Formality, Friendliness, and Verbosity, and set a brand identity. See Personalities tab for more information on the sections.
For a practical use case, please see Rephrasing Output.
System Personality
The System personality comes pre-configured, out-of-the-box with Teneo and is specifically optimized to perform tasks that require the Gen AI model to act as a system rather than taking on a persona. The system agent is your go-to personality for any tasks where the result from the Gen AI model isn't exposed to the end user in form of a response, but rather for tasks that result in commands to be used internally in Teneo, such as:
- Intent classification
- Entity extraction
- Summarization
- Sentiment analysis
- Input annotation
Unlike user-facing Personalities, the System agent is intended to operate silently in the background, executing logic that supports the broader conversational experience.
For practical use cases, please see Intent Classification and Dialogue Summarization.
As the System agent isn't designed to output text directly to the end-user, it does not have the parameters Creativity, Formality, Friendliness, and Verbosity for modifying the tone of voice.
Goals
A Goal should outline the overall purpose or job that a given agent must achieve and what knowledge or scope is required. The Goal will specify which Personality it is associated with, what Handler to use, and the required format of the result from the Gen AI model. A Goal is associated with one Personality, and its overall purpose can be achieved by one or multiple Tasks.
Goals ensure:
- Consistency: The same logic and tone are applied across different use cases.
- Reusability: A single Goal can be used for multiple Tasks, reducing duplication and improving maintainability.
- Modularity: You can swap out Handlers or Personalities without rewriting the entire setup.
A Goal can only be associated with one Handler at a time. If the developer wants to compare the results for two different Gen AI systems, a new identical Goal could be created, using a different Handler.
Changing from one Gen AI system to another can affect the output as much as changing prompt or the tone of voice settings; testing different systems or models is highly encouraged.
A Goal assigned to the System Personality could for example look like one of the following:
Your goal is to summarize dialogues. Please give a summary of the available conversation.
Classify an input from a user into predefined categories.
A custom Personality could, for example, be associated with one of the following Goals:
Your goal is to rephrase the default response of a chatbot given information in a user input.
The rephrased answer should contain the same information of the default response, but be rephrased according to the user’s personal information.
Where relevant, information about the user included in their input should be incorporated into the rephrased answer, e.g.:
- by using their name
- by referencing their location
- by referencing other relevant information in their input
Your goal is to report to the user that you don't have information about the request or that you don't understand the user's question.
A Goal can be as short or long as needed, but it is recommended to keep it as concise as possible. Please see Best Practices for more tips.
Tasks
Tasks define the specific event that should happen for the Gen AI use case. A Task is carried out based on a previously defined Goal and Personality that it has been assigned and the final prompt that will be sent to the Gen AI System combines all the provided information and prompts from a Personality, a Goal and a Task.
The prompts for any Task support string interpolation (with the syntax ${variable}), making it possible to embed any Groovy such as Global and Flow Variables or Engine access methods to create a dynamic prompt.
Annotators
Gen AI Annotators will annotate the input with the result of a Gen AI prompt. This annotation can then be used for matching in a Gen AI Match on a Trigger or Transition.
The annotation will be named the same as the Gen AI Annotator document (normalised to be unique and valid for TLML), and with a suffix .GEN_AI and it holds a variable named value, which will contain the result of the Gen AI prompt. It is of course also possible to refer to a Gen AI annotation from TLML syntax, just like with any other Annotation. Gen AI Annotators use Deferred Annotations "behind the scenes" and as such are guaranteed to only be called when required, which optimizes the impact of Gen AI usage.
Output
Gen AI Output generates and displays a response to the end-user based on a prompt. It replaces traditional output nodes in Flows where dynamic, AI-generated responses are preferred. A Flow can have a combination of Gen AI Output nodes and "traditional", static Output nodes to create a hybrid implementation.
Action
The Gen AI Action executes a prompt and stores the result of the prompt in a variable for further use in the dialogue. An Action can be used for internal logic and tasks, such as summarizing a dialogue, detect and extract entities from an input etc.
Handlers
A Handler is responsible for calling the Gen AI Model API and understanding the response. The Handler is implemented as a Groovy script which is able to make the required API calls and convert the response into the appropriate format for Teneo to understand.
It is strongly recommended to use a Secret script and Secrets for the actual HTTP requests to the Gen AI API in order to keep any API keys, tokens or locations protected within the solution - the Handler should call this Secret implementation.
The Handler script receives two variables (prompt & temperature) and is responsible for calling the AI Service (via a secret script) with these parameters and returning the result.
The Handler script must set the variable chunker before completing. This Chunker is an object which provides appropriately sized chunks to the solution for output/handling - "Appropriate size" for the chunks depends on the output channel, but paragraphs work well for most scenarios.
| In/Out | Parameter | Type | Description |
|---|---|---|---|
| Input | prompt | String | Complete prompt, constructed from the information provided in the specific Personality, Goal and Task. |
| Input | temperature | float | Derived from the creativity, defined in the Personality configuration and is a float value between 0 and 1. |
| Output | chunker | Chunker | Must be populated before the end of the handler script. Provides the solution with access to the prompt response (in chunks). see Chunker specifications. |
The UI provides a simple template of the handler script as a starting point of it's implementation, and it can be adapted so that the user can connect to a Gen AI service of choice. For an example on how to connect to a deployment in Azure Cloud, read more at Configure the handler
Although supported, it is not recommend to use DeepSeek models due to data privacy concerns.
Chunker specifications
The return from the Handler method must be a class that supports stream responses buffered in an internal queue, with partial responses represented as Chunk objects. The specification for this class is defined here - the implementation is case specific and becomes part of the solution.
Methods
| Method Name | Return Type | Description |
|---|---|---|
getAggregatedChunk() | Chunk | Returns a chunk with the response text. The consumer waits to all the partial responses, chunks, and aggregates the result in a single chunk. |
getNextChunk() | Chunk | Returns the next chunk with the next partial response - used when streaming. The last partial response must be a chunk with an empty response, content = ““, and isFinal = true. |
Chunk specifications
The Chunk class represents the actual returned chunks. This is a simple data holder (record) class and can be shared by all Chunker implementations. To do this define the Chunk class in an On Solution Loaded Global script.
| Field Name | Return Type | Description |
|---|---|---|
content | String | Response text |
isFinal | boolean | We’ve receive the last part of the response |
isError | boolean | The consumer has finished unexpectedly. Check the errorMessage field to get more details. |
errorMessage | String | Error message if necessary |
Security
The Prompt editor includes strict security measures to ensure the responsible and secure use of LLMs in your System Agents and Personalities. These measures provide protection against jailbreaking and attacks, but also ensure alignment with company policies and ethical standards.
- Malicious user inputs are detected to prevent prompt injection, abuse, or manipulation of the model's behavior.
- Avoid misuse of personal information if provided in the prompt.
- Prevent the LLM requesting sensitive data or recommending dangerous actions.
Additional security measures may be available through your Cloud provider; please contact them for more information.
The security measures have been designed to be non-disruptive and to protect against potential issues. We recommend you keep them on, especially when handling user-sourced dynamic information.
RAG scenarios for example are especially susceptible as there is access to more information - and more user input involved in the prompting. RAG implementations hand over large portions of user input directly to Gen AI to extract the information and provide an answer to the end user.
Overview
With the Gen AI Overview, the user can see all usages of Gen AI features throughout the solution and how they work together to deliver the desired functionality. The Overview can be used to explore usage across the solution, to validate the correct Personalities or Handlers are in use for each Goal and to see in which Flows Gen AI is in use. The Overview is updated in real time, so you always see when you create a new element and what elements are related to each other. The Gen AI overview is also where you can see what the final prompt sent to the Gen AI system for any given Task.
How To
Configure the Handler
This guide assumes that the user has a running deployment in Azure cloud. It also assumes the user has sufficient user permissions to work with Secrets and secret scripts.
Below guide provides and example for how to connect to a deployment in the Azure cloud and how to make it accessible for a Gen AI Handler.
First of all, under the Account, create the following Secrets and populate them with the values for your deployment in Azure:
| Secret | Description |
|---|---|
openai_resource_name | Resource name |
openai_deployment_id | Deployment name |
openai_api_key | Private key |
openai_api_version * | API version |
*Even though the API version is not a confidential parameter, it is stored as another secret to tie it to the deployment.
The scripts available for download are the following:
Solution Loaded scripts
ChunkA simple declaration of the chunk object with its required parametersOpen AI SSE Chunking ConsumerA template implementation of a Chunker consumerOpen AI Prompt HandlerA template with the OpenAI API standards
Secret Script
OpenAI Connection HandlerA secret script with the http connection to an OpenAI endpoint
Handler Script
GenAI Handler openAIPopulates the chunker with the provided parameters
To set up a handler, follow these steps:
-
In your solution, navigate to Global Scripts, create the above three Solution loaded scripts and paste as their script the equivalent script available from this Download.
-
The execution ordering of the scripts is important, The
Chunkrecord is used by theSSE Chunking Consumer, and theSSE Chunking Consumermust be declared before thePrompt Handler.With Script ordering, ensure that the Chunk consumer script is ordered above the Prompt Handler.
-
Add a new Secret script OpenAI Connection Handler and paste as its script the equivalent script available from this Download.
-
Navigate to the Handlers tab in the Gen AI Manager. Add a new Handler named OpenAI Handler and replace the default script with the script available from this Download.
-
Once all documents are created and saved, you can test and verify your new Handler, for example with one of the use cases from the Practical Examples.
UI
- Teneo Studio Desktop
- Teneo Studio Web
In Teneo Studio Desktop, you can access the Gen AI Manager from the top ribbon bar:

The Gen AI Manager in Teneo Studio Desktop has two tabs:
- Gen AI which contains information for Personalities, Goals, Annotators, Handlers.
- Home including Gen AI Overview which visualizes the Gen AI elements.
In Teneo Studio Web, you can access the Gen AI Management functionalities in the main view of your Solution:

Teneo Studio Web has two tiles for Gen AI:
- Gen AI Overview which visualizes the relations of the Gen AI elements
- Click the Gen AI Overview text or the arrow to open the Gen AI Overview.
- Gen AI which contains information for Personalities, Goals, Annotators, Handlers
- Click the Plus sign to create a new Personality, Goal, Annotator or Handler.
- Click the arrow to see a list of Personalities, Goals, Annotators or Handlers.
Gen AI Overview
- Teneo Studio Desktop
- Teneo Studio Web
When clicking the Gen AI Manager, the Gen AI Overview opens. The overview helps the developer to visualize the use of Personalities, Handlers, Goals, and Tasks in the solution. It is also possible to see which Flows has Gen AI Tasks.

In the example above, the Personality Serious is used with the handler GPT Input Prompt to perform the Goal Complaint Handling which uses an annotator Sentiment Analysis to annotate user input. This annotator is used by a Gen AI Match in the flows Complaint - Friendly and Complaint - Angry.
When selecting a Task, the user can also see the final prompt that is to be sent to the Gen AI system for that given Task.
The Gen AI Overview tile provides a brief summary of all Gen AI components in a solution. When clicking it, the Gen AI Overview opens. The overview helps the developer to visualize the use of Gen AI within the solution, which is particularly beneficial for understanding the impact of any modifications to the elements.

In the example above, the Personality Serious is used with the handler GPT Input Prompt to perform the Goal Complaint Handling which uses an annotator Sentiment Analysis to annotate user input. This annotator is used by a Gen AI Match in the flows Complaint - Friendly and Complaint - Angry.
When selecting a Task, the user can also see the final prompt that is to be sent to the Gen AI system for that given Task.
Personalities tab
- Teneo Studio Desktop
- Teneo Studio Web
When clicking the Gen AI tab, the Personalities section opens:

| Section | Description |
|---|---|
| System | Teneo's out-of-the-box System Personality. |
| Edit options | Save or Cancel when editing, or Edit and Delete when viewing. You can also view the History and Set Stable, Include/Exclude from branching. |
| Name | Add a Name that helps to identify the Personality. |
| Language | The language used for an agent is the solution language. |
| Outline | Give an Outline which defines a role, background and/or core traits for the agent. You can use the default Outline as a starting point or provide your own e.g. You are a helpful AI assistant designed to provide accurate responses to user queries. |
| Instructions | Provide any instructions that should be followed when interacting with the end users. You can use the pre-defined instructions, adapt them or create your own instructions. |
| Verbosity | Controls how wordy or concise your agent should reply. |
| Creativity | Controls the amount of freedom the agent has when crafting an answer. A higher value would make an answer more likely, whereas a lower value would make the answer more controlled. |
| Friendliness | Controls how polite or friendly your agent should act. |
| Formality | Controls how formal or informal your agent should act. |
| Security | Toggle security settings on or off. It is recommended to keep the security settings on. |
When clicking the Personalities section on the main page, the user finds an overview of the Personalities:

When adding a new Personality, the user will find the following options:

| Section | Description |
|---|---|
| Outline | Give an Outline which defines a role, background and/or core traits for the agent. You can use the default Outline as a starting point or provide your own e.g. You are a helpful AI assistant designed to provide accurate responses to user queries. |
| Instructions | Provide any instructions that should be followed when interacting with the end users. You can use the pre-defined instructions, adapt them or create your own instructions. |
| Language | The language used for an agent is the solution language. |
| Verbosity | Controls how wordy or concise your agent should reply. |
| Creativity | Controls the amount of freedom the agent has when crafting an answer. A higher value would make an answer more likely, whereas a lower value would make the answer more controlled. |
| Friendliness | Controls how polite or friendly your agent should act. |
| Formality | Controls how formal or informal your agent should act. |
| Security | Toggle security settings on or off. It is recommended to keep the security settings on. |
Goals tab
- Teneo Studio Desktop
- Teneo Studio Web
When selecting Goals, the user finds the following view:

| Section | Description |
|---|---|
| Edit options | Save or Cancel when editing, or Edit and Delete when viewing. You can also view the History and Set Stable, Include/Exclude from branching. |
| Name | Give a Name to the Goal for easy identification. |
| Personality | Select the associated Personality. The system is selected by default unless the solution contains at least one Personality. In that case, the first Personality in the list is selected by default. |
| Outline | Outline what the overall purpose and knowledge/scope for the Goal is by stating what the Gen AI model should achieve, e.g. Your goal is to answer questions about incidents. or You have knowledge about returns and complains or You are an entity extractor |
| Handler | Select the associated Handler. |
| Format | Describe in what format the results from the Gen AI model should be given. You can use the default format or provide your own, e.g. Max three short sentences or Give the output as a JSON. For better precision, you can also provide some examples of the desired format. |
By default, if the Solution has at least one Personality, the Goal will be associated with the first Personality of the list. If no Personalities are defined, the Goal will be associated to the System by default.
When clicking the Goals section on the main page, the user finds an overview of the Goals:

When adding a new Goal, the user will find the following options:

| Section | Description |
|---|---|
| Personality | Select the associated Personality. The system is selected by default unless the solution contains at least one Personality. In that case, the first Personality in the list is selected by default. |
| Outline | Outline what the overall purpose and knowledge/scope for the Goal is by stating what the Gen AI model should achieve, e.g. Your goal is to answer questions about incidents. or You have knowledge about returns and complains or You are an entity extractor |
| Handler | Select the associated Handler. |
| Format | Describe in what format the results from the Gen AI model should be given. You can use the default format or provide your own, e.g. Max three short sentences or Give the output as a JSON. For better precision, you can also provide some examples of the desired format. |
By default, if the Solution has at least one Personality, the Goal will be associated with the first Personality of the list. If no Personalities are defined, the Goal will be associated to the System by default.
Annotators tab
- Teneo Studio Desktop
- Teneo Studio Web
When selecting Annotators, the user finds the following view:

| Section | Description |
|---|---|
| Edit options | Save or Cancel when editing, or Edit and Delete when viewing. You can also view the History and Set Stable. |
| Name | Give the Annotator a meaningful name for easy identification. |
| Description | The description is an internal text field that can be used for comments among solution developers, for example, for describing the purpose of the Annotator. |
| Goal | Select the associated Goal. |
| Annotation name | When saved, the annotation name is generated automatically by Teneo, based on the name of the Annotator document. The Annotation carries the suffix .GEN.AI for easy identification. |
| Prompt | The exact instruction or question to get a specific result from a Gen AI Model. This field supports string interpolation (with the syntax ${variable}), making it possible to embed any Groovy such as Global and Flow Variables or engine access methods to create a dynamic prompt. |
When clicking the Annotators section on the main page, the user finds an overview of the Annotators:

When adding a new Annotator, the user will find the following options:

| Section | Description |
|---|---|
| Goal | Select the associated Goal. |
| Annotation | When saved, the annotation name is generated automatically by Teneo, based on the name of the Annotator document. The Annotation carries the suffix .GEN.AI for easy identification. |
| Prompt | The exact instruction or question to get a specific result from a Gen AI Model. This field supports string interpolation (with the syntax ${variable}), making it possible to embed any Groovy such as Global and Flow Variables or engine access methods to create a dynamic prompt. |
Handlers tab
- Teneo Studio Desktop
- Teneo Studio Web
When selecting Handlers, the user finds the following view:

| Section | Comment |
|---|---|
| Edit options | Save or Cancel when editing, or Edit and Delete when viewing. You can also view the History and Set Stable, Include/Exclude from branching. |
| Name | Give a name that helps the user to identify the Gen AI Handler and its use within the Solution. |
| Description | The description is an internal text field that can be used for comments among solution developers, for example, for describing the purpose of the Handler. |
| Script | A Groovy script which is able to make the required API calls and convert the response into the appropriate format for Teneo to understand. When creating a new Handler, a template script is provided, which the developer can use as a starting point. See Configure the Handler and Gen AI Handler script for more information. |
When clicking the Handlers section on the main page, the user finds an overview of the Handlers:

When adding a new Handler, the user will find the following options:

| Section | Comment |
|---|---|
| Name | Give a name that helps the user to identify the Gen AI Handler and its use within the Solution. |
| Description | The description is an internal text field that can be used for comments among solution developers, for example, for describing the purpose of the Handler. |
| Script | A Groovy script which is able to make the required API calls and convert the response into the appropriate format for Teneo to understand. When creating a new Handler, a template script is provided, which the developer can use as a starting point. See Configure the Handler and Gen AI Handler script for more information. |
Gen AI Flow nodes
- Teneo Studio Desktop
- Teneo Studio Web
Gen AI Action and Output Nodes can be added to the Flow in the ribbon bar.

Gen AI Action and Output Nodes can be added using the Plus icon in a Flow:

Practical Examples
Rephrasing Output
For this example, we will be defining a custom Personality for a fictional restaurant named TableTop Bistro. Our use case is to let a Gen AI rephrase our Flow's answer texts, making it more personal by taking into account relevant information from the user input.
Setup
First, let's set up and configure the documents needed.
The example assumes that you already have configured a Handler.
We need to add a new Personality:
- Give it a name such as
TableTop Bistro. - Replace the default Outline with the following:
You are a virtual assistant working for "TableTop Bistro", a cozy neighborhood restaurant that offers a chatbot to help customers with menu inquiries and reservation support.
-
You can use the default instructions and perhaps expand them with:
- Provide clear and concise information about the menu and services. -
Optionally, use the sliders to adjust the tone of voice of your agent.
Next, let's add the Goal:
-
Add a new Goal and name it
Rephrase response. -
Assign the Personality you created above.
-
Paste in the following outline:
Your goal is to rephrase the default response of a chatbot given information in a user input.
The rephrased answer should contain the same information of the default response, but be rephrased according to the user’s personal information.
Where relevant, information about the user included in their input should be incorporated into the rephrased answer, e.g.:
- by using their name
- by referencing their location -
Assign it your Handler of choice.
-
For this goal, it makes sense to keep the default format
Always give the answers as plain text.
Create your Flow
Let's create a Flow where we want to customize the bot's answer.
- Create a new Flow.
- Add a Match to trigger on relevant inputs. In our example, we will be using this Flow to respond to requests about vegetarian food options at the restaurant, so for this simple example let's add a Language Object Match with the value
VEGETARIAN.ADJ.LEX. - Next, replace the default Output node with a Gen AI Output node.
- Assign to it the Goal you just created, and add the following prompt:
Rephrase the output "Yes, we offer several vegetarian dishes on our menu." given the user input ${_.userInputText}.
Now, head over to Tryout and test an input that will trigger the Flow, for example: Hi, I'm Sarah from Austin. Do you guys have vegetarian options?. The output given should be rephrased by the Gen AI system based on the input given.
Intent Classification
For this example, we will use Gen AI for classifying the users intents into one of several predefined categories relevant to a simple banking use case.
Setup
First, let's set up and configure the documents needed.
The example assumes that you already have configured a Handler.
Intent classification is an internal task, and for this, we will use the System agent, but we will need to define a generic intent classification Goal:
- Add a new Goal and name it
Intent Classificationand assign it the System Personality. - As an Outline, add something like:
Classify an input from a user into predefined categories. - Assign it your Handler of choice.
- For the matching process, we need the Gen AI system to respond only with the name of the detected intent and to achie this, we replace the default format with something like
A string consisting of the relevant intent name in CAPITAL letters.
Next, we will need to add an Annotator, where we tell the Gen AI system our possible intent that we want the user input classified as:
-
Add a new Annotator named
Banking intent classificationand assign it the previously created Goal. -
Paste in the following prompt:
You only have one job. Based on the following intents and their descriptions, Please classify this text: ${_.userInputText} as one of them. Answer only with the intent name.
Intent name: TRANSFER_MONEY
Description: The user wants to send or transfer money to friends or family.
Intent name: CANCEL_CREDITCARD
Description: The user needs to cancel their credit card because it is lost or stolen.
Intent name: OPEN_ACCOUNT
Description: The user wants to open a new bank account such as a savings account or checking account.
Intent name: ONLINE_BANKING
Description: The user has questions or issues related to online banking.
If the input doesn't correspond to any of the Intent, just answer UNKNOWN.
Create your Flows
To test our simple intent classification, we need to add some flows that trigger when a given intent is detected. Lets start with the flow that should trigger when the user intent is to transfer money.
- Create a new Flow and add to its trigger a Gen AI Match.
- Select the Annotator
Banking intent classificationand type as the match valueTRANSFER_MONEY. - Write an answer text that should be returned when the user intent is to transfer money.
- Test your flow in tryout and ensure it triggers on inputs such as "I want to transfer 50€ to Anna"
- Carry on and create flows following this same approach for all of your intents.
Dialogue Summarization
In this example, we will use Gen AI to get a summary of a dialogue between a bot and a user. This could be be very useful for example when handing over a conversation to a live agent, giving the agent a brief overview of what the bot and the end user has discussed so far.
Setup
First, let's set up and configure the documents needed.
The example assumes that you already have configured a Handler.
Summarizing a dialog is an internal task and we will use the System agent.
Next, we will need to define a Goal:
- Add a new Goal called
Dialogue Summaryand assign it the System Personality. - Add as the Outline something like:
Your task is to summarize dialogues. Please give a summary of the available conversation. - Assign it your Handler of choice.
- We are interested in a brief summary, so we can replace the default format with the text:
Stick to max 120 characters maximum and focus on the user's inputs in this summary.
Create your Flow
- To test the summary Action, create a new Flow and add a match, for example a Language object match with the value
SUMMARIZE.VB.LEX - Add a flow variable
summaryto the flow - Insert a Gen AI Action node directly after the Raise node, but before the Output node.
- Assign your previously created Goal to the Action and make sure the result from the Gen AI is saved to the flow variable.
- Add the following text to the prompt:
Please give a summary of this available conversation:
${ _.dialogHistory.collectMany {
["user: ${it.userInputText\}", "bot: ${it.answerText\}"]
\}.join(System.lineSeparator())
}
In a real scenario, we could for example pass on the content of the variable summary in an integration that hands over the conversation to a live agent, but in our case, we just print it to ensure our Action did its job. To do this, we add a new output node direct after the Gen AI Action node in the flow, with the answer text:
This is the result of the Gen AI prompt: ${summary}
Now, head over to Tryout and carry out a simple conversation with your bot. To get the summary, input something like: Can you please summarize the dialog? The answer given should provide the summary.
Tips and Tricks
Best practices
Below are some best practices that apply for creating the most optimal outlines, instructions, and prompts in your Gen AI systems.
1. Be Clear and Specific
Avoid ambiguity. The more precise your prompt, the better the results.
- Instead of:
Generate a short text. - Try:
Generate an output that has max 120 characters.
2. Give Examples
Giving examples of the result you expect helps to guide the model’s logic. You may want to do this when performing intent classification, sentiment analysis, or any other task where the user input should be analyzed and classified.
- Example:
Goal: Intent Classification
Task: Classify user input into one of the following intents:
BookFlight
CheckWeather
PlayMusic
Example responses:
Input: "I want to fly to Paris next week."
Your response: BookFlight
Input: "Is it going to rain in Barcelona tomorrow?"
Your response: CheckWeather
Input: "Play some jazz music."
Your response: PlayMusic
3. Say What to Avoid
Including instructions on what kind of information or language to avoid helps keep the response aligned with your intent.
- Example:
Help customers with requests related to insurances. Avoid technical jargon.
4. Avoid Contradicting Information
Keep in mind that the final prompt consists of reusable blocks defined in the Personality, Goal, and Flow node, as well as the tone-of-voice settings. Please make sure that all elements align in order to get the desired results.
- Instead of: Selecting an informal personality in the tone-of-voice settings and defining a formal tone in the outline.
- Try: Selecting an informal personality in the tone-of-voice settings and omitting any references to tone in the outline.
Hybrid implementation
Creating Gen AI agents that perform Tasks in Teneo is easy and straight forward and all Tasks can seamlessly co-exist in conjunction with other Teneo features and functionalities, allowing you to create robust and reliable implementations:
- In Teneo, you can combine any type of Match to create Hybrid Matching. For example, combining a Gen AI Match with a TLML Syntax Match brings together the fluency and expressiveness of Gen AI with the precision and control of TLML—allowing you to carefully define and monitor the scenarios in which Gen AI should be called.
- For cases when the outcome generated by the Gen AI is not as desired, it is always possible to resort to a static Output and Gen AI Outputs and static Outputs can co-exist side by side in any Flow.
- Gen AI Outputs and static Outputs can also be combined into one response, allowing only part of the response to be generated, to give a more controlled, hybrid response to the end user.
- By letting the Gen AI act "behind the scenes" with Gen AI Actions that provides logic to the dialog, the responses given to the end users can still be fully controlled, static responses.
- It is possible to call the Gen AI System only under a certain condition, for example, to retrieve entities from the user input only if they have not already been found in the conversation.
Download
Download all template scripts for configuring the Handler here:
Download ZIP