# RAGatouille Retriever Pack
RAGatouille is a [cool library](https://github.com/bclavie/RAGatouille) that lets you use e.g. ColBERT and other SOTA retrieval models in your RAG pipeline. You can use it to either run inference on ColBERT, or use it to train/fine-tune models.
This LlamaPack shows you an easy way to bundle RAGatouille into your RAG pipeline. We use RAGatouille to index a corpus of documents (by default using colbertv2.0), and then we combine it with LlamaIndex query modules to synthesize an answer with an LLM.
A full notebook guide can be found [here](https://github.com/run-llama/llama-hub/blob/main/llama_hub/llama_packs/ragatouille_retriever/ragatouille_retriever.ipynb).
## CLI Usage
You can download llamapacks directly using `llamaindex-cli`, which comes installed with the `llama-index` python package:
```bash
llamaindex-cli download-llamapack RAGatouilleRetrieverPack --download-dir ./ragatouille_pack
```
You can then inspect the files at `./` and use them as a template for your own project!
## Code Usage
You can download the pack to a `./ragatouille_pack` directory:
```python
from llama_index.core.llama_pack import download_llama_pack
# download and install dependencies
RAGatouilleRetrieverPack = download_llama_pack(
"RAGatouilleRetrieverPack", "./ragatouille_pack"
)
```
From here, you can use the pack, or inspect and modify the pack in `./ragatouille_pack`.
Then, you can set up the pack like so:
```python
# create the pack
ragatouille_pack = RAGatouilleRetrieverPack(
docs, # List[Document]
llm=OpenAI(model="gpt-3.5-turbo"),
index_name="my_index",
top_k=5,
)
```
The `run()` function is a light wrapper around `query_engine.query`.
```python
response = ragatouille_pack.run("How does ColBERTv2 compare to BERT")
```
You can also use modules individually.
```python
from llama_index.core.response.notebook_utils import display_source_node
retriever = ragatouille_pack.get_modules()["retriever"]
nodes = retriever.retrieve("How does ColBERTv2 compare with BERT?")
for node in nodes:
display_source_node(node)
# try out the RAG module directly
RAG = ragatouille_pack.get_modules()["RAG"]
results = RAG.search(
"How does ColBERTv2 compare with BERT?", index_name=index_name, k=4
)
results
```
Raw data
{
"_id": null,
"home_page": "",
"name": "llama-index-packs-ragatouille-retriever",
"maintainer": "jerryjliu",
"docs_url": null,
"requires_python": ">=3.8.1,<4.0",
"maintainer_email": "",
"keywords": "rag,ragatouille,retriever",
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/5d/62/aa2617f70485e7fdfb14fa92602e75a0f2922c48e8a2331b0ce3a2e0cd86/llama_index_packs_ragatouille_retriever-0.1.3.tar.gz",
"platform": null,
"description": "# RAGatouille Retriever Pack\n\nRAGatouille is a [cool library](https://github.com/bclavie/RAGatouille) that lets you use e.g. ColBERT and other SOTA retrieval models in your RAG pipeline. You can use it to either run inference on ColBERT, or use it to train/fine-tune models.\n\nThis LlamaPack shows you an easy way to bundle RAGatouille into your RAG pipeline. We use RAGatouille to index a corpus of documents (by default using colbertv2.0), and then we combine it with LlamaIndex query modules to synthesize an answer with an LLM.\n\nA full notebook guide can be found [here](https://github.com/run-llama/llama-hub/blob/main/llama_hub/llama_packs/ragatouille_retriever/ragatouille_retriever.ipynb).\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 RAGatouilleRetrieverPack --download-dir ./ragatouille_pack\n```\n\nYou can then inspect the files at `./` and use them as a template for your own project!\n\n## Code Usage\n\nYou can download the pack to a `./ragatouille_pack` directory:\n\n```python\nfrom llama_index.core.llama_pack import download_llama_pack\n\n# download and install dependencies\nRAGatouilleRetrieverPack = download_llama_pack(\n \"RAGatouilleRetrieverPack\", \"./ragatouille_pack\"\n)\n```\n\nFrom here, you can use the pack, or inspect and modify the pack in `./ragatouille_pack`.\n\nThen, you can set up the pack like so:\n\n```python\n# create the pack\nragatouille_pack = RAGatouilleRetrieverPack(\n docs, # List[Document]\n llm=OpenAI(model=\"gpt-3.5-turbo\"),\n index_name=\"my_index\",\n top_k=5,\n)\n```\n\nThe `run()` function is a light wrapper around `query_engine.query`.\n\n```python\nresponse = ragatouille_pack.run(\"How does ColBERTv2 compare to BERT\")\n```\n\nYou can also use modules individually.\n\n```python\nfrom llama_index.core.response.notebook_utils import display_source_node\n\nretriever = ragatouille_pack.get_modules()[\"retriever\"]\nnodes = retriever.retrieve(\"How does ColBERTv2 compare with BERT?\")\n\nfor node in nodes:\n display_source_node(node)\n\n# try out the RAG module directly\nRAG = ragatouille_pack.get_modules()[\"RAG\"]\nresults = RAG.search(\n \"How does ColBERTv2 compare with BERT?\", index_name=index_name, k=4\n)\nresults\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index packs ragatouille_retriever integration",
"version": "0.1.3",
"project_urls": null,
"split_keywords": [
"rag",
"ragatouille",
"retriever"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c88c00ac9c318b75c115637310ccb68e868e99f413982b6a5e98015a200d592c",
"md5": "23b79dc0f48ed40af8f1143b1222919a",
"sha256": "e22e2d02e1cbc7d838020c76c2821b935431d329476d57765b350f4d06160998"
},
"downloads": -1,
"filename": "llama_index_packs_ragatouille_retriever-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "23b79dc0f48ed40af8f1143b1222919a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1,<4.0",
"size": 3922,
"upload_time": "2024-02-22T01:31:30",
"upload_time_iso_8601": "2024-02-22T01:31:30.375954Z",
"url": "https://files.pythonhosted.org/packages/c8/8c/00ac9c318b75c115637310ccb68e868e99f413982b6a5e98015a200d592c/llama_index_packs_ragatouille_retriever-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5d62aa2617f70485e7fdfb14fa92602e75a0f2922c48e8a2331b0ce3a2e0cd86",
"md5": "af6c102fa6cd906c7fd924523f453d71",
"sha256": "6b90363fbc7f65578e621a40f262cab9a609cfc224c9d1df900b14e707f9152b"
},
"downloads": -1,
"filename": "llama_index_packs_ragatouille_retriever-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "af6c102fa6cd906c7fd924523f453d71",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1,<4.0",
"size": 3505,
"upload_time": "2024-02-22T01:31:33",
"upload_time_iso_8601": "2024-02-22T01:31:33.139463Z",
"url": "https://files.pythonhosted.org/packages/5d/62/aa2617f70485e7fdfb14fa92602e75a0f2922c48e8a2331b0ce3a2e0cd86/llama_index_packs_ragatouille_retriever-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-22 01:31:33",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-packs-ragatouille-retriever"
}