Skip to main content

llama-index packs ragatouille_retriever integration

Project description

RAGatouille Retriever Pack

RAGatouille is a cool library 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.

CLI Usage

You can download llamapacks directly using llamaindex-cli, which comes installed with the llama-index python package:

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:

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:

# 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.

response = ragatouille_pack.run("How does ColBERTv2 compare to BERT")

You can also use modules individually.

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

Project details


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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file llama_index_packs_ragatouille_retriever-0.4.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_packs_ragatouille_retriever-0.4.1.tar.gz
Algorithm Hash digest
SHA256 26c0ee408a72cd3efdbd116aea6a66fddd28d9d5ddcea6f2968e23ae4820b3f9
MD5 80fec0062edf4a9f2d0d7dad3e1d8dd8
BLAKE2b-256 bef0986cb4afd1f3aef88ff9e8ff9e89b43524a0c01a1e6bf2128609889942a5

See more details on using hashes here.

File details

Details for the file llama_index_packs_ragatouille_retriever-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_packs_ragatouille_retriever-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d10bddb825432e70dc0ec0ec086526d5ecf4476acb722f1911d0cd748a7668eb
MD5 d2b21c20c57a0e8f15265d5d59af650d
BLAKE2b-256 0d7825a1328f8289ca1ecae1ac0e155721005c357ec9c1bfd3bd28b91039058a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page