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.1.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.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for llama_index_packs_longrag-0.5.1.tar.gz
Algorithm Hash digest
SHA256 5a0673cdb8a0459a55b1ad11d88183acc27ccb7d9012cb221fb7a00c515eac08
MD5 0581f976159145ed1699bfb6ae3578e8
BLAKE2b-256 272acd56a0a8daf5aff3464e02a45e42e904cf1d902585d22bbeccf9061a87ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_packs_longrag-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06f8d399d8d647c5b11f810a023f0910e5daa4ace85fd670890de849279bb3c7
MD5 cecc5b455a8b950fe78cd9b8d04434af
BLAKE2b-256 914830e7f969f47e0e0bb78725c4db91ce21fe79048b40f122bdc02ec577ec8a

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