Documentation Index
Fetch the complete documentation index at: https://algolia.com/llms.txt
Use this file to discover all available pages before exploring further.
This widget is and is subject to change in minor versions.
- An “AI Mode” button on the search box that opens a chat panel loaded with the user’s query.
- The Chat widget itself, with hidden context to share session metadata.
- AI-generated prompt suggestions in the autocomplete drop-down menu.
- Streaming controls so you can stop or resume an in-flight response.
Prerequisites
- An Agent Studio agent ID.
- An
<InstantSearch>root with an Algolia search client. react-instantsearchinstalled at a version that ships AI Mode (for example, the release from PRalgolia/instantsearch#6982or later).
Mount the Chat widget
Add the
<Chat> widget on the same <InstantSearch> instance as your search UI. The other widgets in this guide rely on it being present.React
Enable AI Mode on the search box
Set
aiMode on <SearchBox> to render an AI Mode button next to the input. Clicking it opens the Chat widget and forwards the current query.React
Show prompt suggestions in autocomplete (optional)
If you use Selecting a prompt suggestion opens the Chat widget on the same index and sends the suggestion as the first message.
<EXPERIMENTAL_Autocomplete>, surface AI-generated prompt suggestions alongside hits. See showPromptSuggestions for the full configuration surface.React
Pass session metadata with hidden context
Use the
context prop to share metadata with the agent on every message. The widget serializes the value as JSON and adds it to the user message as a hidden text part. Users don’t see it in the chat UI, but the agent does.Handle the streaming lifecycle
Listen for response completion with Set
onFinish, and use the useChat hook to expose Stop and resume controls. See Streaming and resumption on the Chat widget reference for the full status surface.React
resume to reconnect to an in-flight assistant response after a page reload.End-to-end example
React