Skip to content

Commit 3ae5457

Browse files
v1.15.1: /chat route docs review (#3316)
* fix /network route component * WIP: `/chats` reference review * Update code samples [skip ci] * polish chat reference * Update code samples [skip ci] * add tooling reference to menu * improve text and flow across remaining chat content * remove editing artefact * Update code samples [skip ci] * fix chat settings * 💅 * address reviewer feedback * fix links --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 7ff91cf commit 3ae5457

File tree

7 files changed

+524
-611
lines changed

7 files changed

+524
-611
lines changed

docs.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@
165165
"group": "AI-powered search",
166166
"pages": [
167167
"learn/ai_powered_search/getting_started_with_ai_search",
168-
"learn/ai_powered_search/conversational_search_with_chat",
169168
"learn/ai_powered_search/configure_rest_embedder",
170169
"learn/ai_powered_search/document_template_best_practices",
171170
"learn/ai_powered_search/image_search_with_user_provided_embeddings",
@@ -175,6 +174,14 @@
175174
"learn/ai_powered_search/difference_full_text_ai_search"
176175
]
177176
},
177+
{
178+
"group": "Conversational search",
179+
"pages": [
180+
"learn/chat/getting_started_with_chat",
181+
"learn/chat/chat_tooling_reference",
182+
"learn/chat/conversational_search"
183+
]
184+
},
178185
{
179186
"group": "Self-hosted",
180187
"pages": [
@@ -945,6 +952,14 @@
945952
{
946953
"source": "/guides/deployment/gcp",
947954
"destination": "/guides/running_production"
955+
},
956+
{
957+
"source": "/guides/ai/getting_started_with_chat",
958+
"destination": "/learn/chat/getting_started_with_chat"
959+
},
960+
{
961+
"source": "learn/ai_powered_search/conversational_search_with_chat",
962+
"destination": "learn/chat/conversational_search"
948963
}
949964
]
950965
}

learn/chat/chat_tooling_reference.md

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
---
2+
title: Chat tooling reference
3+
description: An exhaustive reference of special chat tools supported by Meilisearch
4+
---
5+
6+
When creating your conversational search agent, you may be able to extend the model's capabilities with a number of tools. This page lists Meilisearch-specific tools that may improve user experience.
7+
8+
<Note>
9+
This is an experimental feature. Use the Meilisearch Cloud UI or the experimental features endpoint to activate it:
10+
11+
```sh
12+
curl \
13+
-X PATCH 'MEILISEARCH_URL/experimental-features/' \
14+
-H 'Content-Type: application/json' \
15+
--data-binary '{
16+
"chatCompletions": true
17+
}'
18+
```
19+
</Note>
20+
21+
## Meilisearch chat tools
22+
23+
For the best user experience, configure all following tools.
24+
25+
1. **Handle progress updates** by displaying search status to users during streaming
26+
2. **Append conversation messages** as requested to maintain context for future requests
27+
3. **Display source documents** to users for transparency and verification
28+
4. **Use `call_id`** to associate progress updates with their corresponding source results
29+
30+
<Note>
31+
These special tools are handled internally by Meilisearch and are not forwarded to the LLM provider. They serve as a communication mechanism between Meilisearch and your application to provide enhanced user experience features.
32+
</Note>
33+
34+
### `_meiliSearchProgress`
35+
36+
This tool reports real-time progress of internal search operations. When declared, Meilisearch will call this function whenever search operations are performed in the background.
37+
38+
**Purpose**: Provides transparency about search operations and reduces perceived latency by showing users what's happening behind the scenes.
39+
40+
**Arguments**:
41+
42+
- `call_id`: Unique identifier to track the search operation
43+
- `function_name`: Name of the internal function being executed (e.g., "_meiliSearchInIndex")
44+
- `function_parameters`: JSON-encoded string containing search parameters like `q` (query) and `index_uid`
45+
46+
**Example Response**:
47+
48+
```json
49+
{
50+
"function": {
51+
"name": "_meiliSearchProgress",
52+
"arguments": "{\"call_id\":\"89939d1f-6857-477c-8ae2-838c7a504e6a\",\"function_name\":\"_meiliSearchInIndex\",\"function_parameters\":\"{\\\"index_uid\\\":\\\"movies\\\",\\\"q\\\":\\\"search engine\\\"}\"}"
53+
}
54+
}
55+
```
56+
57+
### `_meiliAppendConversationMessage`
58+
59+
Since the `/chats/{workspace}/chat/completions` endpoint is stateless, this tool helps maintain conversation context by requesting the client to append internal messages to the conversation history.
60+
61+
**Purpose**: Maintains conversation context for better response quality in subsequent requests by preserving tool calls and results.
62+
63+
**Arguments**:
64+
65+
- `role`: Message author role ("user" or "assistant")
66+
- `content`: Message content (for tool results)
67+
- `tool_calls`: Array of tool calls made by the assistant
68+
- `tool_call_id`: ID of the tool call this message responds to
69+
70+
**Example Response**:
71+
72+
```json
73+
{
74+
"function": {
75+
"name": "_meiliAppendConversationMessage",
76+
"arguments": "{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_ijAdM42bixq9lAF4SiPwkq2b\",\"type\":\"function\",\"function\":{\"name\":\"_meiliSearchInIndex\",\"arguments\":\"{\\\"index_uid\\\":\\\"movies\\\",\\\"q\\\":\\\"search engine\\\"}\"}}]}"
77+
}
78+
}
79+
```
80+
81+
### `_meiliSearchSources`
82+
83+
This tool provides the source documents that were used by the LLM to generate responses, enabling transparency and allowing users to verify information sources.
84+
85+
**Purpose**: Shows users which documents were used to generate responses, improving trust and enabling source verification.
86+
87+
**Arguments**:
88+
89+
- `call_id`: Matches the `call_id` from `_meiliSearchProgress` to associate queries with results
90+
- `documents`: JSON object containing the source documents with only displayed attributes
91+
92+
**Example Response**:
93+
94+
```json
95+
{
96+
"function": {
97+
"name": "_meiliSearchSources",
98+
"arguments": "{\"call_id\":\"abc123\",\"documents\":[{\"id\":197302,\"title\":\"The Sacred Science\",\"overview\":\"Diabetes. Prostate cancer...\",\"genres\":[\"Documentary\",\"Adventure\",\"Drama\"]}]}"
99+
}
100+
}
101+
```
102+
103+
### Sample OpenAI tool declaration
104+
105+
Include these tools in your request's `tools` array to enable enhanced functionality:
106+
107+
<CodeGroup>
108+
109+
```json
110+
{
111+
112+
"tools": [
113+
{
114+
"type": "function",
115+
"function": {
116+
"name": "_meiliSearchProgress",
117+
"description": "Provides information about the current Meilisearch search operation",
118+
"parameters": {
119+
"type": "object",
120+
"properties": {
121+
"call_id": {
122+
"type": "string",
123+
"description": "The call ID to track the sources of the search"
124+
},
125+
"function_name": {
126+
"type": "string",
127+
"description": "The name of the function we are executing"
128+
},
129+
"function_parameters": {
130+
"type": "string",
131+
"description": "The parameters of the function we are executing, encoded in JSON"
132+
}
133+
},
134+
"required": ["call_id", "function_name", "function_parameters"],
135+
"additionalProperties": false
136+
},
137+
"strict": true
138+
}
139+
},
140+
{
141+
"type": "function",
142+
"function": {
143+
"name": "_meiliAppendConversationMessage",
144+
"description": "Append a new message to the conversation based on what happened internally",
145+
"parameters": {
146+
"type": "object",
147+
"properties": {
148+
"role": {
149+
"type": "string",
150+
"description": "The role of the messages author, either `role` or `assistant`"
151+
},
152+
"content": {
153+
"type": "string",
154+
"description": "The contents of the `assistant` or `tool` message. Required unless `tool_calls` is specified."
155+
},
156+
"tool_calls": {
157+
"type": ["array", "null"],
158+
"description": "The tool calls generated by the model, such as function calls",
159+
"items": {
160+
"type": "object",
161+
"properties": {
162+
"function": {
163+
"type": "object",
164+
"description": "The function that the model called",
165+
"properties": {
166+
"name": {
167+
"type": "string",
168+
"description": "The name of the function to call"
169+
},
170+
"arguments": {
171+
"type": "string",
172+
"description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."
173+
}
174+
}
175+
},
176+
"id": {
177+
"type": "string",
178+
"description": "The ID of the tool call"
179+
},
180+
"type": {
181+
"type": "string",
182+
"description": "The type of the tool. Currently, only function is supported"
183+
}
184+
}
185+
}
186+
},
187+
"tool_call_id": {
188+
"type": ["string", "null"],
189+
"description": "Tool call that this message is responding to"
190+
}
191+
},
192+
"required": ["role", "content", "tool_calls", "tool_call_id"],
193+
"additionalProperties": false
194+
},
195+
"strict": true
196+
}
197+
},
198+
{
199+
"type": "function",
200+
"function": {
201+
"name": "_meiliSearchSources",
202+
"description": "Provides sources of the search",
203+
"parameters": {
204+
"type": "object",
205+
"properties": {
206+
"call_id": {
207+
"type": "string",
208+
"description": "The call ID to track the original search associated to those sources"
209+
},
210+
"documents": {
211+
"type": "object",
212+
"description": "The documents associated with the search (call_id). Only the displayed attributes of the documents are returned"
213+
}
214+
},
215+
"required": ["call_id", "documents"],
216+
"additionalProperties": false
217+
},
218+
"strict": true
219+
}
220+
}
221+
]
222+
}
223+
```
224+
225+
</CodeGroup>

learn/ai_powered_search/conversational_search_with_chat.mdx renamed to learn/chat/conversational_search.mdx

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
---
2-
title: Conversational search with chat
2+
title: Conversational search
33
sidebarTitle: Conversational search
44
description: Learn how to implement AI-powered conversational search using Meilisearch's chat feature
55
---
66

77
Meilisearch's chat completions feature enables AI-powered conversational search, allowing users to ask questions in natural language and receive direct answers based on your indexed content. This feature transforms the traditional search experience into an interactive dialogue.
88

9-
<Warning>
10-
The chat completions feature is experimental and must be enabled through [experimental features](/reference/api/experimental_features). API specifications may change in future releases.
11-
</Warning>
9+
<Note>
10+
This is an experimental feature. Use the Meilisearch Cloud UI or the experimental features endpoint to activate it:
11+
12+
```sh
13+
curl \
14+
-X PATCH 'MEILISEARCH_URL/experimental-features/' \
15+
-H 'Content-Type: application/json' \
16+
--data-binary '{
17+
"chatCompletions": true
18+
}'
19+
```
20+
</Note>
1221

1322
## What is conversational search?
1423

15-
Conversational search allows users to:
24+
Conversational search interfaces allow users to:
25+
1626
- Ask questions in natural language instead of using keywords
1727
- Receive direct answers rather than just document links
1828
- Maintain context across multiple questions
@@ -23,53 +33,50 @@ This approach bridges the gap between traditional search and modern AI experienc
2333
## How chat completions differs from traditional search
2434

2535
### Traditional search workflow
36+
2637
1. User enters keywords
2738
2. Meilisearch returns matching documents
2839
3. User reviews results to find answers
2940

3041
### Conversational search workflow
42+
3143
1. User asks a question in natural language
3244
2. Meilisearch retrieves relevant documents
3345
3. AI generates a direct answer based on those documents
3446
4. User can ask follow-up questions
3547

36-
## RAG implementation simplified
37-
38-
The chat completions feature implements a complete Retrieval Augmented Generation (RAG) pipeline in a single API endpoint. Traditional RAG implementations require:
39-
40-
- Multiple LLM calls for query optimization
41-
- Separate vector database for semantic search
42-
- Custom reranking solutions
43-
- Complex pipeline management
44-
45-
Meilisearch's chat completions consolidates these into one streamlined process:
46-
47-
1. **Query understanding**: Automatically transforms questions into optimal search parameters
48-
2. **Hybrid retrieval**: Combines keyword and semantic search for superior relevance
49-
3. **Answer generation**: Uses your chosen LLM to generate responses
50-
4. **Context management**: Maintains conversation history automatically
51-
5248
## When to use chat completions vs traditional search
5349

5450
### Use conversational search when:
51+
5552
- Users need direct answers to specific questions
5653
- Content is informational (documentation, knowledge bases, FAQs)
5754
- Users benefit from follow-up questions
5855
- Natural language interaction improves user experience
5956

6057
### Use traditional search when:
58+
6159
- Users need to browse multiple options
6260
- Results require comparison (e-commerce products, listings)
6361
- Exact matching is critical
6462
- Response time is paramount
6563

66-
## Alternative: Model Context Protocol integration
64+
## Use chat completions to implement RAG pipelines
65+
66+
The chat completions feature implements a complete Retrieval Augmented Generation (RAG) pipeline in a single API endpoint. Meilisearch's chat completions consolidates RAG creation into one streamlined process:
67+
68+
1. **Query understanding**: automatically transforms questions into search parameters
69+
2. **Hybrid retrieval**: combines keyword and semantic search for better relevancy
70+
3. **Answer generation**: uses your chosen LLM to generate responses
71+
4. **Context management**: maintains conversation history by constantly pushing the full conversation to the dedicated tool
72+
73+
### Alternative: MCP integration
6774

6875
When integrating Meilisearch with AI assistants and automation tools, consider using [Meilisearch's Model Context Protocol (MCP) server](/guides/ai/mcp). MCP enables standardized tool integration across various AI platforms and applications.
6976

7077
## Architecture overview
7178

72-
The chat completions feature operates through workspaces, which are isolated configurations for different use cases or tenants. Each workspace can:
79+
Chat completions operate through workspaces, which are isolated configurations for different use cases. Each workspace can:
7380

7481
- Use different LLM sources (openAi, azureOpenAi, mistral, gemini, vLlm)
7582
- Apply custom prompts
@@ -97,13 +104,12 @@ The chat completions feature operates through workspaces, which are isolated con
97104

98105
The chat completions feature integrates with Meilisearch's existing security model:
99106

100-
- **API key permissions**: Chat only accesses indexes visible to the provided API key
101-
- **Tenant tokens**: Support for multi-tenant applications
102-
- **LLM credentials**: Stored securely in workspace settings
103-
- **Content isolation**: Responses based only on indexed content
107+
- **API key permissions**: chat only accesses indexes visible to the provided API key
108+
- **Tenant tokens**: support for multi-tenant applications
109+
- **LLM credentials**: stored securely in workspace settings
110+
- **Content isolation**: responses based only on indexed content
104111

105112
## Next steps
106113

107-
- [Get started with chat completions implementation](/guides/ai/getting_started_with_chat)
114+
- [Get started with chat completions implementation](/learn/chat/getting_started_with_chat)
108115
- [Explore the chat completions API reference](/reference/api/chats)
109-
- [Learn about experimental features](/reference/api/experimental_features)

0 commit comments

Comments
 (0)