> For the complete documentation index, see [llms.txt](https://docs.xenioo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xenioo.com/actions-and-operations/ai/call-ai.md).

# Call AI

This action will send a prompt directly to the configured LLM, without waiting for any user input. It works like invoking an agent: the bot asks, the AI answers, and the conversation moves on as soon as the reply is available.

<figure><img src="https://2532694803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvGYwUmVjfELEiJzfmWLC%2Fuploads%2FlgZUgB3HVef3GW8v7Cjv%2Fimage.png?alt=media&amp;token=818af7f1-b659-445d-ab29-c8e72ce9eede" alt=""><figcaption></figcaption></figure>

#### Settings

The action uses the following settings:

| Setting                | Description                                                                                                       | Parsed               |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------- | -------------------- |
| Prompt                 | The prompt forwarded to the AI provider                                                                           | :white\_check\_mark: |
| Use AI module settings | If enabled, the request uses the provider, model and API key configured in the AI module settings                 | :no\_entry:          |
| AI Provider            | The AI provider to use for this request. Only visible when Use AI module settings is disabled                     | :no\_entry:          |
| Model Version          | The model of the selected provider to use for this request. Only visible when Use AI module settings is disabled  | :no\_entry:          |
| API Key                | The API key used to authenticate with the selected provider. Only visible when Use AI module settings is disabled | :no\_entry:          |

#### Remarks

Unlike AI Input, this action is *not halting the conversation*. The prompt is sent as soon as the action is executed and the flow continues once the AI has replied.

The prompt is sent together with the Guidelines of your bot and shares the same thread used by AI Input: the AI will remember what was asked through Call AI when the user asks follow up questions, and vice versa. Clear the **ai\_conversation\_thread** content to reset the current thread information and start a new thread.

This action does not display anything to the user. Use the **ai\_reply\_content** variable in any content action, such as a Text Action, to show the reply in the chat.

Typical uses of Call AI are:

* Summarizing a conversation before handing it over to an operator
* Classifying or extracting information from variables collected earlier in the flow
* Generating a personalized welcome message when a conversation starts

When Use AI module settings is disabled, you can pick any provider and model available to your account, regardless of the one configured for the bot. This allows, for example, to use a faster and cheaper model for simple tasks.

{% hint style="info" %}
Depending on the type of model and the specific AI provider selected it might take several seconds for the service to produce a complete answer.
{% endhint %}

{% hint style="warning" %}
If the AI request fails, the trigger is still executed and the failure is reported in the conversation flow log. Check the contents of **ai\_reply\_content** if you need to verify that a reply was produced.
{% endhint %}

#### Trigger

On Reply Received. This action will trigger any child operation as soon as the AI reply is available.

#### Variables

This action produces the following variables after being triggered:

| Variable                          | Description                                                               |
| --------------------------------- | ------------------------------------------------------------------------- |
| ai\_conversation\_thread          | The thread id of the current conversation                                 |
| ai\_reply\_content                | The text of the AI reply                                                  |
| ai\_reply\_sources                | The URLs of the sources used by the AI to build the reply, one per line   |
| ai\_reply\_sources\_title         | The titles of the sources used by the AI to build the reply, one per line |
| ai\_assistant\_prompt\_tokens     | The number of tokens consumed by the prompt                               |
| ai\_assistant\_completion\_tokens | The number of tokens consumed by the reply                                |

#### Availability

Channel specific availability follows the table below:

| Channel          | Availability     |
| ---------------- | ---------------- |
| Facebook         | Fully Available. |
| WhatsApp         | Fully Available. |
| Telegram         | Fully Available. |
| Web              | Fully Available. |
| Alexa            | Fully Available. |
| Google Assistant | Fully Available. |
| Slack            | Fully Available. |
| API              | Fully Available. |

This action can be used inside interactions and as an operation of other actions.
