# AI node

In this chapter, we are going to introduce you the updated user interface for ['Generative AI' node](https://docs.borndigital.ai/digital-agent/conversation-flow/nodes-explained/ai-node).

We've decided to create an infinite loop chatbot virtual assistant based on a simple prompt - system message. This is crucial for implementing the **Generative AI** within the Conversation Flow. We're excited to enhance its capabilities and explore various scenarios. To explain this, we've created a simple project. Watch the video below for a clear demonstration.

{% hint style="info" %}
To understand and showcase the 'Generative AI' node effectively, we recommend visiting the ['Message' node](https://docs.borndigital.ai/digital-agent/conversation-flow/nodes-explained/message-node),[ 'Answer' node](https://docs.borndigital.ai/digital-agent/conversation-flow/nodes-explained/answer-node), ['Training Project'](https://docs.borndigital.ai/digital-agent/conversation-flow/launching-project) ,  and ['Create Project' ](https://docs.borndigital.ai/digital-agent/workspace/list-of-projects)pages for detailed insights.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/6iQTvxgRZRwPS1NgIGEb/blobs/KpWJEJpUaNJl5XiwO7fa/BD_Gen_AI_node_v3.gif" alt=""><figcaption><p>New Generative AI node is here!</p></figcaption></figure>

<details>

<summary><strong>Step-by-Step Guide to Test It Out!</strong></summary>

1. Create a simple 'Message' node as an example.
2. Develop a basic 'Answer' node with an intent to exit the conversation if the customer chooses to.
3. Create a new 'Generative AI' node and configure it to create a persona named Mr. Chatty:
   * Enter a recognizable name for the node.
   * Define a specific role for the system message.
   * Add new input fields for assistant content.
   * Keep {current\_utterance} as the user's input in the third person.
   * Determine the usage of functions.
   * Configure the setup.
4. Connect the 'Generative AI' node to the 'Answer' node.
5. Train the model and conduct tests.

</details>

***

### Understanding the AI Instructions

Clear and well-written instructions are essential for a delightful Generative AI experience by guiding the manual. In a specific scenario, we created a simple ['Answer' node](https://docs.borndigital.ai/digital-agent/conversation-flow/nodes-explained/answer-node) to understand the conversation language, which can be incorporated into the system message prompt for the ['Generative AI' node](https://docs.borndigital.ai/digital-agent/conversation-flow/nodes-explained/ai-node).

{% hint style="warning" %}
Ensure the {current\_utterance} variable is in the user input type for each iteration. The assistant further explains past actions before the user inputs.
{% endhint %}

{% tabs %}
{% tab title="System message" %}

### Summary:&#x20;

This is the initial text or prompt provided to the AI model, setting the context or guidelines for generating responses.

### Description

The system message acts as the contextual cue for the AI model. It provides information about the topic, defines the assistant’s persona, outlines the response format, and instructs the AI on what to focus on or avoid in its generated responses. It primes the model with relevant information before generating the conversation.

### Example

Perform as Company´s chatbot, you role is to respond to questions. Answer my questions only using information you receive as text snippets from Knowledge base.
{% endtab %}

{% tab title="Asistant (optional)" %}

### Summary:&#x20;

Varies based on the context and the system message input. **Optional field**

### Description

The assistant's role is to generate responses based on the instructions provided in the system message. It uses the context, guidelines, and previous interactions to create suitable and contextually relevant responses for the user's queries or inputs.

### Example

Please take a moment to familiarize yourself with the guidelines for our conversation:&#x20;

* These snippets may be unrelated.&#x20;
* Do not sumarise all of the facts received, use the most relevant part only&#x20;
* Always answer only in {language} language.&#x20;
* If needed, translate your response to {language}.&#x20;
* Current date is {date\_now}

Please review the information available and be ready to assist customers with accurate information
{% endtab %}

{% tab title="User input" %}

### Summary:&#x20;

It contains the user's query or input as variable named - **{current\_utterance}**

### Description

This input represents the user's side of the conversation. It includes the queries, questions, or statements provided by the user, triggering the assistant's responses generated based on the context set by the system message. The AI processes this input to create appropriate replies.

### Example

{current\_utterance}
{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Checkbox" Use in each iteraction" can help you add the infinite number of loops and improve the desired outcome. Recommending to turn on for user´s utterance for 99% scenarios.
{% endhint %}

<details>

<summary>Try customize the system message</summary>

Try extending the system message yourself. For example, "Be brief in your answer; create longer answers for open-ended questions" or "Use bullet points for your answer."

![](https://content.gitbook.com/content/6iQTvxgRZRwPS1NgIGEb/blobs/L9Ei497Y3u0i4h7YNo4v/image.png)

</details>

{% hint style="info" %}
Visit [prompting-cookbook](https://docs.borndigital.ai/for-advanced-users/prompting-cookbook "mention")in our Tips and tricks section to get more in-depth explanation of prompt types, prompting techniques and prompt examples. :sparkles:
{% endhint %}

***

### Knowledge base - functions

Apart from generating customer responses, Generative AI can utilize a Function from our [Knowledge Base](https://docs.borndigital.ai/digital-agent/advanced-functions/knowledge-base) to learn information. More details about the Knowledge Base will be provided soon after reworking this feature.

{% content-ref url="../../advanced-functions/knowledge-base" %}
[knowledge-base](https://docs.borndigital.ai/digital-agent/advanced-functions/knowledge-base)
{% endcontent-ref %}

This integration allows our internal knowledge base to complement the Neural Language Processor, delivering optimal answers, even from internal information.

***

### Configuration

Let´s explain the basic configuration

* **Use History:** Default 3 - Choose how many messages stay in the conversation memory, useful for creating continuity.
* **Language Models:** Default set to Standard, a cost-efficient general model. The advanced model, ChatGPT 4.0 Turbo, is significantly more expensive to use.
* **Advanced Settings:** Set model temperature from 0 to 1 (default 0.7) to adjust the creativity level.

{% hint style="warning" %}
Don't forget to set up the Target node.
{% endhint %}

***

### Try Importing the Project

For a step-by-step guide, visit the ['Import / Export' page](https://docs.borndigital.ai/digital-agent/conversation-flow/nodes-explained/broken-reference) to see the process.

{% file src="<https://content.gitbook.com/content/6iQTvxgRZRwPS1NgIGEb/blobs/k1e7sripd5kkjw6DuW29/'Generative%20AI'%20node%20showcase.zip>" %}
