OPEN-SOURCE RAG ENGINE

Document Q&A,
routed intelligently.

OptiRAG retrieves the right passages, reuses semantically similar answers, and selects a model based on query complexity.

REQUEST FLOWOPTIMIZED
◈Question embeddingBGE SMALL
ϟSemantic cacheHIT → ANSWER
CACHE MISS
≡Vector retrievalCHROMADB
⑂Model routerCOMPLEXITY
GPT-OSS 20BGPT-OSS 120B

Low evidence, abstention, or missing citations can trigger escalation from 20B to 120B.

LIVE DEMO

Inspect a live request

Ask about OptiRAG’s documentation and follow the backend as it processes your question.

Query console Checking backend

The backend logs questions and may send them to the model provider. Repeat a successful optimized query to check the cache.

Pipeline trace

Run a query to see the cache decision, retrieved passages, model selection, and timings here.

    RECORDED BENCHMARK

    Performance, in context

    Compare the optimized pipeline with the baseline, which retrieves passages and always uses the large model.

    Loading the recorded benchmark…

    UNDER THE HOOD

    How OptiRAG works

    FastAPI runs the pipeline. ChromaDB stores vectors and cached answers. SQLite records request metrics.

    Grounded retrieval

    Embed document chunks with BGE, retrieve by cosine similarity, and pass excerpts with document and page labels to the model.

    Semantic caching

    Reuse an answer when a question clears the similarity threshold. Tenant, corpus version, and expiry determine which entries are eligible.

    Cost-aware routing

    Use rules or an LLM classifier to choose a model tier. Retry a small-model answer on the large model if it fails the retrieval or answer checks.