# Autocomplete

Para os casos em que é preciso realizar uma busca mas você ainda não tem um cognitivo, utilize o autocomplete. Ele irá apresentar uma lista de opções aproximada à pesquisa realizada.

Caso deseje configurar, acesse a aba input e em seguida selecione a opção autocomplete no ícone `?`.

![](/files/lwyeNEI0myc38DnSSHlb)

{% hint style="info" %}
Recurso disponível apenas no canal Widget
{% endhint %}

### Estrutura

```json
{
    "default": {
        "type": "autocomplete",
        "payload": {
            "delay": 4000
            "options": [
                {
                    "title": "<opção 1>",
                    "value": "<valor da opção 1>"
                },
                {
                    "title": "<opção 2>",
                    "value": "<valor da opção 2>"
                },
                {
                    "title": "<opção 3>",
                    "value": "<valor da opção 3>"
                }
            ],
            "cognitive": "true|false"
        }
    }
}
```

#### Atributos

* **type:** autocomplete
* **payload:**
  * **cognitive (default: true):** determina se a mensagem será enviada para curadoria ou não
  * **delay (opcional):** tempo (milissegundos) de atraso antes da próxima opção aparecer.
  * **options:** opções que serão exibidas ao usuário a medida que ele digita
    * **title:** título (label) da opção que estará visível ao usuário
    * **value (opcional):** valor que será enviado ao Altu ao escolher a opção. Se não for definido, será passado o próprio `title`

### Exemplo

{% tabs %}
{% tab title="Configuração" %}

```javascript
{
    "default": {
        "type": "autocomplete",
        "payload": {
            "options": [
                {
                    "title": "Como consulto minha conta de energia?",
                    "value": "conta"
                },
                {
                    "title": "Como consulto minha fatura de energia?",
                    "value": "fatura"
                },
                {
                    "title": "Estou sem luz, o que eu faço?",
                    "value": "queda"
                },
                {
                    "title": "Como consulto minha fatura de luz?",
                    "value": "fatura"
                }
            ]
        }
    }
}
```

{% endtab %}

{% tab title="Widget" %}
![](/files/-MDWOSIak5VpMEVoHq0M)
{% endtab %}
{% endtabs %}


---

# 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.altu.d1.cx/build/assistentes/builder/componentes/input/autocomplete.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.
