Python SDK for the Vectornest / RAG Studio API
Project description
vectornest
Official Python SDK for the Vectornest / RAG Studio API.
Installation
pip install vectornest-sdk
Quickstart
from vectornest import Vectornest
client = Vectornest(api_key="vn_your_key_here")
# Create and activate a collection
client.collections.create("research-docs")
client.collections.activate("research-docs")
# Upload documents and wait for ingestion
task = client.documents.upload(["report.pdf", "data.csv"])
task.wait(timeout=120) # blocks; raises TaskFailedError on failure
# Query
resp = client.chat.query("summarize the key findings", session_id="session-1")
print(resp.answer)
for source in resp.sources:
print(f" [{source.score:.2f}] {source.filename}")
Async Usage
import asyncio
from vectornest import AsyncVectornest
async def main():
async with AsyncVectornest(api_key="vn_your_key_here") as client:
await client.collections.activate("research-docs")
task = await client.documents.upload(["report.pdf"])
await task.wait_async(timeout=120)
resp = await client.chat.query("what are the conclusions?")
print(resp.answer)
asyncio.run(main())
Error Handling
from vectornest.exceptions import BudgetExceededError, AuthenticationError, TaskFailedError
try:
task = client.documents.upload(["big_file.pdf"])
task.wait()
except AuthenticationError:
print("Invalid API key")
except BudgetExceededError:
print("Usage limit reached — upgrade your plan")
except TaskFailedError as e:
print(f"Ingestion failed: {e.message}")
API Reference
Vectornest(api_key, base_url, timeout)
| Namespace | Methods |
|---|---|
client.collections |
create(), list(), active(), activate(), delete() |
client.documents |
upload(), list(), delete() |
client.chat |
query() |
UploadTask
| Method | Description |
|---|---|
.wait(timeout=300, poll_interval=3) |
Block until ingestion completes |
.wait_async(timeout=300, poll_interval=3) |
Async variant |
QueryResponse
| Field | Type | Description |
|---|---|---|
answer |
str |
Generated LLM answer |
sources |
list[SourceChunk] |
Retrieved context chunks |
llm_metrics |
LLMMetrics |
Token counts, latency |
fallback_used |
bool |
Whether fallback model was used |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
vectornest_sdk-0.1.0.tar.gz
(8.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vectornest_sdk-0.1.0.tar.gz.
File metadata
- Download URL: vectornest_sdk-0.1.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f68e18134caf65152b841071f9e84f22c80242566a146208903b9edcc5c79d04
|
|
| MD5 |
ebb453372f49700ac5ffcd32aa49b9a3
|
|
| BLAKE2b-256 |
7ddd77199415acce75b023a0a850550d8e6c6eff0eace6f6ad9a20851dc26175
|
File details
Details for the file vectornest_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: vectornest_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2ec5dce81f05691ea8396cf8af678c4861f8e82cd2cef8b47f72737c9d1a5b1
|
|
| MD5 |
f802bc0b38923835dfe056e8f2a430c3
|
|
| BLAKE2b-256 |
e5e4a9e190c371db6a51b9da655b4b7e8404258f0ff536e5bcb2c603ba7ea661
|