# Corrective Retrieval Augmented Generation Llama Pack
This LlamaPack implements the Corrective Retrieval Augmented Generation (CRAG) [paper](https://arxiv.org/pdf/2401.15884.pdf)
Corrective Retrieval Augmented Generation (CRAG) is a method designed to enhance the robustness of language model generation by evaluating and augmenting the relevance of retrieved documents through a an evaluator and large-scale web searches, ensuring more accurate and reliable information is used in generation.
This LlamaPack uses [Tavily AI](https://app.tavily.com/home) API for web-searches. So, we recommend you to get the api-key before proceeding further.
### Installation
```bash
pip install llama-index llama-index-tools-tavily-research
```
## CLI Usage
You can download llamapacks directly using `llamaindex-cli`, which comes installed with the `llama-index` python package:
```bash
llamaindex-cli download-llamapack CorrectiveRAGPack --download-dir ./corrective_rag_pack
```
You can then inspect the files at `./corrective_rag_pack` and use them as a template for your own project.
## Code Usage
You can download the pack to a the `./corrective_rag_pack` directory:
```python
from llama_index.core.llama_pack import download_llama_pack
# download and install dependencies
CorrectiveRAGPack = download_llama_pack(
"CorrectiveRAGPack", "./corrective_rag_pack"
)
# You can use any llama-hub loader to get documents!
corrective_rag = CorrectiveRAGPack(documents, tavily_ai_api_key)
```
From here, you can use the pack, or inspect and modify the pack in `./corrective_rag_pack`.
The `run()` function contains around logic behind Corrective Retrieval Augmented Generation - [CRAG](https://arxiv.org/pdf/2401.15884.pdf) paper.
```python
response = corrective_rag.run("<query>", similarity_top_k=2)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-packs-corrective-rag",
"maintainer": "ravi-theja",
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "corrective, corrective_rag, crag, rag, retrieve",
"author": "Ravi Theja",
"author_email": "ravi03071991@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/22/25/25bbd82689b160829ac6f9ba43619e6787ae7b32cf3d68f37cfda7d142ad/llama_index_packs_corrective_rag-0.3.0.tar.gz",
"platform": null,
"description": "# Corrective Retrieval Augmented Generation Llama Pack\n\nThis LlamaPack implements the Corrective Retrieval Augmented Generation (CRAG) [paper](https://arxiv.org/pdf/2401.15884.pdf)\n\nCorrective Retrieval Augmented Generation (CRAG) is a method designed to enhance the robustness of language model generation by evaluating and augmenting the relevance of retrieved documents through a an evaluator and large-scale web searches, ensuring more accurate and reliable information is used in generation.\n\nThis LlamaPack uses [Tavily AI](https://app.tavily.com/home) API for web-searches. So, we recommend you to get the api-key before proceeding further.\n\n### Installation\n\n```bash\npip install llama-index llama-index-tools-tavily-research\n```\n\n## CLI Usage\n\nYou can download llamapacks directly using `llamaindex-cli`, which comes installed with the `llama-index` python package:\n\n```bash\nllamaindex-cli download-llamapack CorrectiveRAGPack --download-dir ./corrective_rag_pack\n```\n\nYou can then inspect the files at `./corrective_rag_pack` and use them as a template for your own project.\n\n## Code Usage\n\nYou can download the pack to a the `./corrective_rag_pack` directory:\n\n```python\nfrom llama_index.core.llama_pack import download_llama_pack\n\n# download and install dependencies\nCorrectiveRAGPack = download_llama_pack(\n \"CorrectiveRAGPack\", \"./corrective_rag_pack\"\n)\n\n# You can use any llama-hub loader to get documents!\ncorrective_rag = CorrectiveRAGPack(documents, tavily_ai_api_key)\n```\n\nFrom here, you can use the pack, or inspect and modify the pack in `./corrective_rag_pack`.\n\nThe `run()` function contains around logic behind Corrective Retrieval Augmented Generation - [CRAG](https://arxiv.org/pdf/2401.15884.pdf) paper.\n\n```python\nresponse = corrective_rag.run(\"<query>\", similarity_top_k=2)\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index packs corrective_rag paper implementation",
"version": "0.3.0",
"project_urls": null,
"split_keywords": [
"corrective",
" corrective_rag",
" crag",
" rag",
" retrieve"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f4717ab85d3f52ffe64c57d6fabb64c9b3024bc7af0899dfd4ddf3d6b5202a00",
"md5": "5186c998f8d54a0caee5004781c10087",
"sha256": "c1654d84f6799e821d2052dcb1657d02888bf02e55c19fb8ef89e3cf0066cceb"
},
"downloads": -1,
"filename": "llama_index_packs_corrective_rag-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5186c998f8d54a0caee5004781c10087",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 4849,
"upload_time": "2024-11-18T00:53:54",
"upload_time_iso_8601": "2024-11-18T00:53:54.965318Z",
"url": "https://files.pythonhosted.org/packages/f4/71/7ab85d3f52ffe64c57d6fabb64c9b3024bc7af0899dfd4ddf3d6b5202a00/llama_index_packs_corrective_rag-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "222525bbd82689b160829ac6f9ba43619e6787ae7b32cf3d68f37cfda7d142ad",
"md5": "5e3d78bbd1bf963cbd423d939348ec68",
"sha256": "e65cad5cdbf9a161417232807b9b4699d264a57fc7f56d8ea2235a908d1d8225"
},
"downloads": -1,
"filename": "llama_index_packs_corrective_rag-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "5e3d78bbd1bf963cbd423d939348ec68",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 4616,
"upload_time": "2024-11-18T00:53:55",
"upload_time_iso_8601": "2024-11-18T00:53:55.895426Z",
"url": "https://files.pythonhosted.org/packages/22/25/25bbd82689b160829ac6f9ba43619e6787ae7b32cf3d68f37cfda7d142ad/llama_index_packs_corrective_rag-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-18 00:53:55",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-packs-corrective-rag"
}