/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 working with a secure Meilisearch instance, Use an API key with access to both thesearch
and chatCompletions
actions, such as the default chat API key.
Chat queries only search indexes its API key can access. The default chat API key has access to all indexes. To limit chat access to specific indexes, you must either create a new key, or generate a tenant token from the default chat API key.
Chat workspace object
Name | Type | Description |
---|---|---|
uid | String | Unique identifier for the chat completions workspace |
List chat workspaces
GET
/chats
offset
and limit
query parameters.
Query parameters
Query parameter | Description | Default value |
---|---|---|
offset | Number of workspaces to skip | 0 |
limit | Number of workspaces to return | 20 |
Response
Name | Type | Description |
---|---|---|
results | Array | An array of workspaces |
offset | Integer | Number of workspaces skipped |
limit | Integer | Number of workspaces returned |
total | Integer | Total number of workspaces |
Example
Response: 200 Ok
Get one chat workspace
GET
/chats/{workspace_uid}
Path parameters
Name | Type | Description |
---|---|---|
workspace_uid * | String | uid of the requested index |
Example
Response: 200 Ok
Chat workspace settings
Chat workspace settings object
The prompts object
Name | Type | Description |
---|---|---|
system | String | A prompt added to the start of the conversation to guide the LLM |
searchDescription | String | A prompt to explain what the internal search function does |
searchQParam | String | A prompt to explain what the q parameter of the search function does and how to use it |
searchIndexUidParam | String | A prompt to explain what the indexUid parameter of the search function does and how to use it |
Get chat workspace settings
GET
/chats/{workspace_uid}/settings
Path parameters
Name | Type | Description |
---|---|---|
workspace_uid | String | The workspace identifier |
Response: 200 OK
Returns the settings object. For security reasons, the apiKey
field is obfuscated.
Example
Update chat workspace settings
PATCH
/chats/{workspace_uid}/settings
Path parameters
Name | Type | Description |
---|---|---|
workspace_uid | String | The workspace identifier |
Settings parameters
Name | Type | Description |
---|---|---|
source | String | LLM source: "openAi" , "azureOpenAi" , "mistral" , "gemini" , or "vLlm" |
orgId | String | Organization ID for the LLM provider (required for azureOpenAi) |
projectId | String | Project ID for the LLM provider |
apiVersion | String | API version for the LLM provider (required for azureOpenAi) |
deploymentId | String | Deployment ID for the LLM provider (required for azureOpenAi) |
baseUrl | String | Base URL for the provider (required for azureOpenAi and vLlm) |
apiKey | String | API key for the LLM provider (optional for vLlm) |
prompts | Object | Prompts object containing system prompts and other configuration |
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
Name | Type | Description |
---|---|---|
workspace_uid | String | The workspace identifier |
Response: 200 OK
Returns the settings object without the apiKey
field.
Example
Chat completions
POST
/chats/{workspace_uid}/chat/completions
Path parameters
Name | Type | Description |
---|---|---|
workspace | String | The chat completion workspace unique identifier (uid) |
Request body
Name | Type | Required | Description |
---|---|---|---|
model | String | Yes | Model to use and will be related to the source LLM in the workspace settings |
messages | Array | Yes | Array of message objects with role and content |
stream | Boolean | No | Enable streaming responses (default: true ) |
Currently, only streaming responses (
stream: true
) are supported.Message object
Name | Type | Description |
---|---|---|
role | String | Message role: "system" , "user" , or "assistant" |
content | String | Message content |