llama-index-packs-ragatouille-retriever


Namellama-index-packs-ragatouille-retriever JSON
Version 0.4.0 PyPI version JSON
download
home_pageNone
Summaryllama-index packs ragatouille_retriever integration
upload_time2024-11-18 01:34:22
maintainerjerryjliu
docs_urlNone
authorYour Name
requires_python<4.0,>=3.9
licenseMIT
keywords rag ragatouille retriever
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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": null,
    "name": "llama-index-packs-ragatouille-retriever",
    "maintainer": "jerryjliu",
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "rag, ragatouille, retriever",
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/32/f4/866fb57aa75305c3d5aa18679ed62266a207163eb160ca32ac1eaca18f68/llama_index_packs_ragatouille_retriever-0.4.0.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.4.0",
    "project_urls": null,
    "split_keywords": [
        "rag",
        " ragatouille",
        " retriever"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f5e94282989f4ba6dc7cf1ac4d8f70ea57dac2a9ef87d909bd569bc9ef5d2055",
                "md5": "e9874dc9760a09b4eb54db1c087740b0",
                "sha256": "73d41415a09432e9cf2eb37cde1394a234446381a69dd95fe8a15e424492dfa5"
            },
            "downloads": -1,
            "filename": "llama_index_packs_ragatouille_retriever-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e9874dc9760a09b4eb54db1c087740b0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 3899,
            "upload_time": "2024-11-18T01:34:21",
            "upload_time_iso_8601": "2024-11-18T01:34:21.721601Z",
            "url": "https://files.pythonhosted.org/packages/f5/e9/4282989f4ba6dc7cf1ac4d8f70ea57dac2a9ef87d909bd569bc9ef5d2055/llama_index_packs_ragatouille_retriever-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "32f4866fb57aa75305c3d5aa18679ed62266a207163eb160ca32ac1eaca18f68",
                "md5": "1ce449c1c6199c02b85eb67ba87966fa",
                "sha256": "55a80af76e9f878b802604ab2a63dbb7f8d4d4743b19c756ede32a98f503441d"
            },
            "downloads": -1,
            "filename": "llama_index_packs_ragatouille_retriever-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1ce449c1c6199c02b85eb67ba87966fa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 3496,
            "upload_time": "2024-11-18T01:34:22",
            "upload_time_iso_8601": "2024-11-18T01:34:22.942302Z",
            "url": "https://files.pythonhosted.org/packages/32/f4/866fb57aa75305c3d5aa18679ed62266a207163eb160ca32ac1eaca18f68/llama_index_packs_ragatouille_retriever-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-18 01:34:22",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-packs-ragatouille-retriever"
}
        
Elapsed time: 0.43876s