The RAG feature enhances the mod-ollama-chat module by providing bots with relevant contextual information from a knowledge base when responding to player messages. This allows bots to give more accurate, detailed, and informative responses about World of Warcraft game mechanics, professions, classes, and other topics.
- Knowledge Base: JSON files containing structured information about WoW topics
- Query Analysis: When a player sends a message, the system analyzes it for relevant keywords
- Information Retrieval: The system searches the knowledge base for related information
- Prompt Enhancement: Retrieved information is added to the bot's prompt before generating a response
- Contextual Responses: Bots can now provide detailed information about professions, classes, etc.
# Enable/disable the RAG feature
OllamaChat.EnableRAG = 1
# Path to RAG data files (relative to module data directory)
OllamaChat.RAGDataPath = rag/
# Maximum number of information items to retrieve
OllamaChat.RAGMaxRetrievedItems = 3
# Minimum similarity score for information to be considered relevant (0.0-1.0)
OllamaChat.RAGSimilarityThreshold = 0.3
# Template for including RAG information in prompts
OllamaChat.RAGPromptTemplate = "RELEVANT INFORMATION:\n{rag_info}\nUse this information to provide accurate and detailed responses when applicable."RAG data is stored in JSON files in the data/rag/ directory. Each file contains an array of entries with the following structure:
[
{
"id": "unique_identifier",
"title": "Display Title",
"content": "Detailed information about the topic",
"keywords": ["keyword1", "keyword2", "keyword3"],
"tags": ["tag1", "tag2"]
}
]- id: Unique identifier for the entry (used internally)
- title: Human-readable title for the information
- content: The detailed information that will be provided to the bot
- keywords: Array of keywords that help match queries to this information
- tags: Array of category tags for organization
Without RAG: Bot gives a generic response about professions With RAG: Bot provides detailed information about Alchemy, required skills, training locations, and key recipes
Without RAG: Generic class advice With RAG: Detailed information about different classes, their roles, strengths, and raid viability
- Create JSON files in
data/rag/directory - Follow the JSON structure above
- Use relevant keywords that players might use in queries
- Keep content concise but informative
- Test with various query patterns
- Include common misspellings
- Use both singular and plural forms
- Include related terms (e.g., "potions" for alchemy)
- Consider how players actually phrase questions
- Memory Usage: All RAG data is loaded into memory on startup
- Query Speed: Retrieval uses simple text similarity, very fast
- Token Limits: Retrieved information adds to prompt length
- Relevance Filtering: Similarity threshold prevents irrelevant information
- Check that
OllamaChat.EnableRAG = 1 - Verify JSON files exist in
data/rag/directory - Check server logs for RAG initialization messages
- Ensure JSON syntax is valid
- Adjust
OllamaChat.RAGSimilarityThreshold(lower = more results, higher = fewer but more relevant) - Add more keywords to your JSON entries
- Review query preprocessing logic
- Reduce
OllamaChat.RAGMaxRetrievedItems - Increase
OllamaChat.RAGSimilarityThreshold - Optimize JSON file sizes
See wow_professions.json for examples of profession information including:
- Alchemy (potions, elixirs, flasks)
- Blacksmithing (weapons, armor, tools)
- Enchanting (disenchanting, enchants)
- And more...
See wow_classes_factions.json for examples of:
- Class descriptions and roles
- Faction information and races
- Specializations and abilities
- Support for more advanced similarity algorithms
- Dynamic knowledge base updates
- Integration with external knowledge sources
- Multi-language support
- Category-based filtering