RagLeap
Guide

Migration Guide

Moving from LangChain or LlamaIndex? The full guide with 5 real, runnable
side-by-side comparisons lives at
MIGRATION.md
in the repo root. This page is a short teaser.

What's covered in the full guide

  1. Basic ingest + query — LangChain/LlamaIndex need a text splitter,
    embedding client, vectorstore, and chain/query-engine assembled
    separately; ragleap-rag is one RagLeap(...) object.
  2. Provider fallback — LangChain has no first-class automatic
    fallback between providers; ragleap-rag has fallbacks= built in,
    plus result["provider_used"] to know which one actually answered.
  3. Cost tracking — real per-call cost, monthly budgets, and
    automatic downgrade to a cheaper fallback when a budget is hit.
  4. Swapping vector backends — one line changes
    (vector_backend=FAISSBackend(...) vs PgVectorBackend(...)), rest of
    your ingest/query code is identical.
  5. What you gain vs. give up — an honest comparison table, including
    where LangChain's larger ecosystem still wins (600+ integrations vs.
    ragleap-rag's 8 embedding providers + 6 vector backends).

Quick taste

# Before (LangChain): splitter, embeddings, vectorstore, chain — 4 objects
# After (ragleap-rag):
from ragleap import RagLeap, ProviderConfig, EmbeddingConfig
rag = RagLeap(
    database_url="postgresql://user:pass@localhost:5432/mydb",
    primary=ProviderConfig(provider="gemini", model="gemini-3.6-flash", api_key="..."),
    embedder=EmbeddingConfig(provider="gemini", model="models/gemini-embedding-001",
                              dimensions=3072, api_key="..."),
)
rag.init_schema()
rag.ingest_text(filename="doc.txt", text=raw_text)
answer = rag.ask("What is the budget?")

A note on accuracy

LangChain's and LlamaIndex's APIs change fairly often between versions.
The comparisons in the full guide reflect patterns that have been broadly
stable, but verify against your own installed versions before relying on
them for a real migration.

Read the full guide: MIGRATION.md

This page mirrors the GitHub wiki page. The wiki is the source of truth and may be newer.

Back to the blog