This guide explains how to set up and manage AI personas in Discourse, including configuration options, supported commands, and advanced features.
Required user level: Administrator
The Discourse AI bot includes a flexible system for managing AI personas. This guide covers:
- Interaction methods for AI personas
- Configuration options
- Advanced settings
- Supported commands
- Customization possibilities
Learn about the AI bot and how to enable it in this guide.
Interacting with AI personas
AI personas can be interacted with in multiple ways:
- Via a private message (PM)
- Via a chat direct message (DM)
- Via a mention in a public topic
Administrators can control which interaction methods are allowed for each persona.
Configuring AI personas
To configure AI personas, navigate to discourse.example.com/admin/plugins/discourse-ai/ai-personas
.
Key configuration options include:
- System prompt: Steers the conversation
- Vision support: Enable for GPT-4 Turbo and Anthropic Claude 3 models
- Default model: Required for mentionable personas
- Allowed groups: Define permissions using Discourse group security
- Uploads: Index text files for additional knowledge (using RAG - Retrieval-Augmented Generation)
- Enabled commands: Control access to specific commands
- Allow chat: Enable chat via DM (requires chat plugin, a default large language model (LLM), and a user)
Here’s a look at a complete AI persona configuration screen:
Advanced configuration options
The persona editor offers several advanced options:
- Temperature and top_p (nucleus sampling): Control creativity vs. predictability
- Max context posts: Limit the number of posts supplied to the LLM for history - fewer posts will reduce costs, but cause the AI to “forget” about older content
-
Upload options:
- Chunk tokens: Control document splitting
- Chunk overlap tokens: Set overlap between chunks
- Search conversation chunks: Number of document fragments added to user queries
- Question consolidator LLM: Choose the LLM for determining user questions
Prerequisites for upload support
To use upload support:
- Enable the
ai_embeddings_enabled
setting - Configure an
ai_embeddings_model
Discourse AI supports various embedding models. Hosted customers get free access to the bge-large-en model.
Self-hosters or people wanting more choice can self host an embedding model or use models by Open AI, Google (Gemini), and more.
Text splitting in Discourse AI
Discourse uses a Recursive Character Text Splitter to keep paragraphs, lines, and words together when splitting text. You can control text splitting using the [[metadata YOUR METADATA HERE]]
separator:
[[metadata about cats]]
a long story about cats
[[metadata about dogs]]
a long story about dogs
This method prevents “chunk contamination” by ensuring only relevant data is included in each chunk.
Debugging AI personas
To debug your persona:
- Add users to the group specified in the
ai bot debugging enabled groups
setting - Users in this group will see an AI debugging button at the bottom of AI posts
- Click the button to access the debugging UI modal
Remember: If you provide vague or unhelpful information to an LLM, it will have great difficulty converting it into useful information.
Supported commands
Discourse AI supports various commands, including:
- Categories
- Tags
- Search
- Web Browser
- GitHub integration (Search Code, Pull Request Diff, File Content)
- Requires the
ai bot github access token
setting to be filled
- Requires the
- Search Meta Discourse
- Random Picker
- Read
- Time
- Google search
- Requires the
ai google custom search api key
andai google custom search cx
settings to be filled
- Requires the
- Image generation via DALL-E
- Requires an open_ai key
- Image generation via Stable Diffusion
- Requires the
ai stability api key
setting to be filled - The
ai stability engine
setting controls the image generation algorithm
- Requires the
- Schema
- Search Settings
- Setting Context
Some commands require additional configuration or API keys.
Custom tool support
You can create your own tools using custom tool support.
Customizing existing personas
To customize a system persona:
- Create a new persona
- Copy and paste the system prompt from the persona you wish to customize
- Modify as needed
- Optionally disable the original system persona to avoid duplication
Customizing search
To customize search for a new persona:
- Create a new persona
- Add the “search” command
- Configure search options, including:
- Base search query
- Maximum number of search results
- Include private topics option
This allows you to delegate search permissions, increase the number of results, or restrict search to specific sections of your site.
Additional resources
Last edited by @hugh 2024-08-06T02:05:20Z
Check document
Perform check on document: