RagLeap
PyPI package

ragleap-rag

version — loading live from PyPI…

Self-hosted RAG engine: hybrid dense+sparse retrieval, 28-format ingestion, 6 vector backends, 8 embedding providers, 12+ generation providers with automatic fallback.

pypi license
pip install ragleap-rag[gemini]

Highlights

  • Query rewriting: HyDE, contextual, multi-query
  • Structured JSON output mode
  • Real per-call cost tracking, not estimates
  • Standalone retrieval via retrieve() — no full app required
  • Composable with ragleap-graph for knowledge-graph-augmented retrieval
  • New in 0.15.0 (from its changelog): Python 3.10 is no longer supported (requires-python is now >=3.11); a cheaperinference provider base URL; evaluation with ranking metrics (hit@k, recall@k, precision@k, reciprocal rank and nDCG@k) for cases that list relevant_documents (RagLeap.evaluate()). Fixed: answer["sources"] now lists each document once, in the order its first chunk was sent to the model

Tech stack

Core dependencies: psycopg2-binary, requests, pypdf, python-docx, tiktoken

Optional extras:

  • gemini
  • anthropic
  • openai
  • faiss
  • pinecone
  • weaviate
  • qdrant
  • milvus
  • rerank
  • ocr
  • formats
  • web

Testing

341 test functions across 34 test files, verified directly from the repo.

Quickstart

from ragleap import RagLeap, ProviderConfig, EmbeddingConfig

rag = RagLeap(
    database_url="postgresql://user:pass@localhost/mydb",
    embedder=EmbeddingConfig(provider="gemini", model="models/gemini-embedding-001", dimensions=3072, api_key="your-gemini-key"),
    primary=ProviderConfig(provider="gemini", model="gemini-3.6-flash", api_key="your-gemini-key"),
)
rag.init_schema()
rag.ingest_text("handbook.txt", "Employees get unlimited PTO.")
answer = rag.ask("How much PTO do employees get?")
print(answer["answer"])
Full documentation PyPI page Source