|
| 1 | +--- |
| 2 | +title: Understanding chat workspaces |
| 3 | +sidebarTitle: Chat workspaces explained |
| 4 | +description: Learn how chat workspaces work and how to use them effectively |
| 5 | +--- |
| 6 | + |
| 7 | +Chat workspaces are at the heart of Meilisearch's conversational search feature. This guide explains what they are, how they work, and best practices for using them. |
| 8 | + |
| 9 | +## What are chat workspaces? |
| 10 | + |
| 11 | +Chat workspaces are isolated configurations that define how your conversational search behaves. Think of them as different "personalities" or "assistants" that can answer questions about your data in specific ways. |
| 12 | + |
| 13 | +### Key characteristics |
| 14 | + |
| 15 | +- **Automatically created**: No need to explicitly create workspaces – they're created when you configure them |
| 16 | +- **Isolated configurations**: Each workspace has its own LLM settings and prompts |
| 17 | +- **Stateless**: No conversation history is stored between requests |
| 18 | +- **Multi-tenant ready**: Perfect for SaaS applications with different customers |
| 19 | + |
| 20 | +## Creating your first workspace |
| 21 | + |
| 22 | +The beauty of workspaces is their simplicity. Just configure one and it exists: |
| 23 | + |
| 24 | +```bash |
| 25 | +curl \ |
| 26 | + -X PATCH 'http://localhost:7700/chats/my-first-assistant/settings' \ |
| 27 | + -H 'Authorization: Bearer MASTER_KEY' \ |
| 28 | + -H 'Content-Type: application/json' \ |
| 29 | + --data-binary '{ |
| 30 | + "source": "openAi", |
| 31 | + "apiKey": "sk-...", |
| 32 | + "prompts": { |
| 33 | + "system": "You are a friendly assistant who loves to help!" |
| 34 | + } |
| 35 | + }' |
| 36 | +``` |
| 37 | + |
| 38 | +That's it! The workspace `my-first-assistant` now exists and is ready to use. |
| 39 | + |
| 40 | +## Workspace isolation and privacy |
| 41 | + |
| 42 | +Each workspace is completely isolated: |
| 43 | + |
| 44 | +- **Configuration isolation**: Settings don't affect other workspaces |
| 45 | +- **No shared context**: Conversations in one workspace don't affect others |
| 46 | +- **No data storage**: Meilisearch doesn't store any conversation data |
| 47 | + |
| 48 | +This means: |
| 49 | + |
| 50 | +- Complete privacy for your users |
| 51 | +- No cross-contamination between different use cases |
| 52 | +- Full compliance with data protection regulations |
| 53 | + |
| 54 | +## Best practices |
| 55 | + |
| 56 | +### 1. Use descriptive workspace names |
| 57 | + |
| 58 | +```bash |
| 59 | +# Good examples: |
| 60 | +/chats/customer-support/settings |
| 61 | +/chats/product-recommendations/settings |
| 62 | +/chats/technical-docs/settings |
| 63 | + |
| 64 | +# Less clear: |
| 65 | +/chats/ws1/settings |
| 66 | +/chats/test/settings |
| 67 | +``` |
| 68 | + |
| 69 | +### 2. Optimize prompts for each use case |
| 70 | + |
| 71 | +```json |
| 72 | +{ |
| 73 | + "prompts": { |
| 74 | + "system": "You are a helpful customer support agent. Be empathetic, professional, and always try to solve the customer's problem based on our documentation." |
| 75 | + } |
| 76 | +} |
| 77 | +``` |
| 78 | + |
| 79 | +### 3. Configure relevant indexes |
| 80 | + |
| 81 | +Use the [conversation settings](/reference/api/settings#conversation) to optimize how each index presents data: |
| 82 | + |
| 83 | +```json |
| 84 | +{ |
| 85 | + "description": "Product catalog with electronics and accessories", |
| 86 | + "documentTemplate": "Product: {{doc.name}} - {{doc.description}} (Price: ${{doc.price}})", |
| 87 | + "searchParameters": { |
| 88 | + "limit": 5, |
| 89 | + "sort": ["popularity:desc"] |
| 90 | + } |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +## Common use cases |
| 95 | + |
| 96 | +### Multi-tenant SaaS |
| 97 | + |
| 98 | +Create workspaces per customer: |
| 99 | + |
| 100 | +``` |
| 101 | +/chats/customer-123/settings |
| 102 | +/chats/customer-456/settings |
| 103 | +``` |
| 104 | + |
| 105 | +### Multiple departments |
| 106 | + |
| 107 | +Different assistants for different teams: |
| 108 | + |
| 109 | +``` |
| 110 | +/chats/sales-team/settings |
| 111 | +/chats/support-team/settings |
| 112 | +/chats/engineering-docs/settings |
| 113 | +``` |
| 114 | + |
| 115 | +### A/B testing |
| 116 | + |
| 117 | +Test different prompts or models: |
| 118 | + |
| 119 | +``` |
| 120 | +/chats/assistant-v1/settings |
| 121 | +/chats/assistant-v2-friendly/settings |
| 122 | +``` |
| 123 | + |
| 124 | +## Next steps |
| 125 | + |
| 126 | +- Learn about [configuring index conversation settings](/reference/api/settings#conversation) |
| 127 | +- Explore [advanced prompt engineering](/guides/ai/prompt_engineering) |
| 128 | +- Implement [conversation history management](/guides/ai/conversation_history) |
0 commit comments