1. Install
pip install "ragrails[voyage,openai,qdrant]"
export VOYAGE_API_KEY="..."
export OPENAI_API_KEY="..."
docker run -p 6333:6333 qdrant/qdrant
2. Build the index
from ragrails import RagRails
rag = RagRails()
rag.ingest(
docs=["files/guide.pdf"],
embedding={"provider": "voyage", "model": "voyage-3"},
storage={"vector_db": "qdrant", "collection": "docs", "url": "http://localhost:6333"},
)
ingest() runs ingest → chunk → embed → store in one call.
3. Query
result = rag.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[:200])
4. Chat
llm = rag.llm(provider="openai", model="gpt-4o-mini")
embedder = rag.embedder(provider="voyage", model="voyage-3", input_type="query")
result = rag.chat(
"What does the guide cover?",
llm=llm,
embedder=embedder,
vector_db="qdrant", collection="docs", url="http://localhost:6333",
history=[],
)
print(result.answer)
Chat is stateless. Save result.history and pass it to the next turn.
Next
SDK Overview
Every method.
Run stages individually
Ingest → chunk → embed → store, step by step.