# Create chat for this user sessionsession_chat = hippo.create_chat( folder.id, f"Session {session_id} - {datetime.now()}")# ... ask questions ...# Clean up after session endshippo.delete_chat(session_chat.id)
Benefit: Automatic cleanup of temporary conversations
Department Chats
Chats for different teams accessing same docs:
Copy
departments = ["Sales", "Support", "Engineering"]for dept in departments: chat = hippo.create_chat( product_docs_folder.id, f"{dept} Team Chat" )
Chat sessions maintain context for follow-up questions:
Copy
# First questionanswer1 = hippo.submit_ask( chat.id, "What is the API rate limit?")# Answer: "The API rate limit is 1000 requests per hour..."# Follow-up question (chat remembers previous context)answer2 = hippo.submit_ask( chat.id, "How can I increase it?" # "it" refers to rate limit from Q1)# Answer: "To increase your rate limit, contact support..."# Another follow-upanswer3 = hippo.submit_ask( chat.id, "What's the process for that?" # "that" refers to Q2)# Answer: "The process for increasing rate limits is..."
Context window: Chats remember the last 10 Q&A exchanges for context.
# Get full Q&A historyasks = hippo.get_asks(chat_id=chat.id)print(f"Chat history ({len(asks)} Q&A):\n")for i, ask in enumerate(asks, 1): print(f"{i}. Q: {ask.question}") print(f" A: {ask.response}") print(f" Sources: {len(ask.sources)}\n")
from cerevox import Hippohippo = Hippo(api_key="your-api-key")# 1. Create knowledge basesupport_folder = hippo.create_folder( "Customer Support Docs", "FAQs, troubleshooting, and product guides")# 2. Upload support documentsdocs = [ "faq.pdf", "troubleshooting-guide.pdf", "product-manual.pdf"]for doc in docs: hippo.upload_file(support_folder.id, doc)# 3. Create chats for different purposeschats = {}# General support chatchats['general'] = hippo.create_chat( support_folder.id, "General Support")# Technical support chatchats['technical'] = hippo.create_chat( support_folder.id, "Technical Support")# Billing inquiries chatchats['billing'] = hippo.create_chat( support_folder.id, "Billing Support")# 4. Route questions to appropriate chatdef ask_support(question, category='general'): chat_id = chats[category].id answer = hippo.submit_ask(chat_id, question) print(f"Category: {category}") print(f"Q: {question}") print(f"A: {answer.response}\n")# Use the systemask_support("How do I reset my password?", "general")ask_support("Why is the API returning 500 errors?", "technical")ask_support("How do I update my payment method?", "billing")
Good: “Customer Support - Authentication Issues”
Bad: “Chat 1”, “Test”, “Untitled”Clear names help identify chats when you have many.
Clean Up Unused Chats
Copy
# Delete old or test chatschats = hippo.get_chats(folder_id)for chat in chats: if "test" in chat.name.lower() or chat.message_count == 0: hippo.delete_chat(chat.id) print(f"Deleted: {chat.name}")
Keep your workspace organized by removing unused chats.
Isolate User Conversations
Don’t share chats across users:
Copy
# Bad: Shared chat for all usersshared_chat = hippo.create_chat(folder.id, "Everyone")# Good: Individual chats per useruser_chat = hippo.create_chat( folder.id, f"User {user_id}")
Individual chats prevent context confusion and protect privacy.
Consider Chat Lifecycle
Temporary chats (delete after session):
Copy
chat = hippo.create_chat(folder.id, f"Session {session_id}")# ... use chat ...hippo.delete_chat(chat.id)
Permanent chats (keep for history):
Copy
chat = hippo.create_chat(folder.id, f"Customer {customer_id}")# Keep for entire customer relationship