ragwrangler


Nameragwrangler JSON
Version 0.1.4 PyPI version JSON
download
home_page
SummaryA simple RAG (Retrieval-Augumented Generation) Task Manager
upload_time2023-09-16 23:03:02
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords rag generation retrieval weaviate openai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RAGWrangler - A simple RAG (Retrieval-Augumented Generation) Task Manager

RAGWrangler is a Python project designed to streamline the management of RAG tasks using generative language models and the Weaviate database.

With this tool, you can automatically create, retrieve, and store the outputs of RAG tasks in a structured manner in Weaviate, allowing for easy management and tracking of outputs, ultimately saving time and resources.

## Features

- **Automated Task Handling**: Simplify the creation and management of tasks with a straightforward Python class interface.
- **Weaviate Integration**: Seamlessly store and retrieve task outputs using Weaviate database integration.
- **Support for Multiple Language Models**: You can easily swap out language models as desired.
- **Logging**: Utilize integrated logging for effortless debugging and tracking of task statuses.

## Installation

The tool should be compatible with Python 3.8 and higher, although development primarily utilized Python 3.9.

To get started, install the necessary Python packages using the command below:

```sh
pip install ragwrangler
```

## Quickstart

See `example_usage.py` to see a brief example of how to use the tool.

## Usage

You can connect to any Weaviate instance to save your data. 
Refer to the [Weaviate documentation](https://weaviate.io/developers/weaviate/installation) for more information on how to set up & connect to a Weaviate instance.

The primary class you will interact with is `RAGTask`.

## RAGTask

Instantiate a `RAGTask` for each generative task to be handled. 

Provide it with a Weaviate instance, and a builder function.
You will also need to set the OpenAI API key.

```python
import weaviate, os
from ragwrangler import RAGTask, set_openai_api_key

client = weaviate.Client(
    url=os.environ['WCS_URL'],
    auth_client_secret=weaviate.AuthApiKey(os.environ['WCS_ADMIN_KEY']),
    additional_headers={"X-OpenAI-Api-Key": os.environ["OPENAI_APIKEY"]}
)

set_openai_api_key(os.environ["OPENAI_APIKEY"])
quiz_rag = RAGTask(client=client, task_prompt_builder=revision_quiz_json_builder)
```

Where `revision_quiz_json_builder` is a function that takes in a source text and returns a task prompt for the LLM.

Extend `RAGTask` by defining custom task prompt builder functions that dictate how to generate prompts from the source text, which are then used to derive outputs.

## Working with Tasks

To create a new task, instantiate an object of `RAGTask` (or its extension) with a source text:

```python
quiz_rag = RAGTask(client=client, task_prompt_builder=revision_quiz_json_builder)
```

To obtain the task output, utilize the `get_output` method, specifying a model name if desired:

```python
output = task.get_output(source_text="Your source text here", model_name="gpt-3.5-turbo")
```

## License
This project is licensed under the MIT License.

## Copyright
© 2023 JP Hwang

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ragwrangler",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "rag,generation,retrieval,weaviate,openai",
    "author": "",
    "author_email": "JP Hwang <me@jphwang.com>",
    "download_url": "https://files.pythonhosted.org/packages/b9/97/756b9cf6f7c43f20b99457842c2e5c06e08195d189ce6480d063c5139120/ragwrangler-0.1.4.tar.gz",
    "platform": null,
    "description": "# RAGWrangler - A simple RAG (Retrieval-Augumented Generation) Task Manager\n\nRAGWrangler is a Python project designed to streamline the management of RAG tasks using generative language models and the Weaviate database.\n\nWith this tool, you can automatically create, retrieve, and store the outputs of RAG tasks in a structured manner in Weaviate, allowing for easy management and tracking of outputs, ultimately saving time and resources.\n\n## Features\n\n- **Automated Task Handling**: Simplify the creation and management of tasks with a straightforward Python class interface.\n- **Weaviate Integration**: Seamlessly store and retrieve task outputs using Weaviate database integration.\n- **Support for Multiple Language Models**: You can easily swap out language models as desired.\n- **Logging**: Utilize integrated logging for effortless debugging and tracking of task statuses.\n\n## Installation\n\nThe tool should be compatible with Python 3.8 and higher, although development primarily utilized Python 3.9.\n\nTo get started, install the necessary Python packages using the command below:\n\n```sh\npip install ragwrangler\n```\n\n## Quickstart\n\nSee `example_usage.py` to see a brief example of how to use the tool.\n\n## Usage\n\nYou can connect to any Weaviate instance to save your data. \nRefer to the [Weaviate documentation](https://weaviate.io/developers/weaviate/installation) for more information on how to set up & connect to a Weaviate instance.\n\nThe primary class you will interact with is `RAGTask`.\n\n## RAGTask\n\nInstantiate a `RAGTask` for each generative task to be handled. \n\nProvide it with a Weaviate instance, and a builder function.\nYou will also need to set the OpenAI API key.\n\n```python\nimport weaviate, os\nfrom ragwrangler import RAGTask, set_openai_api_key\n\nclient = weaviate.Client(\n    url=os.environ['WCS_URL'],\n    auth_client_secret=weaviate.AuthApiKey(os.environ['WCS_ADMIN_KEY']),\n    additional_headers={\"X-OpenAI-Api-Key\": os.environ[\"OPENAI_APIKEY\"]}\n)\n\nset_openai_api_key(os.environ[\"OPENAI_APIKEY\"])\nquiz_rag = RAGTask(client=client, task_prompt_builder=revision_quiz_json_builder)\n```\n\nWhere `revision_quiz_json_builder` is a function that takes in a source text and returns a task prompt for the LLM.\n\nExtend `RAGTask` by defining custom task prompt builder functions that dictate how to generate prompts from the source text, which are then used to derive outputs.\n\n## Working with Tasks\n\nTo create a new task, instantiate an object of `RAGTask` (or its extension) with a source text:\n\n```python\nquiz_rag = RAGTask(client=client, task_prompt_builder=revision_quiz_json_builder)\n```\n\nTo obtain the task output, utilize the `get_output` method, specifying a model name if desired:\n\n```python\noutput = task.get_output(source_text=\"Your source text here\", model_name=\"gpt-3.5-turbo\")\n```\n\n## License\nThis project is licensed under the MIT License.\n\n## Copyright\n\u00a9 2023 JP Hwang\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A simple RAG (Retrieval-Augumented Generation) Task Manager",
    "version": "0.1.4",
    "project_urls": null,
    "split_keywords": [
        "rag",
        "generation",
        "retrieval",
        "weaviate",
        "openai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "394da6ca2484fe65dec1ee2d0206e23b5c2c3808d925649ec7c391f97fef5572",
                "md5": "65784adc33c29ec0b3388acc0f45f85e",
                "sha256": "6759f81df4074278127ff32c12c9b4319d413312ca716c2264436a4f356333bd"
            },
            "downloads": -1,
            "filename": "ragwrangler-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "65784adc33c29ec0b3388acc0f45f85e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8235,
            "upload_time": "2023-09-16T23:02:58",
            "upload_time_iso_8601": "2023-09-16T23:02:58.671466Z",
            "url": "https://files.pythonhosted.org/packages/39/4d/a6ca2484fe65dec1ee2d0206e23b5c2c3808d925649ec7c391f97fef5572/ragwrangler-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b997756b9cf6f7c43f20b99457842c2e5c06e08195d189ce6480d063c5139120",
                "md5": "34fe9df6270ccdaf8975688f53ac977a",
                "sha256": "95d2a947d15006306a6ae9c901e4e6677f2bbb537becf6f0e58b072b2969897f"
            },
            "downloads": -1,
            "filename": "ragwrangler-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "34fe9df6270ccdaf8975688f53ac977a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8804,
            "upload_time": "2023-09-16T23:03:02",
            "upload_time_iso_8601": "2023-09-16T23:03:02.090688Z",
            "url": "https://files.pythonhosted.org/packages/b9/97/756b9cf6f7c43f20b99457842c2e5c06e08195d189ce6480d063c5139120/ragwrangler-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-16 23:03:02",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ragwrangler"
}
        
Elapsed time: 1.86358s