Skip to main content

Creating Chatbots

Configure and create chatbots with custom personalities and knowledge base access.

Create via Web Interface

  1. Navigate to Chatbots in the sidebar
  2. Click Create Chatbot
  3. Fill in the configuration form

Configuration Options

Basic Settings

FieldDescriptionExample
NameUnique identifier for your chatbotSupport Bot
ModelLLM model to usegpt-3.5-turbo, gpt-4
Chatbot TypeBehavior patterngeneral, support, creative

Personality & Prompts

FieldDescriptionExample
System PromptDefines personality and behavior"You are a helpful support agent."
TemperatureCreativity level (0.0-2.0)0.7 for balanced
Fallback ResponseDefault message when RAG finds nothing"I'm not sure about that."
ToneSpeaking styleprofessional, casual, friendly

Knowledge Base (RAG)

FieldDescriptionExample
Use RAGEnable document searchTrue/False
RAG CollectionDocument collection to searchdocs_collection
Top KNumber of documents to retrieve5
Similarity ThresholdMinimum relevance score0.7

Advanced Settings

FieldDescriptionDefault
Max TokensMaximum response lengthModel default
Memory LengthConversation history length10 messages
StreamingEnable streaming responsesFalse

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 CaseRecommended 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 TypeRecommended Top K
FAQs (short answers)3-5
Documentation (detailed)5-10
Mixed content5-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/search directly

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_length in configuration
  • Check conversation ID is passed correctly
  • Ensure same conversation_id is used in requests

Next Steps