> ## Documentation Index
> Fetch the complete documentation index at: https://www.algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate searchable prompt suggestions

> Generate searchable prompt suggestions for the Agent Studio search box, refresh them on a schedule, and split them by category.

Searchable prompt suggestions are AI-generated prompts that appear as users type in the search box.
When users select a suggestion, it starts a conversation with your Agent Studio agent.

Algolia generates the suggestions from your source index and its search analytics (such as top searches and top filters), using a provider and model you select.
Algolia saves them to a separate suggestions index.

These suggestions differ from [prompt configurations](https://www.algolia.com/doc/guides/algolia-ai/agent-studio/how-to/prompt-suggestions.md), which generate suggestions from the context of a page.

## Before you begin

* You need an Algolia app with [Agent Studio](https://www.algolia.com/doc/guides/algolia-ai/agent-studio) enabled.
* You need a connected [LLM provider](https://www.algolia.com/doc/guides/algolia-ai/agent-studio/how-to/llm-providers.md).
* [Publish your agent](https://www.algolia.com/doc/guides/algolia-ai/agent-studio/how-to/dashboard.md#publish-your-agent).

## Set up searchable prompt suggestions

**1. Go to the search box component**

In the [Agent Studio dashboard](https://dashboard.algolia.com/generativeAi/agent-studio/agents), open your agent, go to the **Components** section, and select **Search Box**.
In the **Searchable prompt suggestions** row, click **Set up**.

**2. Choose the source index, LLM provider, and model**

Fill in:

* **Source index**.
* **Provider**. The provider profile that generates the suggestions.
* **Model**.

The dashboard marks models that work well for prompt suggestions with **(recommended)**.
If you select another model, the dashboard shows a **Not recommended for prompt suggestions** warning.
Generation might fail or produce weaker suggestions with that model.

**3. Optional: choose how suggestions refresh**

To rebuild suggestions on a schedule, in **Refresh**, select **Daily**, **Weekly**, or **Monthly**.
For more information, see [Refresh suggestions on a schedule](#refresh-suggestions-on-a-schedule).

**4. Optional: split suggestions by category**

To generate a separate set of suggestions for each value of an attribute, in **Split by category**, select an attribute.
For more information, see [Split suggestions by category](#split-suggestions-by-category).

**5. Generate the suggestions**

Click **Generate suggestions**.
Generation can take a few minutes.
When it finishes, the dashboard shows a link to the suggestions index.

**6. Show the suggestions on your site**

Suggestions appear on your site only after you add the `showPromptSuggestions` option to your `autocomplete` widget.
The `searchBox` widget doesn't support this option, so if you use `searchBox`, switch to `autocomplete`.
Selecting a suggestion opens a conversation only if the same index also has a `chat` widget.
To copy the code, in the **Searchable prompt suggestions** row, click **View implementation code**.
For more information, see the [JavaScript](https://www.algolia.com/doc/api-reference/widgets/autocomplete/js.md#param-show-prompt-suggestions) and [React](https://www.algolia.com/doc/api-reference/widgets/autocomplete/react.md#param-show-prompt-suggestions) widget references.

## Refresh suggestions on a schedule

With **On demand**, suggestions don't refresh automatically.
To regenerate them, click **Edit**, then click **Run now**.

If you change a setting, click **Save and regenerate** instead.

With **Daily**, **Weekly**, or **Monthly**, Algolia regenerates suggestions on the selected schedule using your source index and its search analytics.
Scheduled runs use UTC, and the setup shows the next run time in UTC.
You can't choose the time of day.

To stop scheduled runs, click **Edit**, then click **Cancel schedule**.

If a run fails, the dashboard shows **Generation failed** with a **Retry** button.
A failed run doesn't replace your existing suggestions.

## Split suggestions by category

By default, Algolia generates suggestions for the whole index.
When you select an attribute in **Split by category**,
Algolia also generates suggestions for up to **Max values** of that attribute,
such as the most common brands.
The suggestions for the whole index remain available.

Keep these points in mind:

* The attribute must appear in [`attributesForFaceting`](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting).
* Attributes declared as `filterOnly` aren't available.
* **Max values** sets how many attribute values get their own suggestions. Algolia picks the values that appear in the most records. It defaults to 20 and accepts values from 1 to 50.
* More values mean longer runs and higher token use. The dashboard warns you when **Max values** is above 10.

## Check the token estimate

The setup shows an **Estimated cost** for each run.
The estimate is a range in tokens, not a price, and it includes the values from **Split by category**.
For daily and weekly schedules, it also shows the expected monthly total.

You can view the token estimate before publishing your agent.
To generate suggestions, publish the agent first.

## Add a schedule to an existing setup

If the **Searchable prompt suggestions** row shows **Add a schedule**, your setup doesn't include refresh and split options.
To add a schedule:

1. Click **Add a schedule**.
2. Select **Daily**, **Weekly**, or **Monthly**.
3. Click **Save and regenerate**.

Your existing suggestions remain available until the regenerated suggestions are ready.

After you add a schedule, Algolia uses your agent's provider and model to generate suggestions.
These might differ from those used in your original setup.

## Preview suggestions

To check the suggestions in the dashboard preview, in the **Searchable prompt suggestions** row, select **Show searchable prompt suggestions in preview**.
Then click the search box in the preview.

## Delete suggestions

To remove suggestions, in the **Searchable prompt suggestions** row, open the actions menu and select **Delete**.
This also cancels the refresh schedule.
If you delete the index another way, cancel the schedule first, or the next run recreates it.
