/chats route enables AI-powered conversational search by integrating Large Language Models (LLMs) with your Meilisearch data.
This is an experimental feature. Use the Meilisearch Cloud UI or the experimental features endpoint to activate it:
Authorization
When implementing conversational search, use an API key with access to both thesearch and chatCompletions actions such as the default chat API key. You may also use tenant tokens instead of an API key, provided you generate the tokens with a key that has access to the required actions.
Chat queries only search the indexes its API key can access. The default chat API key has access to all indexes. To limit access, you must either create a new key, or generate a tenant token from the default chat API key.
Chat workspaces
Workspaces are groups of chat settings tailored towards specific use cases. You must configure at least on workspace to use chat completions.Chat workspace object
Chat workspace settings object
source
Type: StringDefault value: N/A
Description: Name of the chosen embeddings provider. Must be one of:
"openAi", "azureOpenAi", "mistral", "gemini", or "vLlm"
orgId
Type: StringDefault value: N/A
Description: Organization ID used to access the LLM provider. Required for Azure OpenAI, incompatible with other sources
projectId
Type: StringDefault value: N/A
Description: Project ID used to access the LLM provider. Required for Azure OpenAI, incompatible with other sources
apiVersion
Type: StringDefault value: N/A
Description: API version used by the LLM provider. Required for Azure OpenAI, incompatible with other sources
deploymentId
Type: StringDefault value: N/A
Description: Deployment ID used by the LLM provider. Required for Azure OpenAI, incompatible with other sources
baseUrl
Type: StringDefault value: N/A
Description: Base URL Meilisearch should target when sending requests to the embeddings provider. Must be the full URL preceding the
/chat/completions fragment. Required for Azure OpenAI and vLLM
apiKey
Type: StringDefault value: N/A
Description: API key to access the LLM provider. Optional for vLLM, mandatory for all other providers
prompts
Type: ObjectDefault value: N/A
Description: Prompts giving baseline context to the conversational agent. The prompts object accepts the following fields:
prompts.system: Default prompt giving the general usage context of the conversational search agent. Example: “You are a helpful bot answering questions on how to use Meilisearch”prompts.searchDescription: An internal description of the Meilisearch chat tools. Use it to instruct the agent on how and when to use the configured tools. Example: “Tool for retrieving relevant documents. Use it when users ask for factual information, past records, or resources that might exist in indexed content.”prompts.QParam: Description of expected user input and the desired output. Example: “Users will ask about Meilisearch. Provide short and direct keyword-style queries.”prompts.IndexUidParam: Instructions describing each index the agent has access to and how to use them. Example: “If user asks about code or API or parameters, use the index calleddocumentation.”
List chat workspaces
GET
/chats
offset and limit query parameters.
Query parameters
Response
Example
Response: 200 Ok
Get one chat workspace
GET
/chats/{workspace_uid}
Path parameters
Example
Response: 200 Ok
Get chat workspace settings
GET
/chats/{workspace_uid}/settings
Path parameters
Response: 200 OK
Returns the settings object. For security reasons, the apiKey field is obfuscated.
Example
Create a chat workspace and update chat workspace settings
PATCH
/chats/{workspace_uid}/settings
Path parameters
Settings parameters
Prompt parameters
Request body
Response: 200 OK
Returns the updated settings object. apiKey is write-only and will not be returned in the response.
Examples
Reset chat workspace settings
DELETE
/chats/{workspace_uid}/settings
Path parameters
Response: 200 OK
Returns the settings object without the apiKey field.
Example
Chat completions
After creating a workspace, you can use the chat completions API to create a conversational search agent.Stream chat completions
POST
/chats/{workspace_uid}/chat/completions
Path parameters
Request body
Message object
role
Specifies the message origin: Meilisearch (system), the LLM provider (assistant), or user input (user)