🎓 ReAG Python SDK
Installation
- Ensure Python 3.9+ is installed.
- Install using pip or poetry:
pip install reag # or poetry add reag
Quick Start
from reag.client import ReagClient, Document
async with ReagClient(
model="ollama/deepseek-r1:7b",
model_kwargs={"api_base": "http://localhost:11434"}
) as client:
docs = [
Document(
name="Superagent",
content="Superagent is a workspace for AI-agents that learn, perform work, and collaborate.",
metadata={
"url": "https://superagent.sh",
"source": "web",
},
),
]
response = await client.query("What is Superagent?", documents=docs)
API Reference
Initialization
Initialize the client by providing required configuration options:
client = new ReagClient(
model: "gpt-4o-mini", // LiteLLM model name
system: Optional[str] // Optional system prompt
batchSize: Optional[Number] // Optional batch size
schema: Optional[BaseModel] // Optional Pydantic schema
);
Document Structure
Documents should follow this structure:
document = Document(
name="Superagent",
content="Superagent is a workspace for AI-agents that learn, perform work, and collaborate.",
metadata={
"url": "https://superagent.sh",
"source": "web",
},
)
Querying
Query documents with optional filters:
docs = [
Document(
name="Superagent",
content="Superagent is a workspace for AI-agents that learn, perform work, and collaborate.",
metadata={
"url": "https://superagent.sh",
"source": "web",
"id": "sa-1",
},
),
Document(
name="Superagent",
content="Superagent is a workspace for AI-agents that learn, perform work, and collaborate.",
metadata={
"url": "https://superagent.sh",
"source": "web",
"id": "sa-2",
},
),
]
options = {"filter": [{"key": "id", "value": "sa-1", "operator": "equals"}]}
response = await client.query(
"What is Superagent?", documents=docs, options=options
)
Response structure:
content: str
reasoning: str
is_irrelevant: bool
document: Document
Example filters:
- Filter by metadata field:
options = {"filter": [{"key": "id", "value": "sa-1", "operator": "equals"}]}
- Filter by numeric values:
options = { "filter": [{"key": "version", "value": 2, "operator": "greaterThanOrEqual"}] }
Contributing
We welcome contributions from the community. Please refer to the CONTRIBUTING.md file for guidelines on reporting issues, suggesting improvements, and submitting pull requests.
License
This project is licensed under the MIT License.
Additional Resources
- ReAG Blog Post - A deep dive into ReAG.
Contact
For support or inquiries, please contact:
Metadata
Release files for reag 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| reag-0.0.6.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| reag-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / reag-0.0.6.tar.gz
| Download URL | reag-0.0.6.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
121a93bb9262ebd2acd20faf2ac68b42ff762a85f3915fad5b32a6144a0dd06c
|
|
BLAKE2b-256 checksum How to use checksums |
662e9ff6c4b9a0fbef992c6909b24b5e8840c68616563cdf70d43cdfe92334f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.13.0 Darwin/24.0.0
|
Release files / reag-0.0.6-py3-none-any.whl
| Download URL | reag-0.0.6-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
973ae5fac72be8b6857800772acaf7a86a783ee6dfa0b0de4724b858efb51350
|
|
BLAKE2b-256 checksum How to use checksums |
d6a3c0a2f12b8b447de2f1b80fc35babf96b6cdca50f33ca6d1501ad214b53b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.13.0 Darwin/24.0.0
|