> For the complete documentation index, see [llms.txt](https://docs.altu.d1.cx/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.altu.d1.cx/build/assistentes/builder/componentes/input/autocomplete.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.altu.d1.cx/build/assistentes/builder/componentes/input/autocomplete.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
