Adding Knowledge to Your Chatbot
Let's enhance our Virtual Fan Zhongyan by adding specific knowledge from Chinese literature!
Step 1: Access the Control Panel
Click the blue toggle button on the right side of the chat interface to open the control panel.
Step 2: Configure Bot Settings
The control panel allows you to customize various aspects of your chatbot:
Basic Settings
- Upload or change bot icon
- Modify bot name
- Switch language models
Advanced Parameters
You can fine-tune your bot's behavior using these parameters:
Parameter | Range | Description | Recommended Value |
---|---|---|---|
Temperature | 0.0 - 1.0 | Controls randomness. Higher values make output more creative but less focused | 0.7 |
Top P | 0.0 - 1.0 | Nucleus sampling parameter. Controls diversity of responses | 0.9 |
Frequency Penalty | 0.0 - 2.0 | Reduces repetition by penalizing frequently used words | 0.0 |
Presence Penalty | 0.0 - 2.0 | Encourages discussing new topics by penalizing used topics | 0.0 |
Max Tokens | 100 - 4000 | Maximum length of response | 2000 |
Step 3: Add Knowledge Base Files
Scroll down to the "Knowledge Base Files" section where you can upload documents to enhance your bot's knowledge:
-
Supported Formats
- PDF files
- Word documents (.doc, .docx)
- Text files (.txt)
-
Upload Process
- Click the upload area
- Select your document (in this example, we'll use "岳陽樓記.pdf")
- Wait for processing and embedding
Step 4: Review Document Chunks
After uploading, you can review how the document has been processed:
- Click the "eye" icon next to your uploaded document
- Review the chunks created from your document
- Each chunk represents a segment that can be retrieved by the RAG system
Step 5: Test Your Enhanced Bot
Now you can test your bot's new knowledge:
- Ask about the uploaded content Example: "What do you know about 岳陽樓記?"
- The bot will combine its base knowledge with the uploaded content
- Responses will include specific references and quotes from the document
How It Works
When you ask a question:
- The system searches through the embedded chunks of your uploaded documents
- Relevant chunks are retrieved based on semantic similarity
- The bot combines these chunks with its base knowledge to create comprehensive answers
- The response maintains the bot's character while incorporating specific knowledge from your documents
Tips for Better Results
-
Document Quality
- Use clear, well-formatted documents
- Ensure text is properly recognized (especially for scanned PDFs)
-
Chunking Strategy
- Review the chunks to ensure they make sense
- Upload multiple related documents for broader context
-
Query Formulation
- Ask specific questions
- Reference key terms from the documents
What's Next?
Now that you've implemented RAG, you can:
- Add more Chinese literature documents
- Fine-tune the model parameters
- Create specialized knowledge bases for different topics