Skip to main content

llama-index packs longrag integration

Project description

LlamaIndex Packs Integration: LongRAG

This LlamaPack implements LongRAG based on this paper.

LongRAG retrieves large tokens at a time, with each retrieval unit being ~6k tokens long, consisting of entire documents or groups of documents. This contrasts the short retrieval units (100 word passages) of traditional RAG. LongRAG is advantageous because results can be achieved using only the top 4-8 retrieval units, and long-context LLMs can better understand the context of the documents because long retrieval units preserve their semantic integrity.

Installation

# installation
pip install llama-index-packs-longrag

# source code
llamaindex-cli download-llamapack LongRAGPack --download-dir ./longrag_pack

Code Usage

from llama_index.packs.longrag import LongRAGPack
from llama_index.llms.openai import OpenAI
from llama_index.core import Settings

Settings.llm = OpenAI("gpt-4o")

pack = LongRAGPack(data_dir="./data")

query_str = "How can Pittsburgh become a startup hub, and what are the two types of moderates?"
res = pack.run(query_str)
print(str(res))

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

llama_index_packs_longrag-0.5.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

llama_index_packs_longrag-0.5.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_packs_longrag-0.5.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_packs_longrag-0.5.0.tar.gz
Algorithm Hash digest
SHA256 4b24b66f3efb282f5977134fa48b1d2e23a9e3d2e27affa9c73881ac53ce0df4
MD5 2bec3b983ba19dadf5405e576b0510f5
BLAKE2b-256 e4de2ad84dfe29e86bd984930a4421e618bf81c12a50158b6de90989f911696b

See more details on using hashes here.

File details

Details for the file llama_index_packs_longrag-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_packs_longrag-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1ad230087a6038ce2a3532737106d4b596c836a72888e81babb731b47bcda4e
MD5 7a0f048aa1a9df8c95c04b4c55f57feb
BLAKE2b-256 9c570045f62f4a270369ba586cfc21a192352d3dd271ab2b82484dec18ce4877

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