# ViaRAG SDK
Minimal Python SDK for interacting with the [ViaRAG API](https://viarag.ai).
Designed for developers building RAG pipelines, chatbots, and AI-native workflows.
---
## ๐ฆ Installation
```bash
pip install viarag
```
---
## ๐ Quickstart
```python
from viarag import ViaRAGClient
client = ViaRAGClient(api_key="your_api_key")
print(client.health_check())
```
---
## ๐ง Class: `ViaRAGClient`
### `ViaRAGClient(api_key: str, timeout: int = 30)`
Creates a new client.
---
## ๐ก Endpoints
### โ
1. `health_check()`
Returns the API's current health status.
```python
client.health_check()
```
**Returns:**
```json
{"status": "ok"}
```
---
### ๐ค 2. `simple_query(prompt: str, top_k: int = 5)`
Runs a **retrieval-augmented generation (RAG)** query.
```python
client.simple_query("What is ViaRAG?")
```
**Returns:**
```json
{
"response": "ViaRAG is an API for retrieval-augmented generation...",
"contexts": [...],
"prompt": "..."
}
```
---
### ๐ฌ 3. `direct_query(prompt: str)`
Runs a prompt **directly through the LLM**, no retrieval.
```python
client.direct_query("Tell me a joke.")
```
---
### ๐ 4. `match_context(prompt: str, top_k: int = 5)`
Returns **top-k context chunks** that match your prompt (no generation).
```python
client.match_context("What is ViaVeri?")
```
**Returns:**
```json
[
{"content": "...", "score": 0.92},
{"content": "...", "score": 0.87}
]
```
---
### ๐ 5. `upload_document(file_path: str, metadata: dict = None, chunking_config: dict = None)`
Uploads a document and indexes it.
```python
client.upload_document(
file_path="my_notes.pdf",
metadata={"source": "user-upload"},
chunking_config={"chunk_size": 1000, "chunk_overlap": 200}
)
```
Supports: `.pdf`, `.docx`, `.txt`
---
### โ๏ธ 6. `chunk_text(text: str, chunk_size: int = 1000, chunk_overlap: int = 200, splitter: str = "recursive")`
Chunks raw text without uploading a file.
```python
chunks = client.chunk_text("A long string of text...")
```
**Returns:**
```json
["Chunk 1", "Chunk 2", ...]
```
---
### ๐ 7. `list_documents()`
Lists all documents youโve uploaded.
```python
client.list_documents()
```
**Returns:**
```json
[
{"doc_id": "abc123", "filename": "my_notes.pdf"},
...
]
```
---
### โ 8. `delete_document_by_id(doc_id: str)`
Deletes all chunks associated with a document.
```python
client.delete_document_by_id("abc123")
```
---
## ๐ Authentication
All API calls (except `health_check`) require a **Bearer token**:
```python
client = ViaRAGClient(api_key="sk-...")
```
---
## ๐งช Development
Clone the repo and install locally:
```bash
git clone https://github.com/YOUR_USERNAME/viarag-sdk.git
cd viarag-sdk
pip install -e .
```
---
## ๐ License
GNU General Purpose License. See `LICENSE` file.
---
## ๐ About
Built by [ViaVeri Technologies](https://viaveri.co) to empower developers with simple, powerful RAG tools.
Raw data
{
"_id": null,
"home_page": null,
"name": "viarag",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "rag, api, sdk, viarag",
"author": null,
"author_email": "Eric Meltser <info@viaveri.co>",
"download_url": "https://files.pythonhosted.org/packages/d4/6b/e3bc51db7730993d2a5de5db12e333860e186191e8001303f6093488d443/viarag-0.1.3.tar.gz",
"platform": null,
"description": "# ViaRAG SDK\n\nMinimal Python SDK for interacting with the [ViaRAG API](https://viarag.ai).\nDesigned for developers building RAG pipelines, chatbots, and AI-native workflows.\n\n---\n\n## \ud83d\udce6 Installation\n\n```bash\npip install viarag\n```\n\n---\n\n## \ud83d\ude80 Quickstart\n\n```python\nfrom viarag import ViaRAGClient\n\nclient = ViaRAGClient(api_key=\"your_api_key\")\nprint(client.health_check())\n```\n\n---\n\n## \ud83d\udd27 Class: `ViaRAGClient`\n\n### `ViaRAGClient(api_key: str, timeout: int = 30)`\n\nCreates a new client.\n\n---\n\n## \ud83d\udce1 Endpoints\n\n### \u2705 1. `health_check()`\n\nReturns the API's current health status.\n\n```python\nclient.health_check()\n```\n\n**Returns:**\n\n```json\n{\"status\": \"ok\"}\n```\n\n---\n\n### \ud83e\udd16 2. `simple_query(prompt: str, top_k: int = 5)`\n\nRuns a **retrieval-augmented generation (RAG)** query.\n\n```python\nclient.simple_query(\"What is ViaRAG?\")\n```\n\n**Returns:**\n\n```json\n{\n \"response\": \"ViaRAG is an API for retrieval-augmented generation...\",\n \"contexts\": [...],\n \"prompt\": \"...\"\n}\n```\n\n---\n\n### \ud83d\udcac 3. `direct_query(prompt: str)`\n\nRuns a prompt **directly through the LLM**, no retrieval.\n\n```python\nclient.direct_query(\"Tell me a joke.\")\n```\n\n---\n\n### \ud83d\udd0d 4. `match_context(prompt: str, top_k: int = 5)`\n\nReturns **top-k context chunks** that match your prompt (no generation).\n\n```python\nclient.match_context(\"What is ViaVeri?\")\n```\n\n**Returns:**\n\n```json\n[\n {\"content\": \"...\", \"score\": 0.92},\n {\"content\": \"...\", \"score\": 0.87}\n]\n```\n\n---\n\n### \ud83d\udcc4 5. `upload_document(file_path: str, metadata: dict = None, chunking_config: dict = None)`\n\nUploads a document and indexes it.\n\n```python\nclient.upload_document(\n file_path=\"my_notes.pdf\",\n metadata={\"source\": \"user-upload\"},\n chunking_config={\"chunk_size\": 1000, \"chunk_overlap\": 200}\n)\n```\n\nSupports: `.pdf`, `.docx`, `.txt`\n\n---\n\n### \u2702\ufe0f 6. `chunk_text(text: str, chunk_size: int = 1000, chunk_overlap: int = 200, splitter: str = \"recursive\")`\n\nChunks raw text without uploading a file.\n\n```python\nchunks = client.chunk_text(\"A long string of text...\")\n```\n\n**Returns:**\n\n```json\n[\"Chunk 1\", \"Chunk 2\", ...]\n```\n\n---\n\n### \ud83d\udcda 7. `list_documents()`\n\nLists all documents you\u2019ve uploaded.\n\n```python\nclient.list_documents()\n```\n\n**Returns:**\n\n```json\n[\n {\"doc_id\": \"abc123\", \"filename\": \"my_notes.pdf\"},\n ...\n]\n```\n\n---\n\n### \u274c 8. `delete_document_by_id(doc_id: str)`\n\nDeletes all chunks associated with a document.\n\n```python\nclient.delete_document_by_id(\"abc123\")\n```\n\n---\n\n## \ud83d\udd10 Authentication\n\nAll API calls (except `health_check`) require a **Bearer token**:\n\n```python\nclient = ViaRAGClient(api_key=\"sk-...\")\n```\n\n---\n\n## \ud83e\uddea Development\n\nClone the repo and install locally:\n\n```bash\ngit clone https://github.com/YOUR_USERNAME/viarag-sdk.git\ncd viarag-sdk\npip install -e .\n```\n\n---\n\n## \ud83d\udcc4 License\n\nGNU General Purpose License. See `LICENSE` file.\n\n---\n\n## \ud83d\udc4b About\n\nBuilt by [ViaVeri Technologies](https://viaveri.co) to empower developers with simple, powerful RAG tools.\n",
"bugtrack_url": null,
"license": "GNU General Public License v3.0",
"summary": "Minimal Python SDK for interacting with the ViaRAG API",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://viarag.ai",
"Repository": "https://github.com/ViaVeritas/viarag"
},
"split_keywords": [
"rag",
" api",
" sdk",
" viarag"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "5bbce5505d05dfddd4213df88e833e37621b94149fe7acb2668acda0eeb0a196",
"md5": "bf6c18970e2b7f0bb195a44215121cb3",
"sha256": "4385dcf7baa73f58e65509cc35fe87eacbe3a33a2525ce1dac7b9b7c734d1dea"
},
"downloads": -1,
"filename": "viarag-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bf6c18970e2b7f0bb195a44215121cb3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5411,
"upload_time": "2025-08-04T19:36:36",
"upload_time_iso_8601": "2025-08-04T19:36:36.870120Z",
"url": "https://files.pythonhosted.org/packages/5b/bc/e5505d05dfddd4213df88e833e37621b94149fe7acb2668acda0eeb0a196/viarag-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d46be3bc51db7730993d2a5de5db12e333860e186191e8001303f6093488d443",
"md5": "9db8ec8da8cf4b2719dcb5193f3bf492",
"sha256": "bd0551314e0c7c988575b0294ce5bfe16f239f499ef979ed727361ef03e55e98"
},
"downloads": -1,
"filename": "viarag-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "9db8ec8da8cf4b2719dcb5193f3bf492",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4681,
"upload_time": "2025-08-04T19:36:37",
"upload_time_iso_8601": "2025-08-04T19:36:37.681402Z",
"url": "https://files.pythonhosted.org/packages/d4/6b/e3bc51db7730993d2a5de5db12e333860e186191e8001303f6093488d443/viarag-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-04 19:36:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ViaVeritas",
"github_project": "viarag",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "viarag"
}