Skip to content

Commit bc2f35f

Browse files
committed
Add documentation for Meilisearch chatCompletions feature
- Add conceptual overview of conversational search in learn/ai_powered_search/ - Add comprehensive API reference for /chats endpoints in reference/api/ - Add practical implementation guide in guides/ai/ - Update experimental features page to include chatCompletions - Support all 5 LLM sources: openAi, azureOpenAi, mistral, gemini, vLlm - Document OpenAI SDK compatibility with code examples - Add navigation entries in docs.json under Artificial intelligence section
1 parent b9ba8b3 commit bc2f35f

File tree

6 files changed

+800
-3
lines changed

6 files changed

+800
-3
lines changed

CLAUDE.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is the official **Meilisearch Documentation** repository - a content-only repository for the documentation website of Meilisearch, an open-source search engine API. The documentation is built with Mintlify, written in MDX format, and deployed on Vercel.
8+
9+
**Important**: This is a content-only repository. Local development is NOT possible as the website code lives elsewhere.
10+
11+
## Common Development Commands
12+
13+
```bash
14+
# Markdown linting
15+
npm run marklint # Check markdown files for style issues
16+
npm run marklint:fix # Auto-fix markdown issues
17+
18+
# Prose linting with Vale
19+
npm run proselint # Check prose quality and style
20+
```
21+
22+
## Architecture and Structure
23+
24+
### Content Organization
25+
- `/learn/` - Learning resources and conceptual guides
26+
- `/guides/` - Implementation guides for various technologies
27+
- `/reference/` - API reference documentation
28+
- `/snippets/samples/` - Reusable code samples (included via MDX)
29+
- `/assets/` - Images and datasets organized by feature/guide
30+
31+
### Key Configuration Files
32+
- `docs.json` - Mintlify configuration (theme, navigation, search)
33+
- `.markdownlint.jsonc` - Markdown linting rules
34+
- `.vale/` - Prose style guidelines and custom vocabulary
35+
- `docs-scraper.config.json` - Meilisearch indexing configuration with OpenAI embeddings
36+
37+
### Documentation Features
38+
- **Search**: Self-indexed using Meilisearch with semantic search via OpenAI embeddings
39+
- **Theme**: Dark/light mode support with custom branding
40+
- **Navigation**: Hierarchical structure defined in docs.json
41+
- **Code Samples**: Modular snippets system for consistent examples across languages
42+
43+
## Writing Guidelines
44+
45+
### Content Format
46+
- All documentation files use **MDX** format (Markdown with JSX support)
47+
- Code samples are stored separately in `/snippets/samples/` and included via MDX
48+
- Images must use **raw GitHub URLs** (not relative paths):
49+
```markdown
50+
![Description](https://raw.githubusercontent.com/meilisearch/documentation/main/assets/images/guide-name/image.png)
51+
```
52+
53+
### Style Rules
54+
- **Capitalization**: Sentence-style for headings (except proper nouns like AWS, Docker)
55+
- **Spelling**: British English preferred
56+
- **Grammar**: Oxford comma usage
57+
- **Bold/Italics**: Use `*` for bold, `_` for italics
58+
- **First Person**: Avoid "I", "me", "my" unless in FAQs
59+
- **Accessibility**: Write for non-native English speakers
60+
61+
### Contributing Process
62+
1. Check existing issues before creating new ones
63+
2. PRs should solve existing issues or fix small errors
64+
3. All code samples must run without errors
65+
4. Updates may require changes to multiple related pages
66+
5. Response required within 7 days for PR feedback
67+
68+
## Important Notes
69+
70+
- This repository contains **only content** - no build system or local preview
71+
- Changes are reviewed for accuracy, clarity, and code functionality
72+
- The documentation philosophy emphasizes being Efficient, Accessible, Thorough, and Open source
73+
- Vale prose linting enforces consistent style and terminology

docs.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
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",
168169
"learn/ai_powered_search/configure_rest_embedder",
169170
"learn/ai_powered_search/document_template_best_practices",
170171
"learn/ai_powered_search/image_search_with_user_provided_embeddings",
@@ -329,6 +330,7 @@
329330
"reference/api/network",
330331
"reference/api/similar",
331332
"reference/api/facet_search",
333+
"reference/api/chats",
332334
"reference/api/tasks",
333335
"reference/api/batches",
334336
"reference/api/keys",
@@ -377,6 +379,7 @@
377379
{
378380
"group": "Artificial intelligence",
379381
"pages": [
382+
"guides/ai/getting_started_with_chat",
380383
"guides/ai/mcp",
381384
"guides/embedders/openai",
382385
"guides/langchain",
Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
---
2+
title: Getting started with conversational search
3+
sidebarTitle: Getting started with chat
4+
description: Learn how to implement AI-powered conversational search in your application
5+
---
6+
7+
import { Warning, Note } from '/snippets/notice_tag.mdx'
8+
9+
This guide walks you through implementing Meilisearch's chatCompletions feature to create conversational search experiences in your application.
10+
11+
<Warning>
12+
The chatCompletions feature is experimental and must be enabled before use. See [experimental features](/reference/api/experimental_features) for activation instructions.
13+
</Warning>
14+
15+
## Prerequisites
16+
17+
Before starting, ensure you have:
18+
- Meilisearch instance running (v1.15.1 or later)
19+
- An API key from an LLM provider (OpenAI, Azure OpenAI, Mistral, Gemini, or access to a vLLM server)
20+
- At least one index with searchable content
21+
- The chatCompletions experimental feature enabled
22+
23+
## Quick start
24+
25+
### 1. Enable the chatCompletions feature
26+
27+
First, enable the chatCompletions experimental feature:
28+
29+
```bash
30+
curl \
31+
-X PATCH 'http://localhost:7700/experimental-features' \
32+
-H 'Authorization: Bearer MASTER_KEY' \
33+
-H 'Content-Type: application/json' \
34+
--data-binary '{
35+
"chatCompletions": true
36+
}'
37+
```
38+
39+
### 2. Configure a chatCompletions workspace
40+
41+
Create a workspace with your LLM provider settings. Here are examples for different providers:
42+
43+
<CodeGroup>
44+
45+
```bash openAi
46+
curl \
47+
-X PATCH 'http://localhost:7700/chats/my-assistant/settings' \
48+
-H 'Authorization: Bearer MASTER_KEY' \
49+
-H 'Content-Type: application/json' \
50+
--data-binary '{
51+
"source": "openAi",
52+
"apiKey": "sk-...",
53+
"prompts": {
54+
"system": "You are a helpful assistant. Answer questions based only on the provided context."
55+
}
56+
}'
57+
```
58+
59+
```bash azureOpenAi
60+
curl \
61+
-X PATCH 'http://localhost:7700/chats/my-assistant/settings' \
62+
-H 'Authorization: Bearer MASTER_KEY' \
63+
-H 'Content-Type: application/json' \
64+
--data-binary '{
65+
"source": "azureOpenAi",
66+
"apiKey": "your-azure-key",
67+
"baseUrl": "https://your-resource.openai.azure.com",
68+
"prompts": {
69+
"system": "You are a helpful assistant. Answer questions based only on the provided context."
70+
}
71+
}'
72+
```
73+
74+
```bash mistral
75+
curl \
76+
-X PATCH 'http://localhost:7700/chats/my-assistant/settings' \
77+
-H 'Authorization: Bearer MASTER_KEY' \
78+
-H 'Content-Type: application/json' \
79+
--data-binary '{
80+
"source": "mistral",
81+
"apiKey": "your-mistral-key",
82+
"prompts": {
83+
"system": "You are a helpful assistant. Answer questions based only on the provided context."
84+
}
85+
}'
86+
```
87+
88+
```bash gemini
89+
curl \
90+
-X PATCH 'http://localhost:7700/chats/my-assistant/settings' \
91+
-H 'Authorization: Bearer MASTER_KEY' \
92+
-H 'Content-Type: application/json' \
93+
--data-binary '{
94+
"source": "gemini",
95+
"apiKey": "your-gemini-key",
96+
"prompts": {
97+
"system": "You are a helpful assistant. Answer questions based only on the provided context."
98+
}
99+
}'
100+
```
101+
102+
```bash vLlm
103+
curl \
104+
-X PATCH 'http://localhost:7700/chats/my-assistant/settings' \
105+
-H 'Authorization: Bearer MASTER_KEY' \
106+
-H 'Content-Type: application/json' \
107+
--data-binary '{
108+
"source": "vllm",
109+
"baseUrl": "http://localhost:8000",
110+
"prompts": {
111+
"system": "You are a helpful assistant. Answer questions based only on the provided context."
112+
}
113+
}'
114+
```
115+
116+
</CodeGroup>
117+
118+
### 3. Send your first chatCompletions request
119+
120+
Now you can start a conversation:
121+
122+
```bash
123+
curl \
124+
-X POST 'http://localhost:7700/chats/my-assistant/chat/completions' \
125+
-H 'Authorization: Bearer DEFAULT_CHAT_KEY' \
126+
-H 'Content-Type: application/json' \
127+
--data-binary '{
128+
"model": "gpt-3.5-turbo",
129+
"messages": [
130+
{
131+
"role": "user",
132+
"content": "What is Meilisearch?"
133+
}
134+
],
135+
"stream": true
136+
}'
137+
```
138+
139+
## Understanding workspaces
140+
141+
Workspaces allow you to create isolated chat configurations for different use cases:
142+
143+
- **Customer support**: Configure with support-focused prompts
144+
- **Product search**: Optimize for e-commerce queries
145+
- **Documentation**: Tune for technical Q&A
146+
147+
Each workspace maintains its own:
148+
- LLM provider configuration
149+
- System prompt
150+
- Access permissions
151+
152+
## Building a chat interface with OpenAI SDK
153+
154+
Since Meilisearch's chat endpoint is OpenAI-compatible, you can use the official OpenAI SDK:
155+
156+
<CodeGroup>
157+
158+
```javascript JavaScript
159+
import OpenAI from 'openai';
160+
161+
const client = new OpenAI({
162+
baseURL: 'http://localhost:7700/chats/my-assistant',
163+
apiKey: 'YOUR_MEILISEARCH_API_KEY',
164+
});
165+
166+
const completion = await client.chat.completions.create({
167+
model: 'gpt-3.5-turbo',
168+
messages: [{ role: 'user', content: 'What is Meilisearch?' }],
169+
stream: true,
170+
});
171+
172+
for await (const chunk of completion) {
173+
console.log(chunk.choices[0]?.delta?.content || '');
174+
}
175+
```
176+
177+
```python Python
178+
from openai import OpenAI
179+
180+
client = OpenAI(
181+
base_url="http://localhost:7700/chats/my-assistant",
182+
api_key="YOUR_MEILISEARCH_API_KEY"
183+
)
184+
185+
stream = client.chat.completions.create(
186+
model="gpt-3.5-turbo",
187+
messages=[{"role": "user", "content": "What is Meilisearch?"}],
188+
stream=True,
189+
)
190+
191+
for chunk in stream:
192+
if chunk.choices[0].delta.content is not None:
193+
print(chunk.choices[0].delta.content, end="")
194+
```
195+
196+
```typescript TypeScript
197+
import OpenAI from 'openai';
198+
199+
const client = new OpenAI({
200+
baseURL: 'http://localhost:7700/chats/my-assistant',
201+
apiKey: 'YOUR_MEILISEARCH_API_KEY',
202+
});
203+
204+
const stream = await client.chat.completions.create({
205+
model: 'gpt-3.5-turbo',
206+
messages: [{ role: 'user', content: 'What is Meilisearch?' }],
207+
stream: true,
208+
});
209+
210+
for await (const chunk of stream) {
211+
const content = chunk.choices[0]?.delta?.content || '';
212+
process.stdout.write(content);
213+
}
214+
```
215+
216+
</CodeGroup>
217+
218+
## Next steps
219+
220+
- Explore [advanced chat API features](/reference/api/chats)
221+
- Learn about [conversational search concepts](/learn/ai_powered_search/conversational_search_with_chat)
222+
- Review [security best practices](/learn/security/basic_security)

0 commit comments

Comments
 (0)