# Mensagem Generativa Efêmera

### \[POST] Criar

Gerencia uma resposta passando o contexto.

### Requisição

```bash
curl --location 'https://api.zaia.app/v1.1/api/ephemeral-generative-message/create' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <sua chave de api aqui>' \
--data '{
  "agentId": 123,
  "context": [
    {
      "origin": "user",
      "text": "Olá"
    },
    {
      "origin": "assistant",
      "text": "Ei, sou a Bianca da Zaia, como posso ajudá-lo hoje?"
    }
  ],
  "prompt": "Explique mais sobre você...",
  "streaming": false
}'
```

### Headers (Cabeçalhos)

<table><thead><tr><th width="167.765625">Chave</th><th width="158.15625">Tipo</th><th width="216.09765625">Exemplo</th><th width="125.3359375">Obrigatório</th></tr></thead><tbody><tr><td><mark style="color:red;">Authorization</mark></td><td>String</td><td>Bearer &#x3C;sua chave aqui></td><td><mark style="color:red;"><strong>✓</strong></mark></td></tr></tbody></table>

### Body (Corpo)

<table><thead><tr><th width="169.03125">Chave</th><th width="156.30859375">Tipo</th><th width="222.6484375">Exemplo</th><th width="120.6328125">Obrigatório</th></tr></thead><tbody><tr><td><mark style="color:red;">agentId</mark></td><td>Number</td><td>123</td><td><mark style="color:red;"><strong>✓</strong></mark></td></tr><tr><td><mark style="color:red;">context</mark></td><td>Array&#x3C; Context ></td><td>[Clique aqui]</td><td><mark style="color:red;"><strong>✓</strong></mark></td></tr><tr><td><mark style="color:red;">prompt</mark></td><td>String</td><td>Explique mais sobre você...</td><td><mark style="color:red;"><strong>✓</strong></mark></td></tr><tr><td>streaming</td><td>Boolean</td><td>false</td><td></td></tr></tbody></table>

### **Context**

<table><thead><tr><th width="167.328125">Chave</th><th width="160.25390625">Tipo</th><th width="339.15234375">Exemplo</th></tr></thead><tbody><tr><td>origin</td><td>String</td><td>assistant | user</td></tr><tr><td>text</td><td>String</td><td>Ei, sou a Bianca da Zaia, como posso ajudá-lo hoje?</td></tr></tbody></table>

### Exemplo de contexto:

```json
"context": [
  {
    "origin": "user",
    "text": "Olá"
  },
  {
    "origin": "assistant",
    "text": "Ei, sou a Bianca da Zaia, como posso ajudá-lo hoje?"
  }
]
```

### Respostas

{% tabs %}
{% tab title="🟢 200 → OK" %}

<table><thead><tr><th width="149.7890625">Chave</th><th width="160.30078125">Tipo</th><th width="354.31640625">Exemplo</th></tr></thead><tbody><tr><td>createdAt</td><td>Date</td><td>2024-06-17T16:29:11.338Z</td></tr><tr><td>id</td><td>Number</td><td>3</td></tr><tr><td>model</td><td>String</td><td>gpt-4</td></tr><tr><td>text</td><td>String</td><td>Eu sou Bianca, sua assistente virtual aqui para ajudar com suas perguntas e solicitações.</td></tr><tr><td>chatStage</td><td>Object</td><td>[Clique aqui]</td></tr><tr><td>Files</td><td>Array&#x3C;File></td><td>[Clique aqui]</td></tr></tbody></table>

**ChatStage**

<table><thead><tr><th width="150.4296875">Chave</th><th width="159.3671875">Tipo</th><th width="352.9375">Exemplo</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>94f7efc5b8de42ff85ad53eb8414c46d</td></tr><tr><td>condition</td><td>String</td><td>When user...</td></tr><tr><td>name</td><td>String</td><td>stage name</td></tr><tr><td>objective</td><td>String</td><td>stage objective</td></tr></tbody></table>

**File**

<table><thead><tr><th width="152.1640625">Chave</th><th width="157.71484375">Tipo</th><th width="355.48046875">Exemplo</th></tr></thead><tbody><tr><td>data</td><td>String</td><td>base64 string</td></tr><tr><td>type</td><td>String</td><td>image/png ou image/jpeg ou application/pdf</td></tr><tr><td>name</td><td>String</td><td>Nome do arquivo</td></tr></tbody></table>

Exemplo de resposta:

```json
{
  "createdAt": "2024-06-17T16:29:11.338Z",
  "id": 3,
  "model": "gpt-4",
  "text": "Eu sou Bianca, sua assistente virtual aqui para ajudar com suas perguntas e solicitações.",
  "chatStage": {
    "condition": "user expresses interest in learning about artificial intelligence",
    "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "name": "AI Introduction",
    "objective": "provide a brief overview of artificial intelligence and its applications"
  },
  "files": [{
    "data": "base64 here!",
    "name": "file name",
    "type": "Examples: image
```

{% endtab %}

{% tab title="🔴 403 → Unauthorized" %}

```json
"Forbidden."
```

{% endtab %}

{% tab title="🔴 404 → Not Found" %}

```json
"Agent not found."
```

{% endtab %}
{% endtabs %}
