Understanding Shadai's architecture helps you build better applications and troubleshoot effectively.High-Level Overview#
Your Application
↓
Shadai Python Client (SDK)
↓
REST API (Shadai Server)
↓
┌──────────────────────────────────┐
│ RAG Engine │
│ ├─ Document Processing │
│ ├─ Vector Search │
│ ├─ LLM Integration │
│ └─ Memory Management │
└───────────── ─────────────────────┘
Client-Server Architecture#
Python Client (Your Code)#
The Shadai client is what you interact with:Shadai Server (Backend)#
The server handles all heavy lifting:Core Components#
1. Sessions#
Sessions are isolated workspaces:Isolated from other sessions
Tools are specialized capabilities:| Tool | Purpose | Use Case |
|---|
| Query | Search documents | "What does the contract say?" |
| Summarize | Overview of all docs | "Give me the executive summary" |
| Web Search | Current information | "Latest industry news" |
| Engine | Multi-tool orchestration | "Compare docs with trends" |
| Agent | Custom tool execution | "Analyze with my tools" |
3. Memory System#
Memory enables context-aware conversations:Maintains conversation thread
4. Vector Store#
Documents are converted to searchable vectors:Your PDF → Text Chunks → Embeddings → Vector Database
Your Question → Embedding → Vector Search → Relevant Chunks → LLM → Answer
Data Flow#
Document Ingestion#
1. Upload File
↓
2. Server Processes
- Extracts text
- Splits into chunks
- Creates embeddings
↓
3. Stores Vectors
↓
4. Returns Success
Query Execution#
1. Send Question
↓
2. Server Processes
- Creates question embedding
- Searches vectors
- Retrieves top matches
- Prompts LLM with context
↓
3. Streams Response
↓
4. Saves to Memory
Communication Protocol#
Request/Response Flow#
Authentication#
Every request includes your API key:Server validates and processes request.Client-Side#
Async/await for concurrency
Example - Parallel Queries:Server-Side#
The server is optimized for:Efficient embedding generation
Concurrent request handling
You don't need to worry about:Security Model#
Authentication#
API key-based authentication
Keys are account-specific
Data Isolation#
Documents not shared between accounts
Embeddings are account-specific
Transport Security#
Limitations & Constraints#
File Size#
Session Limits#
No hard limit on sessions
Organize sessions logically
Use temporal sessions for one-off queries
Rate Limiting#
Concurrent requests allowed
Contact support for enterprise needs
Memory#
Conversation history accumulates
Clear periodically if needed
Best Practices#
✅ Do This#
❌ Don't Do This#
Troubleshooting#
Slow Responses#
Large documents (more context to process)
Use temporal sessions for quick queries
Memory Issues#
Long conversation history
Many messages accumulated
Connection Errors#
Verify internet connection
Next Steps#
Remember: The client is your interface. The server handles all complexity. Focus on building great applications! Modified at 2025-10-17 17:47:10