ez-ragify Python SDK
Official Python SDK for the RAGify RAG-as-a-Service API. Build retrieval-augmented generation pipelines with a single function call.
Installation
pip install ez-ragify
Or install from source:
cd sdks/python
pip install -e ".[dev]"
Quick Start
API Key Authentication (project-scoped)
from ez_ragify import EzRagify
client = EzRagify(api_key="rag_abc123...")
# Ask a question against your project
response = client.query("What is the refund policy?", project_id=1)
print(response.answer)
for citation in response.citations:
print(f" - {citation.filename} p.{citation.page_number}: {citation.snippet}")
Bearer Token Authentication (user-scoped)
client = EzRagify(bearer_token="eyJhbGci...")
# Manage projects
projects = client.list_projects()
Streaming
Stream tokens in real-time for a responsive UX:
client = EzRagify(api_key="rag_abc123...")
for chunk in client.query_stream("Summarize the document", project_id=1):
if chunk.type == "chunk":
print(chunk.content, end="", flush=True)
elif chunk.type == "citations":
print("\n\nSources:")
for c in chunk.citations:
print(f" - {c.filename}: {c.snippet[:80]}")
Async Support
import asyncio
from ez_ragify import AsyncEzRagify
async def main():
async with AsyncEzRagify(api_key="rag_abc123...") as client:
response = await client.query("What are the tax deadlines?", project_id=1)
print(response.answer)
# Streaming
async for chunk in client.query_stream("Summarize", project_id=1):
if chunk.type == "chunk":
print(chunk.content, end="")
asyncio.run(main())
API Reference
Client Initialization
EzRagify(
api_key="...", # Project-scoped API key (X-API-Key header)
bearer_token="...", # User-scoped JWT (Authorization: Bearer header)
base_url="http://...", # Default: http://localhost:8000/api/v1
timeout=30.0, # Default request timeout in seconds
)
RAG Queries
| Method | Description |
|---|---|
client.query(query, project_id, top_k=4) |
Full response (collects stream) |
client.query_stream(query, project_id, top_k=4) |
Generator of StreamChunk |
Projects
| Method | Description |
|---|---|
client.create_project(ProjectCreate(...)) |
Create project |
client.list_projects(skip=0, limit=100) |
List user's projects |
client.get_project(project_id) |
Get single project |
client.update_project(project_id, ProjectUpdate(...)) |
Update config |
client.delete_project(project_id) |
Delete project |
client.list_models() |
Available LLM models |
client.get_api_key(project_id) |
Get API key prefix |
client.regenerate_api_key(project_id) |
Regenerate API key |
Documents
| Method | Description |
|---|---|
client.upload_document(project_id, file) |
Upload PDF/DOCX/TXT/MD |
client.list_documents(project_id) |
List project documents |
client.delete_document(document_id) |
Delete a document |
file can be a file path string or a file-like object:
# From path
doc = client.upload_document(1, "/path/to/report.pdf")
# From file object
with open("report.pdf", "rb") as f:
doc = client.upload_document(1, f, filename="report.pdf")
Usage & Analytics
| Method | Description |
|---|---|
client.get_usage() |
Aggregate usage stats |
client.get_project_logs(project_id, limit=50, offset=0) |
Per-project query logs |
User Profile
| Method | Description |
|---|---|
client.get_profile() |
Get current user profile |
client.update_profile(display_name="...") |
Update display name |
client.delete_account() |
Delete account and all data |
Error Handling
from ez_ragify import EzRagify, EzRagifyError, AuthenticationError, RateLimitError, NotFoundError
client = EzRagify(api_key="rag_...")
try:
response = client.query("Hello", project_id=999)
except NotFoundError:
print("Project not found")
except RateLimitError as e:
print(f"Rate limited — retry after {e.retry_after}s")
except AuthenticationError:
print("Invalid API key")
except EzRagifyError as e:
print(f"API error {e.status_code}: {e.message}")
Types
All response objects are Pydantic models with full type hints:
Project,ProjectCreate,ProjectUpdateDocumentQueryResponse,StreamChunk,CitationUsageStats,ProjectLog,ProjectLogsUserProfileModelAPIKey,APIKeyWithPlaintext
License
MIT
Metadata
Release files for ez-ragify 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ez_ragify-0.1.0.tar.gz | 10.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ez_ragify-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.3 kB
Release files / ez_ragify-0.1.0.tar.gz
| Download URL | ez_ragify-0.1.0.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ca2e1ebb5704c75cdcac62670d06187019dd173630d84edff74815f8954bdb6
|
|
BLAKE2b-256 checksum How to use checksums |
6cf616850d0283571ea096818a4a702cf0c9cc6843a9ff62127c70af75273e5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Release files / ez_ragify-0.1.0-py3-none-any.whl
| Download URL | ez_ragify-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8c242ce55d8c3088ee3fa05761941f074b5b34101dd59368295f472c23576a4
|
|
BLAKE2b-256 checksum How to use checksums |
649a3565afa94af479ff328385c4321d6806c24a3a2ea9942984d4446321d338
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Security for ez-ragify 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.