# 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": "",
"name": "llama-index-packs-corrective-rag",
"maintainer": "ravi-theja",
"docs_url": null,
"requires_python": ">=3.8.1,<3.12",
"maintainer_email": "",
"keywords": "corrective,corrective_rag,crag,rag,retrieve",
"author": "Ravi Theja",
"author_email": "ravi03071991@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/61/e0/35a694429b27848d5d927831dd99aaceacee7b9761c8f089536359c70321/llama_index_packs_corrective_rag-0.1.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.1.0",
"project_urls": null,
"split_keywords": [
"corrective",
"corrective_rag",
"crag",
"rag",
"retrieve"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f146e6b96b12121669218e4137de2e4833a946ea9fd30b0e2b347c0cc33c8308",
"md5": "9cbfaa8396a7455b3c18f77e69138aa9",
"sha256": "a1b03a06f22a1ccca6a7d406853ed668117a4159b23d8597915156a73e905797"
},
"downloads": -1,
"filename": "llama_index_packs_corrective_rag-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9cbfaa8396a7455b3c18f77e69138aa9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1,<3.12",
"size": 4623,
"upload_time": "2024-02-16T02:13:51",
"upload_time_iso_8601": "2024-02-16T02:13:51.478578Z",
"url": "https://files.pythonhosted.org/packages/f1/46/e6b96b12121669218e4137de2e4833a946ea9fd30b0e2b347c0cc33c8308/llama_index_packs_corrective_rag-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "61e035a694429b27848d5d927831dd99aaceacee7b9761c8f089536359c70321",
"md5": "fc36cd0c4fe897f3ee0f12dac3ccdbcc",
"sha256": "c9112b454f97d07614043e8ee0c72078733e0414dd6c90aa77dedb6d174dc5f0"
},
"downloads": -1,
"filename": "llama_index_packs_corrective_rag-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "fc36cd0c4fe897f3ee0f12dac3ccdbcc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1,<3.12",
"size": 4281,
"upload_time": "2024-02-16T02:13:53",
"upload_time_iso_8601": "2024-02-16T02:13:53.690165Z",
"url": "https://files.pythonhosted.org/packages/61/e0/35a694429b27848d5d927831dd99aaceacee7b9761c8f089536359c70321/llama_index_packs_corrective_rag-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-16 02:13:53",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-packs-corrective-rag"
}