Source Code:
src/gaia/rag/sdk.pyComponent: RAGSDK - Document Q&A with RAG
Module:
gaia.rag.sdk
Import: from gaia.rag.sdk import RAGSDK, RAGConfig, RAGResponse, quick_ragOverview
RAGSDK provides document retrieval and Q&A capabilities using Retrieval-Augmented Generation (RAG). It supports PDF, text, CSV, JSON, and code files with intelligent chunking, VLM-enhanced image extraction, and vector search via FAISS. Key Features:- Multi-format support (PDF, TXT, MD, CSV, JSON, code files)
- VLM-based image text extraction from PDFs
- Intelligent semantic chunking
- Hardware-accelerated embeddings (NPU/GPU via Lemonade)
- Per-file search optimization
- Automatic caching with content hashing
- LRU memory management
API Specification
RAGConfig
RAGResponse
RAGSDK
Quick Function
Usage Examples
Example 1: Basic Document Q&A
Example 2: Multi-Document Search
Example 3: Code Documentation
Testing Requirements
Dependencies
Acceptance Criteria
- RAGSDK class implemented
- Multi-format file support working
- VLM image extraction functional
- Vector indexing with FAISS works
- Semantic chunking preserves context
- Per-file search optimization working
- Cache system with content hashing
- LRU memory management functional
- All unit tests pass (8+ tests)
- Performance acceptable (less than 3s per page)
- Documentation complete
RAGSDK Technical Specification