# AI Models

{% embed url="<https://www.youtube.com/watch?v=J7TKL4maKbI>" %}

### **Configuring PowerPilot (AI) in Power Embedded**

To have an assistant in the portal, you need to configure the following steps:

1. Validate the [prerequisites ](https://docs.powerembedded.com.br/en/portal-de-administracao/power-pilot-ia/pre-requisitos)in the Power BI Admin Portal (you are here).
2. Contract the model on  [Azure OpenAI](https://docs.powerembedded.com.br/en/portal-de-administracao/power-pilot-ia/contratacao-de-uma-ia/azure-openai) or [OpenAI (ChatGPT)](https://docs.powerembedded.com.br/en/portal-de-administracao/power-pilot-ia/contratacao-de-uma-ia/openai)
3. [Create a model ](https://docs.powerembedded.com.br/en/portal-de-administracao/power-pilot-ia/assistentes-de-ia)on Power Embedded
4. [Create an assistant](https://docs.powerembedded.com.br/en/portal-de-administracao/power-pilot-ia/assistentes-de-ia) on Power Embedded

### **How to Create an AI Model in Power Embedded**

Access the Power Pilot IA > Models page or [click here](https://admin.powerembedded.com.br/AiModels/Create).

Click on the **Create AI Model** button.

<div><figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-ef75a87cfc45b5aabdde0823cd7597bd918a7fa6%2Fimage%20(63).png?alt=media" alt=""><figcaption><p>Azure OpenAI</p></figcaption></figure> <figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-8bef482b1e2717579e3313315d10bfa88b7fa76d%2Fimage%20(64).png?alt=media" alt=""><figcaption><p>OpenAI</p></figcaption></figure></div>

On this screen, you will be able to configure the following settings according to the AI API provider you will use:

* **Name**: This is the name your model will have (you can choose any name you prefer).

<details>

<summary>Azure OpenAI</summary>

**Model:** In this field, you must enter the name of the contracted model (for example: GPT-4o-mini, GPT-4, etc.). To make it easier to find the model name. [**click on this link**](https://oai.azure.com/portal/0ce7f057e4df4ba9bbc98993a2088133/deployment?tenantid=eaa0c55d-e848-4192-ad75-91deaadc01f4)**.**

<img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-09660614ede45c463e67ab9b459e1a5931562142%2Fimage%20(65).png?alt=media" alt="" data-size="original">

**Endpoint:** This field is filled in with the Endpoint value.

<img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-d351a1ad32d01ff92ae332a5cf0f8431ecbb583b%2Fimage%20(58).png?alt=media" alt="" data-size="original">

**Key:** Fill in this field with the value of the created key. Below, the path is indicated depending on where the assistant was created.

<img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-1460dd990b627bef9e4f03da7f02570e30c1888a%2Fimage%20(59).png?alt=media" alt="" data-size="original">

**Cost in USD per 1 million input tokens:** Fill in this field with the cost of tokens per question interaction, which varies according to the contracted model. Avoid using random values, as this may affect the Power Pilot audit. Check the pricing section in to find the exact value.

**Cost in USD per 1 million output tokens:** Fill in this field with the cost of tokens per response interaction, which varies according to the contracted model. Avoid using random values, as this may affect the Power Pilot audit. Check the pricing section in [Azure](https://azure.microsoft.com/pt-br/pricing/details/cognitive-services/openai-service/) to obtain the exact value

</details>

<details>

<summary>OpenAI</summary>

**Model:** Select the model you want to use from the drop-down menu.

**Key:** Fill in this field with the value of the created key.

<img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-a563bb4b44af53bc549c010e86df38424047739b%2Fimage%20(66).png?alt=media" alt="" data-size="original">

**Prompt tokens:** Fill in this field with the cost of tokens per question interaction, which varies according to the contracted model. Avoid using random values, as this may affect the Power Pilot audit. Check the pricing section on the a [OpenAI](https://openai.com/api/pricing/) website to find the exact value.

**Completion tokens:** Fill in this field with the cost of tokens per response interaction, which varies according to the contracted model. Avoid using random values, as this may affect the Power Pilot audit. Check the pricing section on the [OpenAI](https://openai.com/api/pricing/) website to obtain the exact value..

</details>

The model has been created. Now we need to create an assistant.
