Creating Chatbots
Configure and create chatbots with custom personalities and knowledge base access.
Create via Web Interface
- Navigate to Chatbots in the sidebar
- Click Create Chatbot
- Fill in the configuration form
Configuration Options
Basic Settings
| Field | Description | Example |
|---|---|---|
| Name | Unique identifier for your chatbot | Support Bot |
| Model | LLM model to use | gpt-3.5-turbo, gpt-4 |
| Chatbot Type | Behavior pattern | general, support, creative |
Personality & Prompts
| Field | Description | Example |
|---|---|---|
| System Prompt | Defines personality and behavior | "You are a helpful support agent." |
| Temperature | Creativity level (0.0-2.0) | 0.7 for balanced |
| Fallback Response | Default message when RAG finds nothing | "I'm not sure about that." |
| Tone | Speaking style | professional, casual, friendly |
Knowledge Base (RAG)
| Field | Description | Example |
|---|---|---|
| Use RAG | Enable document search | True/False |
| RAG Collection | Document collection to search | docs_collection |
| Top K | Number of documents to retrieve | 5 |
| Similarity Threshold | Minimum relevance score | 0.7 |
Advanced Settings
| Field | Description | Default |
|---|---|---|
| Max Tokens | Maximum response length | Model default |
| Memory Length | Conversation history length | 10 messages |
| Streaming | Enable streaming responses | False |
Step-by-Step Creation
Step 1: Basic Information
response = requests.post(
"http://localhost/api/v1/chatbot/create",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"name": "Customer Support Bot",
"model": "gpt-3.5-turbo",
"chatbot_type": "support"
}
)
chatbot = response.json()
print(f"Created chatbot with ID: {chatbot['id']}")
Step 2: Configure Personality
response = requests.post(
"http://localhost/api/v1/chatbot/create",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"name": "Support Bot",
"model": "gpt-3.5-turbo",
"system_prompt": "You are a professional customer support agent. Be concise and helpful. Always acknowledge the user's issue before providing a solution.",
"temperature": 0.5,
"fallback_responses": [
"I don't have information about that.",
"Could you please provide more details?",
"Let me connect you with a human agent."
]
}
)
chatbot = response.json()
Step 3: Enable RAG
response = requests.post(
"http://localhost/api/v1/chatbot/create",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"name": "Support Bot",
"model": "gpt-3.5-turbo",
"use_rag": True,
"rag_collection": "documentation",
"rag_top_k": 3,
"similarity_threshold": 0.6
}
)
Note: RAG collection must exist before enabling RAG. See RAG Documentation.
Step 4: Complete Configuration
response = requests.post(
"http://localhost/api/v1/chatbot/create",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"name": "Comprehensive Support Bot",
"model": "gpt-4",
"chatbot_type": "support",
" Personality
"system_prompt": "You are a professional customer support agent for Acme Corp. Help users with product questions, troubleshooting, and account issues. Be polite, concise, and solution-oriented.",
"temperature": 0.3,
"fallback_responses": [
"I'm unable to answer that question.",
"Would you like me to transfer you to a human agent?",
"I can help with billing, technical support, and account questions."
],
# RAG Settings
"use_rag": True,
"rag_collection": "product_docs",
"rag_top_k": 5,
"similarity_threshold": 0.7,
# Advanced
"max_tokens": 1000,
"memory_length": 20
}
)
chatbot_id = response.json()["id"]
print(f"Chatbot created: {chatbot_id}")
Best Practices
System Prompt Design
Good:
"You are a customer support agent. Help users resolve their issues efficiently."
Avoid:
"You are an AI assistant. Please be helpful and friendly." # Too generic
"As a sophisticated language model, I will assist users..." # Too academic
Temperature Settings
| Use Case | Recommended Temperature |
|---|---|
| Factual responses (support, documentation) | 0.1-0.5 |
| Balanced (general purpose) | 0.6-0.8 |
| Creative (brainstorming, content) | 0.9-1.5 |
RAG Configuration
| Document Type | Recommended Top K |
|---|---|
| FAQs (short answers) | 3-5 |
| Documentation (detailed) | 5-10 |
| Mixed content | 5-7 |
Examples
Customer Support Bot
response = requests.post(
"http://localhost/api/v1/chatbot/create",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"name": "Support Bot",
"model": "gpt-3.5-turbo",
"system_prompt": "You are a helpful customer support agent. Use the knowledge base to answer questions accurately. If you don't know, say so honestly.",
"temperature": 0.3,
"use_rag": True,
"rag_collection": "support_docs"
}
)
Internal FAQ Bot
response = requests.post(
"http://localhost/api/v1/chatbot/create",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"name": "Internal FAQ Bot",
"model": "gpt-3.5-turbo",
"system_prompt": "You answer questions about internal company policies, benefits, and procedures. Be direct and concise.",
"temperature": 0.2,
"use_rag": True,
"rag_collection": "hr_docs",
"rag_top_k": 3,
"similarity_threshold": 0.8
}
)
Creative Assistant
response = requests.post(
"http://localhost/api/v1/chatbot/create",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"name": "Creative Assistant",
"model": "gpt-4",
"system_prompt": "You are a creative writing assistant. Help users brainstorm ideas, improve content, and explore new perspectives.",
"temperature": 1.2,
"use_rag": False
}
)
Troubleshooting
Chatbot Not Using RAG
Problem: Chatbot doesn't reference documents
Solutions:
- Verify RAG is enabled in configuration
- Check RAG collection name is correct
- Ensure documents are uploaded to the collection
- Test search with
/api/v1/rag/searchdirectly
Responses Too Generic
Problem: Chatbot gives generic answers
Solutions:
- Lower temperature (0.2-0.5) for factual responses
- Improve system prompt specificity
- Increase RAG top_k to provide more context
- Add relevant fallback responses
Memory Issues
Problem: Chatbot forgets earlier messages
Solutions:
- Increase
memory_lengthin configuration - Check conversation ID is passed correctly
- Ensure same conversation_id is used in requests
Next Steps
- Chat with Your Chatbot - Start interacting
- Manage Chatbots - Update and organize
- Examples - Code samples
- RAG Documentation - Build your knowledge base