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.5.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.5-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: reag-0.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 c286b78672d431dcabde89ec312429409c623cfe578ad098b31e56b65701f809
MD5 d2b29a2198bbda9cc5b456dd88bc4276
BLAKE2b-256 775d96a5bc34320ee481f21b42f283b582e65dd0696a452f70db0e3698620916

See more details on using hashes here.

File details

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

File metadata

  • Download URL: reag-0.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cd1d5385257e5fb7bbe6a901264260680d867bc97c7afa0437703216e880d5f2
MD5 9f1846173a76c0c0f80aab07ed29fd1d
BLAKE2b-256 880133384f0adb57d5dd3bc94e69ff7ec1497247c6639b14b0b1404deb6063fc

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