Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ description: An exhaustive reference of special chat tools supported by Meilisea

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.

<Note>
In code examples, replace `WORKSPACE_NAME` with the name of your workspace. On Meilisearch Cloud, the default workspace name is `cloud`.
</Note>

## Meilisearch chat tools

For the best user experience, configure all following tools.
Expand Down Expand Up @@ -112,6 +116,7 @@ curl \
-H 'Content-Type: application/json' \
--data-binary '{
"model": "PROVIDER_MODEL_UID",
"stream": true,
"messages": [
{
"role": "user",
Expand Down Expand Up @@ -145,7 +150,7 @@ curl \
"parameters": {
"type": "object",
"properties": {
"role": { "type": "string", "description": "The role of the messages author, either user or assistant" },
"role": { "type": "string", "description": "The role of the messages author, either `tool` or `assistant`" },
"content": { "type": "string", "description": "The contents of the assistant or tool message. Required unless tool_calls is specified." },
"tool_calls": {
"type": ["array", "null"],
Expand Down Expand Up @@ -183,7 +188,7 @@ curl \
"type": "object",
"properties": {
"call_id": { "type": "string", "description": "The call ID to track the original search associated to those sources" },
"documents": { "type": "object", "description": "The documents associated with the search. Only displayed attributes are returned" }
"documents": { "type": "array", "items": { "type": "object" }, "description": "The documents associated with the search. Only displayed attributes are returned" }
},
"required": ["call_id", "documents"],
"additionalProperties": false
Expand Down Expand Up @@ -223,7 +228,7 @@ const tools = [
parameters: {
type: 'object',
properties: {
role: { type: 'string', description: 'The role of the messages author, either user or assistant' },
role: { type: 'string', description: 'The role of the messages author, either `tool` or `assistant`' },
content: { type: 'string', description: 'The contents of the assistant or tool message.' },
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' } } } },
tool_call_id: { type: ['string', 'null'], description: 'Tool call that this message is responding to' },
Expand All @@ -243,7 +248,7 @@ const tools = [
type: 'object',
properties: {
call_id: { type: 'string', description: 'The call ID to track the original search associated to those sources' },
documents: { type: 'object', description: 'The documents associated with the search.' },
documents: { type: 'array', items: { type: 'object' }, description: 'The documents associated with the search.' },
},
required: ['call_id', 'documents'],
additionalProperties: false,
Expand All @@ -263,6 +268,7 @@ const response = await fetch(
},
body: JSON.stringify({
model: 'PROVIDER_MODEL_UID',
stream: true,
messages: [{ role: 'user', content: 'What are the best sci-fi movies?' }],
tools,
}),
Expand Down Expand Up @@ -342,7 +348,7 @@ const tools = [
type: 'object',
properties: {
call_id: { type: 'string' },
documents: { type: 'object' },
documents: { type: 'array', items: { type: 'object' } },
},
required: ['call_id', 'documents'],
additionalProperties: false,
Expand Down Expand Up @@ -422,7 +428,7 @@ const { textStream } = streamText({
type: 'object',
properties: {
call_id: { type: 'string' },
documents: { type: 'object' },
documents: { type: 'array', items: { type: 'object' } },
},
required: ['call_id', 'documents'],
additionalProperties: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ When Meilisearch sends retrieved documents to the LLM, the model may:
- Combine facts from different documents in incorrect ways
- Generate plausible-sounding but fabricated details

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

## System prompt engineering

Expand Down
Loading