from ai_infra.retriever import RetrieverSemantic search made simple. The Retriever automatically handles: - Embedding generation (via any provider) - Text chunking for long documents - File loading (PDF, DOCX, TXT, CSV, JSON, HTML) - Directory scanning - Vector storage and search Progressive complexity: - Zero-config: `Retriever()` uses memory storage and auto-detected embeddings - Simple: `Retriever(backend="postgres", connection_string="...")` - Advanced: Pass your own `Embeddings` instance for full control Example - Dead simple: >>> r = Retriever() >>> r.add("Your text here") >>> r.add("./documents/") # Add all files from a directory >>> results = r.search("query") # Returns list of strings Example - Production with PostgreSQL: >>> r = Retriever( ... backend="postgres", ... connection_string="postgresql://user:pass@localhost/db", ... ) >>> r.add("./knowledge_base/") >>> results = r.search("query", detailed=True) # Returns SearchResult objects Example - LLM context generation: >>> r = Retriever() >>> r.add("./docs/") >>> context = r.get_context("user question", k=5) >>> prompt = f"Context:\n{context}\n\nQuestion: {question}"