Examples¶
Hands-on Jupyter notebooks covering every major feature of Medha. Each notebook is self-contained and can be run locally or opened directly on GitHub.
git clone https://github.com/ArchAI-Labs/medha.git
cd medha
pip install "medha-archai[all]"
jupyter notebook demo/
Query Languages¶
| Notebook | Description |
|---|---|
| 01 — Text-to-SQL (SQLite) | End-to-end Text-to-SQL with a local SQLite database |
| 02 — Text-to-Cypher (Neo4j) | Graph query caching for Neo4j Cypher queries |
| 03 — Text-to-Query (MongoDB MQL) | MongoDB query caching with MQL |
| 10 — Text-to-SQL (DuckDB) | Analytical SQL caching with DuckDB |
Embedders¶
| Notebook | Description |
|---|---|
| 04 — Custom Embedder | Implement BaseEmbedder for any embedding provider |
| 07 — Cloud Embedders | OpenAI, Cohere, and Gemini embedding adapters |
| 05 — NER: spaCy vs GLiNER | Parameter extraction strategies for template matching |
Vector Backends¶
| Notebook | Description |
|---|---|
| 11 — InMemory Backend | Zero-dependency in-process caching |
| 24 — Qdrant Backend | Production-grade HNSW with Qdrant (memory / Docker / Cloud) |
| 12 — pgvector Backend | PostgreSQL-native vector search |
| 15 — VectorChord Backend | High-throughput PostgreSQL + VectorChord |
| 14 — Elasticsearch Backend | Full-text + vector search with Elasticsearch 8.x |
| 16 — Chroma Backend | Lightweight local vector store with ChromaDB |
| 17 — Weaviate Backend | Knowledge graph + vector search with Weaviate |
| 18 — Redis Vector Backend | Sub-millisecond semantic caching with Redis Stack |
| 19 — Azure AI Search Backend | Managed cloud vector search on Azure |
| 20 — LanceDB Backend | Embedded zero-infrastructure vector search |
Features & Patterns¶
| Notebook | Description |
|---|---|
| 06 — Production Patterns | Logging, retries, health checks, and deployment tips |
| 08 — Fuzzy Matching | Tier 4 Levenshtein fallback for typos and variants |
| 09 — Multi-Tenant Caching | Separate collections per tenant |
| 13 — Framework Integrations | LangChain, LlamaIndex, and Haystack integration |
| 21 — Cache Lifecycle | TTL, expiry, and invalidation strategies |
| 22 — Observability | Stats, latency percentiles, and logging |
| 23 — Batch Operations | Bulk ingestion, export to DataFrame, and dedup |
| 25 — Feedback Loop | Recording correct/incorrect signals and auto-invalidation |
| 26 — CLI | All medha CLI commands against an in-memory backend |