pip install ragleap-rag library. For the hosted business platform (AI Office, WhatsApp/Voice bots, billing), see docs.ragleap.com instead.
ragleap-rag
A narrow, opinionated hybrid retrieval engine — six vector backends, eight embedding providers, twelve-plus generation providers, one honest package.
Install
Requires Python 3.9+. Vector backends beyond PgVector, and non-default embedding providers, are optional extras.
pip install ragleap-rag # or, with uv uv add ragleap-rag
Quick start
from ragleap import RagLeap, ProviderConfig, EmbeddingConfig
rag = RagLeap(
database_url="postgresql://...",
primary=ProviderConfig(provider="gemini", api_key="..."),
embedder=EmbeddingConfig(provider="gemini", api_key="..."),
)
rag.init_schema()
rag.ingest("report.pdf")
answer = rag.ask("What were Q3's key findings?")
chunks = rag.retrieve("What were Q3's key findings?", top_k=5) # new in v0.12.0, no generation
Full public API surface
Confirmed via direct source reading during this session's full audit — not via inspect().
from ragleap import RagLeap, ProviderConfig, EmbeddingConfig, TranscriptionConfig
from ragleap.vectorstores import (
VectorBackend, PgVectorBackend, FAISSBackend,
PineconeBackend, WeaviateBackend, QdrantBackend, MilvusBackend,
)
from ragleap.guardrails import GuardrailViolation
from ragleap.query_rewrite import contextual_rewrite, hyde_document, multi_query_variants, reciprocal_rank_fusion
from ragleap.structured import parse_and_validate, parse_and_validate_object
from ragleap.cost import CostTracker, compute_cost, SEED_PRICING_TABLE
Ingestion
rag.ingest(path)rag.ingest_text(text)rag.ingest_url(url)rag.ingest_image(path)rag.ingest_audio(path)rag.ingest_video(path)Query
rag.ask(query, ...)rag.ask_stream(query, ...)ask(). Does not report token usage — each provider streams differently.rag.retrieve(query, top_k=5, hybrid=True, rerank=False, metadata_filter=None)ask()'s exact retrieval pipeline, stopping before generation. Does not support query_rewrite= or session_id= — those need LLM calls ask() owns.rag.evaluate(test_cases)Document management
rag.list_documents()rag.delete_document(id)rag.update_document(id, ...)rag.get_history() / rag.clear_session()ask() calls.rag.cache_stats()Async
aingest* / aask / aask_stream / ingest_batchretrieve() — why it exists
Added specifically so ragleap-graph's GraphRetriever could reach chunk-level retrieval without touching RagLeap's private internals (_vector_backend, _embed_query_cached()) across a package boundary. Shipped as a proper, tested, public method instead.
chunks = rag.retrieve(
query: str,
top_k: int = 5,
hybrid: bool = True,
rerank: bool = False,
metadata_filter: Optional[Dict] = None,
) -> List[Dict]
6 new tests shipped with this method, including one that makes the generator raise if called — proving retrieve() never triggers generation.
Provider & backend counts
Every count below was cross-checked against real code this session, not carried forward from marketing copy.
⚠ not live-verified Pinecone, Weaviate, Qdrant, and Milvus backends, and Mistral/Together/Cohere/Voyage embeddings, are code-complete but have no real test account available. Labeled honestly in each module's own docstring.
Known limitations
Drawn from the package's own docstrings, plus two findings from this session's full audit — neither fixed yet.
- not fixedtoken_count is word-count, not real LLM tokenization.
chunker.py's_tokenize()does a whitespace split. Consistent acrosschunker.py,schema.py's DDL, and all 6 vector backends — internally consistent, just not what the field name implies. - not fixedMilvus's
similarity_scoremay not be normalized like the other 5 backends. PgVector/FAISS/Pinecone return true cosine similarity; Weaviate converts distance→similarity; Milvus returns raw distance directly. - ask_stream() reports no token usage — each provider streams differently.
- MAX_CONTEXT_CHARS is a char-count approximation, not exact tokenization.
- Hybrid search's ranking-quality improvement is unverified beyond fusion-math correctness.
- Whisper transcription accuracy varies by language.
Metadata corrections
v0.12.1 — The first-draft v0.12.0 PyPI description claimed "knowledge-graph integration via ragleap-graph" — backwards. ragleap-rag has zero dependency on or awareness of ragleap-graph; it's the other way around. Caught before the session moved on and published as a metadata-only patch, along with removing a "neo4j" keyword that implied a dependency that doesn't exist.
v0.12.2 — The PyPI Documentation URL pointed to docs.ragleap.com, the commercial platform's docs, which have zero content about this package. Corrected to point to this reference page instead.