Lightweight verbatim span extraction -- the RAG-agnostic core of verbatim-rag
Project description
verbatim-core
Lightweight verbatim span extraction -- the RAG-agnostic core of verbatim-rag.
Extract exact, verbatim text spans from documents that answer a question. No vector databases, no embeddings, no heavy ML dependencies -- just openai and pydantic.
Installation
pip install verbatim-core
Quick Start
from verbatim_core import VerbatimTransform
vt = VerbatimTransform()
response = vt.transform(
question="What is the main finding?",
context=[
{"content": "The study found that X leads to Y.", "title": "Paper A"},
{"content": "Results show Z is statistically significant.", "title": "Paper B"},
],
)
print(response.answer)
# Access individual highlights and citations
for doc in response.documents:
for highlight in doc.highlights:
print(f" [{highlight.start}:{highlight.end}] {highlight.text}")
What This Package Includes
- VerbatimTransform -- question + context -> cited, grounded answer
- LLMSpanExtractor -- extract verbatim spans using an LLM
- LLMClient -- unified OpenAI API wrapper (sync + async)
- TemplateManager -- response formatting with multiple template strategies
- @verbatim_enhance -- decorator to enhance existing RAG functions
- CLI (
verbatim-enhance) -- batch processing from the command line
Model-Based Extraction
For ModernBERT or Zilliz semantic highlight extractors (adds torch, transformers):
pip install verbatim-core[model]
Environment
export OPENAI_API_KEY=your_api_key_here
Full RAG System
For the complete RAG pipeline with vector indexing, embeddings, and document processing, install the full package:
pip install verbatim-rag
Project details
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_core-0.2.6.tar.gz.
File metadata
- Download URL: verbatim_core-0.2.6.tar.gz
- Upload date:
- Size: 46.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55c2e1576ecff02be9e5d8b6cee9be0d61ed83963d8dc92fea7eab2a2fa3c0d1
|
|
| MD5 |
85370c2424a8271eb5b35d5a6543fbf0
|
|
| BLAKE2b-256 |
9bd4966ec2b69a7f1c19b93bcc6e13abe7b05866f0c3325d8c2a17e1681f7513
|
File details
Details for the file verbatim_core-0.2.6-py3-none-any.whl.
File metadata
- Download URL: verbatim_core-0.2.6-py3-none-any.whl
- Upload date:
- Size: 60.9 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 |
cf45b6b1dbdddd26c93065b57d7582b4e2842ba9464c414852c0a17de32674fd
|
|
| MD5 |
f4fd6e07522750e84d64c096aaf667ba
|
|
| BLAKE2b-256 |
b4e6b34519b56acf45ff4f44ccd04ac84ba2cfb62dfaea6a8afc38fd493c27e8
|