reag


Namereag JSON
Version 0.0.6 PyPI version JSON
download
home_pagehttps://github.com/superagent-ai/reag
SummaryReAG SDK - Reasoning Augmented Generation framework for Python
upload_time2025-02-12 15:26:25
maintainerNone
docs_urlNone
authorIsmail Pelaseyed
requires_python<3.13,>=3.9
licenseMIT
keywords llm ai reasoning generation nlp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🎓 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)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/superagent-ai/reag",
    "name": "reag",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.9",
    "maintainer_email": null,
    "keywords": "llm, ai, reasoning, generation, nlp",
    "author": "Ismail Pelaseyed",
    "author_email": "ismail@superagent.sh",
    "download_url": "https://files.pythonhosted.org/packages/66/2e/9ff6c4b9a0fbef992c6909b24b5e8840c68616563cdf70d43cdfe92334f8/reag-0.0.6.tar.gz",
    "platform": null,
    "description": "# \ud83c\udf93 ReAG Python SDK\n\n## Installation\n1. Ensure Python 3.9+ is installed.\n2. Install using pip or poetry:\n   ```bash\n   pip install reag\n   # or\n   poetry add reag\n   ```\n\n## Quick Start\n```python\nfrom reag.client import ReagClient, Document\n\nasync with ReagClient(\n      model=\"ollama/deepseek-r1:7b\",\n      model_kwargs={\"api_base\": \"http://localhost:11434\"}\n   ) as client:\n        docs = [\n            Document(\n                name=\"Superagent\",\n                content=\"Superagent is a workspace for AI-agents that learn, perform work, and collaborate.\",\n                metadata={\n                    \"url\": \"https://superagent.sh\",\n                    \"source\": \"web\",\n                },\n            ),\n        ]\n        response = await client.query(\"What is Superagent?\", documents=docs)\n\n```\n\n## API Reference\n\n### Initialization\nInitialize the client by providing required configuration options:\n\n```typescript\nclient = new ReagClient(\n  model: \"gpt-4o-mini\", // LiteLLM model name\n  system: Optional[str] // Optional system prompt\n  batchSize: Optional[Number] // Optional batch size\n  schema: Optional[BaseModel] // Optional Pydantic schema\n);\n```\n\n### Document Structure\nDocuments should follow this structure:\n```python\ndocument = Document(\n    name=\"Superagent\",\n    content=\"Superagent is a workspace for AI-agents that learn, perform work, and collaborate.\",\n    metadata={\n        \"url\": \"https://superagent.sh\",\n        \"source\": \"web\",\n    },\n)\n```\n\n### Querying\nQuery documents with optional filters:\n\n```python\ndocs = [\n    Document(\n        name=\"Superagent\",\n        content=\"Superagent is a workspace for AI-agents that learn, perform work, and collaborate.\",\n        metadata={\n            \"url\": \"https://superagent.sh\",\n            \"source\": \"web\",\n            \"id\": \"sa-1\",\n        },\n    ),\n    Document(\n        name=\"Superagent\",\n        content=\"Superagent is a workspace for AI-agents that learn, perform work, and collaborate.\",\n        metadata={\n            \"url\": \"https://superagent.sh\",\n            \"source\": \"web\",\n            \"id\": \"sa-2\",\n        },\n    ),\n]\noptions = {\"filter\": [{\"key\": \"id\", \"value\": \"sa-1\", \"operator\": \"equals\"}]}\nresponse = await client.query(\n    \"What is Superagent?\", documents=docs, options=options\n)\n```\n\nResponse structure:\n```python\ncontent: str\nreasoning: str\nis_irrelevant: bool\ndocument: Document\n```\n\nExample filters:\n- Filter by metadata field:\n  ```python\n  options = {\"filter\": [{\"key\": \"id\", \"value\": \"sa-1\", \"operator\": \"equals\"}]}\n  ```\n- Filter by numeric values:\n  ```python\n  options = {\n    \"filter\": [{\"key\": \"version\", \"value\": 2, \"operator\": \"greaterThanOrEqual\"}]\n  }\n  ```\n\n## Contributing\n\nWe 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.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## Additional Resources\n- [ReAG Blog Post](https://www.superagent.sh/blog/reag-reasoning-augmented-generation) - A deep dive into ReAG.\n\n## Contact\n\nFor support or inquiries, please contact:\n- [Create Issue](https://github.com/superagent-ai/reag/issues)\n- X: [@superagent_ai](https://x.com/superagent_ai)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "ReAG SDK - Reasoning Augmented Generation framework for Python",
    "version": "0.0.6",
    "project_urls": {
        "Documentation": "https://github.com/superagent-ai/reag#readme",
        "Homepage": "https://github.com/superagent-ai/reag",
        "Repository": "https://github.com/superagent-ai/reag"
    },
    "split_keywords": [
        "llm",
        " ai",
        " reasoning",
        " generation",
        " nlp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d6a3c0a2f12b8b447de2f1b80fc35babf96b6cdca50f33ca6d1501ad214b53b7",
                "md5": "9dc137ac8ce1f2cc236514d5b0679a6b",
                "sha256": "973ae5fac72be8b6857800772acaf7a86a783ee6dfa0b0de4724b858efb51350"
            },
            "downloads": -1,
            "filename": "reag-0.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9dc137ac8ce1f2cc236514d5b0679a6b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9",
            "size": 5726,
            "upload_time": "2025-02-12T15:26:24",
            "upload_time_iso_8601": "2025-02-12T15:26:24.362297Z",
            "url": "https://files.pythonhosted.org/packages/d6/a3/c0a2f12b8b447de2f1b80fc35babf96b6cdca50f33ca6d1501ad214b53b7/reag-0.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "662e9ff6c4b9a0fbef992c6909b24b5e8840c68616563cdf70d43cdfe92334f8",
                "md5": "87ce513d71890cfd4ba86b37c35614d7",
                "sha256": "121a93bb9262ebd2acd20faf2ac68b42ff762a85f3915fad5b32a6144a0dd06c"
            },
            "downloads": -1,
            "filename": "reag-0.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "87ce513d71890cfd4ba86b37c35614d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9",
            "size": 5189,
            "upload_time": "2025-02-12T15:26:25",
            "upload_time_iso_8601": "2025-02-12T15:26:25.562650Z",
            "url": "https://files.pythonhosted.org/packages/66/2e/9ff6c4b9a0fbef992c6909b24b5e8840c68616563cdf70d43cdfe92334f8/reag-0.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-12 15:26:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "superagent-ai",
    "github_project": "reag",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "reag"
}
        
Elapsed time: 1.43260s