# OpenAI Assistant Detection

This action will forward any user text to an existing OpenAI assistant. The conversation will not hold and will continue with all other actions.

<figure><img src="https://2532694803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvGYwUmVjfELEiJzfmWLC%2Fuploads%2FMhk6WVbEhd6lKKTw5vEX%2Fimage.png?alt=media&#x26;token=cbe7e187-89dd-44b7-a945-0b5fc4768951" alt=""><figcaption></figcaption></figure>

### Settings

The action uses the following settings:

| Setting                | Description                                                                                    | [Parsed](https://docs.xenioo.com/actions-and-operations/dynamic-parsing) |
| ---------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| OpenAI API Key         | The API Key that you can generate in your OpenAI account                                       | :white\_check\_mark:                                                     |
| Assistant Id           | The unique id of the trained assistant you wish to use                                         | :white\_check\_mark:                                                     |
| Auto-Generate Content  | If enabled, Xenioo will generate the bubble with the content of the assistant reply            | :no\_entry:                                                              |
| Split Paragraphs       | If enabled, Xenioo will follow your assistant line break to generate multiple bubbles          | :no\_entry:                                                              |
| React to Page Comments | If enabled, this action will be executed when a comment is added on the attached Facebook page | :no\_entry:                                                              |
| Post Id                | The uinque id of the post associated to the reaction flag                                      | :white\_check\_mark:                                                     |

### Remarks

The assistant reply is returned to the chat (or to a variable) directly without any intervention of Xenioo on the content.

Conversation with the assistant will stay in thread, based on the openai\_assistant\_thread variale. If you wish to start a new thread just empty the variable before making a new request.

{% hint style="info" %}
Depending on the OpenAI model, request complexity and OpenAI account level, replies might take more than 20 seconds to be generated.
{% endhint %}

### Trigger

On Reply Received. This action will trigger any child operation as soon as the result is available. This trigger will not be executed if the "Auto-Generate Content" flag is enabled.

### Variables

This action produces the following variables after being triggered:

| Variable                              | Description                                              |
| ------------------------------------- | -------------------------------------------------------- |
| openai\_assistant\_thread             | The thread id of the current conversation                |
| openai\_assistant\_model              | The LLM model used by the assitant                       |
| openai\_assistant\_raw\_reply         | The raw JSON reply of the last assistant request         |
| openai\_assistant\_prompt\_tokens     | The number of prompt tokens used by the last request     |
| openai\_assistant\_completion\_tokens | The number of completion tokens used by the last request |
|                                       |                                                          |

### Availability

Channel specific availability follows the table below:

| Channel          | Availability                                                           |
| ---------------- | ---------------------------------------------------------------------- |
| Facebook         | Fully Available.                                                       |
| WhatsApp         | Fully Available.                                                       |
| Telegram         | Fully Available.                                                       |
| Web              | Fully Available.                                                       |
| Alexa            | **Not Available. Out of AI Detection is not supported inside skills.** |
| Google Assistant | Fully Available.                                                       |
| Slack            | Fully Available.                                                       |
| API              | Fully Available.                                                       |

This action can be used only at [Bot Global level](https://docs.xenioo.com/execution#global-and-local-actions) or [Behavior level.](https://docs.xenioo.com/execution#global-and-local-actions)&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.xenioo.com/actions-and-operations/input/global-detection/openai-assistant-detection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
