Skip to main content
Pipeline helpers wrap multiple SDK stages into a single call. Use them for quick setup or when you don’t need to inspect intermediate results.

ingest()

Runs ingestion → chunking → embedding → storing.
from ragrails import RagRails

result = RagRails().ingest(
    docs=["files/guide.pdf"],
    embedding={"provider": "voyage", "model": "voyage-3"},
    storage={
        "vector_db": "qdrant",
        "collection": "docs",
        "url": "http://localhost:6333",
    },
)

result.sources   # source documents ingested
result.chunks    # chunks produced
result.embedded  # chunks embedded
result.stored    # chunks stored
result.failed    # total failures
result.errors    # list of error dicts
All four sources can be combined:
result = RagRails().ingest(
    docs=["files/guide.pdf"],
    urls=["https://example.com/docs"],
    api={"url": "https://api.example.com/posts", "title": "Posts"},
    markdown="# Inline note\n\nSome additional context.",
    chunking={"chunk_size": 1000, "chunk_overlap": 100},
    embedding={"provider": "voyage", "model": "voyage-3"},
    storage={"vector_db": "qdrant", "collection": "docs", "url": "http://localhost:6333"},
)

Parameters

ParameterTypeDescription
docsstr | list | dictDocument files or folder, passed to parse()
urlsstr | list | dictURLs to scrape, passed to scrape()
apistr | list | dictAPI endpoints, passed to fetch()
markdownstr | listRaw markdown documents
ingestiondictIngestor config overrides
chunkingdictChunking config e.g. {"chunk_size": 1000}
embeddingdictEmbedding config e.g. {"provider": "voyage", "model": "voyage-3"}
storagedictStorage config e.g. {"vector_db": "qdrant", "collection": "docs", "url": "..."}

query()

Runs query embedding → retrieval.
result = RagRails().query(
    "What does the guide cover?",
    embedding={"provider": "voyage", "model": "voyage-3"},
    retrieval={
        "vector_db": "qdrant",
        "collection": "docs",
        "url": "http://localhost:6333",
        "top_k": 5,
    },
)

for chunk in result.items:
    print(chunk.score, chunk.text)
With reranking:
result = RagRails().query(
    "What does the guide cover?",
    embedding={"provider": "voyage", "model": "voyage-3"},
    retrieval={
        "vector_db": "qdrant",
        "collection": "docs",
        "url": "http://localhost:6333",
        "top_k": 20,
        "rerank": {"enabled": True, "provider": "voyage", "model": "rerank-2-lite", "top_k": 5},
    },
)

Parameters

ParameterTypeDescription
querystrSearch query
embeddingdictEmbedding config; all embedder() params
retrievaldictRetrieval config; all retrieve() params, plus query_rewrite and rerank sub-dicts