llama-index packs corrective_rag paper implementation
Project description
Corrective Retrieval Augmented Generation Llama Pack
This LlamaPack implements the Corrective Retrieval Augmented Generation (CRAG) paper
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 API for web-searches. So, we recommend you to get the api-key before proceeding further.
Installation
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:
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:
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 paper.
response = corrective_rag.run("<query>", similarity_top_k=2)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for llama_index_packs_corrective_rag-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9112b454f97d07614043e8ee0c72078733e0414dd6c90aa77dedb6d174dc5f0 |
|
MD5 | fc36cd0c4fe897f3ee0f12dac3ccdbcc |
|
BLAKE2b-256 | 61e035a694429b27848d5d927831dd99aaceacee7b9761c8f089536359c70321 |
Hashes for llama_index_packs_corrective_rag-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1b03a06f22a1ccca6a7d406853ed668117a4159b23d8597915156a73e905797 |
|
MD5 | 9cbfaa8396a7455b3c18f77e69138aa9 |
|
BLAKE2b-256 | f146e6b96b12121669218e4137de2e4833a946ea9fd30b0e2b347c0cc33c8308 |