Skip to content

Commit cb52c75

Browse files
authored
Merge pull request #3531 from meilisearch/fix-conversational-search-accuracy
Improve conversational search documentation
2 parents 249f691 + 5bca2ba commit cb52c75

12 files changed

Lines changed: 725 additions & 212 deletions

capabilities/conversational_search/advanced/chat_tooling_reference.mdx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ description: An exhaustive reference of special chat tools supported by Meilisea
55

66
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.
77

8+
<Note>
9+
In code examples, replace `WORKSPACE_NAME` with the name of your workspace. On Meilisearch Cloud, the default workspace name is `cloud`.
10+
</Note>
11+
812
## Meilisearch chat tools
913

1014
For the best user experience, configure all following tools.
@@ -112,6 +116,7 @@ curl \
112116
-H 'Content-Type: application/json' \
113117
--data-binary '{
114118
"model": "PROVIDER_MODEL_UID",
119+
"stream": true,
115120
"messages": [
116121
{
117122
"role": "user",
@@ -145,7 +150,7 @@ curl \
145150
"parameters": {
146151
"type": "object",
147152
"properties": {
148-
"role": { "type": "string", "description": "The role of the messages author, either user or assistant" },
153+
"role": { "type": "string", "description": "The role of the messages author, either `tool` or `assistant`" },
149154
"content": { "type": "string", "description": "The contents of the assistant or tool message. Required unless tool_calls is specified." },
150155
"tool_calls": {
151156
"type": ["array", "null"],
@@ -183,7 +188,7 @@ curl \
183188
"type": "object",
184189
"properties": {
185190
"call_id": { "type": "string", "description": "The call ID to track the original search associated to those sources" },
186-
"documents": { "type": "object", "description": "The documents associated with the search. Only displayed attributes are returned" }
191+
"documents": { "type": "array", "items": { "type": "object" }, "description": "The documents associated with the search. Only displayed attributes are returned" }
187192
},
188193
"required": ["call_id", "documents"],
189194
"additionalProperties": false
@@ -223,7 +228,7 @@ const tools = [
223228
parameters: {
224229
type: 'object',
225230
properties: {
226-
role: { type: 'string', description: 'The role of the messages author, either user or assistant' },
231+
role: { type: 'string', description: 'The role of the messages author, either `tool` or `assistant`' },
227232
content: { type: 'string', description: 'The contents of the assistant or tool message.' },
228233
tool_calls: { type: ['array', 'null'], description: 'The tool calls generated by the model', items: { type: 'object', properties: { function: { type: 'object', properties: { name: { type: 'string' }, arguments: { type: 'string' } } }, id: { type: 'string' }, type: { type: 'string' } } } },
229234
tool_call_id: { type: ['string', 'null'], description: 'Tool call that this message is responding to' },
@@ -243,7 +248,7 @@ const tools = [
243248
type: 'object',
244249
properties: {
245250
call_id: { type: 'string', description: 'The call ID to track the original search associated to those sources' },
246-
documents: { type: 'object', description: 'The documents associated with the search.' },
251+
documents: { type: 'array', items: { type: 'object' }, description: 'The documents associated with the search.' },
247252
},
248253
required: ['call_id', 'documents'],
249254
additionalProperties: false,
@@ -263,6 +268,7 @@ const response = await fetch(
263268
},
264269
body: JSON.stringify({
265270
model: 'PROVIDER_MODEL_UID',
271+
stream: true,
266272
messages: [{ role: 'user', content: 'What are the best sci-fi movies?' }],
267273
tools,
268274
}),
@@ -342,7 +348,7 @@ const tools = [
342348
type: 'object',
343349
properties: {
344350
call_id: { type: 'string' },
345-
documents: { type: 'object' },
351+
documents: { type: 'array', items: { type: 'object' } },
346352
},
347353
required: ['call_id', 'documents'],
348354
additionalProperties: false,
@@ -422,7 +428,7 @@ const { textStream } = streamText({
422428
type: 'object',
423429
properties: {
424430
call_id: { type: 'string' },
425-
documents: { type: 'object' },
431+
documents: { type: 'array', items: { type: 'object' } },
426432
},
427433
required: ['call_id', 'documents'],
428434
additionalProperties: false,

capabilities/conversational_search/advanced/reduce_hallucination.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ When Meilisearch sends retrieved documents to the LLM, the model may:
1414
- Combine facts from different documents in incorrect ways
1515
- Generate plausible-sounding but fabricated details
1616

17-
The key principle is: **the LLM should only use information from the documents Meilisearch retrieves, never its general knowledge**. All the techniques below reinforce this principle.
17+
The key principle is: **the LLM should only use information from the documents Meilisearch retrieves, not its general knowledge**. By default, LLMs may draw on their training data to fill gaps. All the techniques below help enforce this boundary and keep responses grounded in your indexed data.
1818

1919
## System prompt engineering
2020

0 commit comments

Comments
 (0)