Python SDK and CLI for the Verbatim platform — grounded, verbatim answers from curated document collections.
Project description
verbatim-client
Python SDK and CLI for the Verbatim platform — grounded, verbatim answers from curated document collections.
Verbatim is a hosted RAG platform from KR Labs. Every answer is grounded in exact, citable spans from real documents. The platform is organized around collections — curated document sets like the ACL Anthology, or private collections we host for organizations.
This library is the Python client for talking to verbatim.krlabs.eu directly. It wraps the REST API with typed Pydantic responses and ships a verbatim command-line tool.
How it relates to the other Verbatim packages
| Package | What it's for |
|---|---|
verbatim-client (this) |
Python SDK + CLI for the hosted platform |
verbatim-rag |
Open-source RAG core to self-host your own Verbatim-style stack |
verbatim-mcp |
MCP server wrapping the hosted platform for agentic clients |
| verbatim-skill | Claude Code plugin exposing the platform as slash commands |
Install
pip install verbatim-client
Get an API key
- Sign up at verbatim.krlabs.eu
- Navigate to API Keys, create a key
- Export it:
export VERBATIM_API_KEY=vb_your_key_here
SDK usage
Sync
from verbatim_client import VerbatimClient
with VerbatimClient() as client:
# RAG over the default collection (ACL Anthology)
result = client.query("What is the attention mechanism in transformers?")
print(result.answer)
for cite in result.structured_answer.citations:
print(f" [{cite.number}] {cite.text}")
# Search papers (no LLM, no quota)
papers = client.search_papers("attention mechanisms", year=2017, limit=5)
for p in papers:
print(p.id, p.title)
# Paper detail + BibTeX + full text
paper = client.get_paper("2017.acl-1.1")
bibtex = client.get_paper_bibtex("2017.acl-1.1").bibtex
content = client.get_paper_content("2017.acl-1.1").content
# Browse facets
venues = client.facets("venue", q="acl", limit=10)
for v in venues.items:
print(v.value, v.count)
# Cross-collection query (when other collections are available)
result = client.query(
"Recent advances in language modeling",
collection_ids=["anthology", "biorxiv"],
)
Async
import asyncio
from verbatim_client import AsyncVerbatimClient
async def main():
async with AsyncVerbatimClient() as client:
result = await client.query("What is BERT?")
print(result.answer)
asyncio.run(main())
Streaming
NDJSON streaming exposes documents → highlights → answer stages as they're produced:
with VerbatimClient() as client:
for event in client.query_stream("What is BERT?"):
if event["type"] == "documents":
print(f"Retrieved {len(event['data'])} documents")
elif event["type"] == "answer" and event.get("done"):
print("Final answer:", event["data"]["answer"])
Verbatim Transform (bring your own context)
transform is collection-agnostic — pass your own context inline:
result = client.transform(
"What are the main findings?",
context=[
{"content": "Full text of document 1...", "title": "Doc 1"},
{"content": "Full text of document 2...", "title": "Doc 2"},
],
)
print(result.answer)
CLI
The package installs a verbatim command:
# Ask a question
verbatim query "What is BERT?"
# Search papers
verbatim search "attention mechanisms" --year 2017 --limit 5
# List collections
verbatim collections list
# Paper metadata, BibTeX, full text
verbatim paper get 2017.acl-1.1
verbatim paper bibtex 2017.acl-1.1 > vaswani-2017.bib
verbatim paper content 2017.acl-1.1 > vaswani-2017.md
# Facet autocomplete (fuzzy)
verbatim facets author --q vaswani --limit 5
# Verbatim transform over your own context
verbatim transform "What did they find?" --context ./mycontext.json
Every command honors VERBATIM_API_KEY and VERBATIM_API_URL from the environment; override per-invocation with --api-key and --base-url.
Add --json to most commands to get machine-readable output:
verbatim search "attention" --json | jq '.[] | {id, title}'
Configuration
| Env var | Default | Description |
|---|---|---|
VERBATIM_API_KEY |
— | Required. Your platform API key. |
VERBATIM_API_URL |
https://verbatim.krlabs.eu |
API base URL. Override for dev / self-hosted. |
Errors
API errors raise VerbatimError:
from verbatim_client import VerbatimClient, VerbatimError
try:
client.query("...")
except VerbatimError as e:
print(e.status_code, e.detail)
Common statuses:
401— authentication required403— no access to this collection (or non-default collection while the platform's Milvus filter is disabled)404— collection or paper not found429— rate limit or quota exceeded451— legal acceptance required
License
Apache 2.0. See LICENSE.
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
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 verbatim_client-0.1.0.tar.gz.
File metadata
- Download URL: verbatim_client-0.1.0.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e516ba2bdebdffee2873cffe8e5c20106ad1f361539c71fe382f69fe4881831c
|
|
| MD5 |
4096498e61e21dbae09bb8929c484212
|
|
| BLAKE2b-256 |
624b3867987df4e99042625944def59b78b15b13343af4e28d824b56b5c5cec4
|
File details
Details for the file verbatim_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: verbatim_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
560740a4f3d682177382fb7868fd4464bcea28ad471113a167314b04e23a72c7
|
|
| MD5 |
875c0e12beaaf9e931bfafe66bc7233f
|
|
| BLAKE2b-256 |
fc3da768a9e95c1649e2ba3a95655abb283d5cc8b826108e6ba7d1f7cb44a781
|