# Chatbot - Using the Copilot Token

{% hint style="info" %}
To use this feature, you must have a configured key and a selected model in "*System Settings*" > "*Artificial Intelligence APIs*" > "*Assistant Model*".
{% endhint %}

## Saving the lead's response

In this example, I created a scenario in which, when the lead informs the number of days they intend to rent a car, they will receive the total rental cost.

For this, you can start by asking the lead how many days they want to rent the vehicle. In the question block, configure it to save the answer in the variable `numero_dias`.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FrFy9lBxZ5ZLa8flwkZKw%2F1.png?alt=media&#x26;token=d8f9495d-c0b6-4bb6-b8a6-513fdb3663ac" alt=""><figcaption><p><em>Send Question Block.</em></p></figcaption></figure>

## Configuring response message

When we use the token `{copilot=...}`, we can insert line breaks within the content to make the prompt more organized and readable. It is worth noting that the token can be used in any part of the "Send Message" block, according to your preference.

In addition, it is possible to define the **level of creativity of the AI response** directly in the token, using the prefixes:

* `temp__creative` – for more creative responses with greater variation (more "random").
* `temp__deterministic` – for more direct and predictable responses (more "objective").

Token used in the message:

```
{copilot=temp__creative
The client stated that they want to rent the car for {var=numero_dias} days. Consider the following pricing rule:

Up to 3 days: R$ 100 per day.
From 4 to 7 days: R$ 90 per day.
More than 7 days: R$ 80 per day.

Return the total rental price based on the number of days, explaining the reason for the applied rate.
}
```

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FojBdBsBP0qrdeQnT2d95%2F2.png?alt=media&#x26;token=19493906-b536-46a2-af76-30c8d9d363ae" alt=""><figcaption><p><em>Send Message Block.</em></p></figcaption></figure>

## Testing the A.I. behavior.

As shown in the image below, the token was correctly interpreted and calculated the total rental price based on the defined rates.

In addition, it is possible to include other tokens inside the `{copilot=...}`, such as the lead's name (`{contactfield=firstname}`) or any other value, allowing the AI to have access to this information and further personalize the response.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FJLp9m1mG2JSXVfsGhwtq%2Fimage.png?alt=media&#x26;token=54b4ddd8-3b8f-45f1-999d-094414cf528a" alt=""><figcaption><p><em>Support with the Chatbot.</em></p></figcaption></figure>

{% hint style="info" %}
If you want to add a fallback to identify possible errors when using the `copilot`, just insert a `|` before closing the braces and then add an error message. For example: `{copilot=Your prompt here|Error identified, AI configuration problem.}`
{% endhint %}
