Skip to main content

DocSearchAskAi Configuration

The DocSearchAskAi type defines configuration options for enabling AI-powered conversational search in DocSearch. This feature allows users to ask questions and receive AI-generated answers based on your documentation.

Required Properties

string
required
The assistant ID to use for the Ask AI feature. This identifies your configured AI assistant.

Optional Algolia Configuration

By default, Ask AI uses the same Algolia credentials (appId, apiKey, indexName) as the main search. You can override these for Ask AI if needed.
string
The index name to use for the Ask AI feature. Your assistant will search this index for relevant documents.If not provided, the main indexName from DocSearchProps will be used.
string
The API key to use for the Ask AI feature. Your assistant will use this API key to search the index.If not provided, the main apiKey from DocSearchProps will be used.
string
The app ID to use for the Ask AI feature. Your assistant will use this app ID to search the index.If not provided, the main appId from DocSearchProps will be used.

Features

boolean
Enables displaying suggested questions on Ask AI’s new conversation screen.Default: falseWhen enabled, users will see suggested questions they can click to start a conversation.

Search Parameters

The searchParameters configuration varies based on whether you’re using the standard Ask AI backend or the experimental Agent Studio backend.

Standard Configuration (Default)

AskAiSearchParameters
The search parameters to use for the Ask AI feature when agentStudio is not enabled or is false.

Agent Studio Configuration (Experimental)

boolean
Experimental: Whether to use Agent Studio as the chat backend.This is an experimental feature and its API may change without notice in future releases. Use with caution in production environments.Default: falseWhen set to true, the searchParameters structure changes to be keyed by index name.
AgentStudioSearchParameters
When agentStudio: true, search parameters must be keyed by index name.

Internal/Testing Properties

boolean
Internal testing property. Do not use in production.Note: This is a temporary hack for testing staging environments and will be removed before release.

Type Variants

The DocSearchAskAi type uses TypeScript discriminated unions to ensure type safety based on the agentStudio setting:

Simple String Configuration

In addition to the full DocSearchAskAi configuration object, you can pass a simple string assistant ID:
This is equivalent to:

Complete Examples