Session Management#
Sessions are the foundation of Shadai. They organize your documents, maintain conversation context, and enable powerful multi-document workflows.What is a Session?#
A session is a container that holds:π Documents - Your ingested files
π¬ Chat history - All questions and answers
π§ Context - Conversation memory
βοΈ Configuration - Session-specific settings
Think of a session as a workspace for a specific project or topic.Session Types#
Named Sessions (Persistent)#
Perfect for ongoing projects:Working on ongoing projects
Building up knowledge over time
Collaborating with team members
Temporal Sessions (Auto-Delete)#
Perfect for one-off queries:Use temporal sessions when:Creating Sessions#
Basic Session Creation#
Session Naming Best Practices#
Model Configuration#
You can configure which LLM and embedding models your session uses. This allows you to choose the best model for your specific use case based on performance, cost, and capabilities.Specifying Models#
Available Models#
OpenAI: GPT-5, GPT-4.1, GPT-4o series
Azure: Same models via Azure deployment
Anthropic: Claude Sonnet 4.5, Claude Opus 4, Claude Haiku 3.5
Google: Gemini 2.5 Pro, Gemini 2.0 Flash series
Embedding Models (5 options):OpenAI: text-embedding-3-large, text-embedding-3-small
Azure: Same embeddings via Azure
Google: gemini-embedding-001
Model Selection Examples#
Cost-Effective Setup#
Creative Tasks#
Mixed Providers#
Enterprise (Azure)#
System Prompts#
Customize your session's behavior with system prompts:Model Selection Best Practices#
Choose your LLM based on:Task complexity: GPT-4o/Claude Opus for complex reasoning, Gemini Flash for simple tasks
Speed requirements: Gemini Flash models are fastest
Cost constraints: Google models generally most cost-effective
Specific capabilities: Claude for creative work, GPT-4 for technical analysis
Choose your embedding model based on:Quality needs: text-embedding-3-large for best retrieval accuracy
Speed/cost: text-embedding-3-small or Gemini embeddings for efficiency
Provider alignment: Match with your LLM provider when possible
Be specific about role and expertise
Include output format preferences
Mention any constraints or guidelines
Keep it concise but comprehensive
Session Lifecycle#
1. Session Creation#
π Checks if session exists
β¨ Creates new if doesn't exist
π Loads existing data if exists
2. Adding Documents#
Documents are cumulative - new ingestions add to existing documents.3. Querying#
Searches ALL documents in session
Maintains conversation history
4. Session Cleanup#
Working with Multiple Sessions#
Pattern 1: Sequential Processing#
Pattern 2: Parallel Processing#
Pattern 3: Hierarchical Sessions#
Session Management Operations#
Get Session History#
Clear Session History#
Important: This clears chat history but keeps documents!Memory Management#
Memory Enabled (Default)#
Memory Disabled#
Use use_memory=False when:Queries are completely independent
Want to avoid context pollution
Best Practices#
β
Do This#
β Don't Do This#
Common Patterns#
Pattern: Session Per Project#
Pattern: Session Per User#
Pattern: Session Per Topic#
Troubleshooting#
Session Not Found#
Lost Session Data#
If using temporal sessions, data is deleted on exit:Memory Overflow#
If conversation history gets too long:Next Steps#
Questions? Check out the API Reference for complete documentation.Modified atΒ 2025-10-21 05:35:09