Metadata-Version: 2.1
Name: reag
Version: 0.0.5
Summary: ReAG SDK - Reasoning Augmented Generation framework for Python
Home-page: https://github.com/superagent-ai/reag
License: MIT
Keywords: llm,ai,reasoning,generation,nlp
Author: Ismail Pelaseyed
Author-email: ismail@superagent.sh
Requires-Python: >=3.9,<3.13
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: httpx (>=0.25.0,<0.26.0)
Requires-Dist: litellm (>=1.60.0,<2.0.0)
Requires-Dist: ollama (==0.3.1)
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
Project-URL: Documentation, https://github.com/superagent-ai/reag#readme
Project-URL: Repository, https://github.com/superagent-ai/reag
Description-Content-Type: text/markdown

# 🎓 ReAG Python SDK

## Installation
1. Ensure Python 3.9+ is installed.
2. Install using pip or poetry:
   ```bash
   pip install reag
   # or
   poetry add reag
   ```

## Quick Start
```python
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:

```typescript
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:
```python
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:

```python
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:
```python
content: str
reasoning: str
is_irrelevant: bool
document: Document
```

Example filters:
- Filter by metadata field:
  ```python
  options = {"filter": [{"key": "id", "value": "sa-1", "operator": "equals"}]}
  ```
- Filter by numeric values:
  ```python
  options = {
    "filter": [{"key": "version", "value": 2, "operator": "greaterThanOrEqual"}]
  }
  ```

## Contributing

We welcome contributions from the community. Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on reporting issues, suggesting improvements, and submitting pull requests.

## License

This project is licensed under the [MIT License](LICENSE).

## Additional Resources
- [ReAG Blog Post](https://www.superagent.sh/blog/reag-reasoning-augmented-generation) - A deep dive into ReAG.

## Contact

For support or inquiries, please contact:
- [Create Issue](https://github.com/superagent-ai/reag/issues)
- X: [@superagent_ai](https://x.com/superagent_ai)

