Skip to main content

ReAG SDK - Reasoning Augmented Generation framework for Python

Project description

🎓 ReAG Python SDK

Installation

  1. Ensure Python 3.9+ is installed.
  2. 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

Contact

For support or inquiries, please contact:

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

reag-0.0.6.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reag-0.0.6-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file reag-0.0.6.tar.gz.

File metadata

  • Download URL: reag-0.0.6.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.0.0

File hashes

Hashes for reag-0.0.6.tar.gz
Algorithm Hash digest
SHA256 121a93bb9262ebd2acd20faf2ac68b42ff762a85f3915fad5b32a6144a0dd06c
MD5 87ce513d71890cfd4ba86b37c35614d7
BLAKE2b-256 662e9ff6c4b9a0fbef992c6909b24b5e8840c68616563cdf70d43cdfe92334f8

See more details on using hashes here.

File details

Details for the file reag-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: reag-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.0.0

File hashes

Hashes for reag-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 973ae5fac72be8b6857800772acaf7a86a783ee6dfa0b0de4724b858efb51350
MD5 9dc137ac8ce1f2cc236514d5b0679a6b
BLAKE2b-256 d6a3c0a2f12b8b447de2f1b80fc35babf96b6cdca50f33ca6d1501ad214b53b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page