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.4.0.tar.gz (5.4 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.4.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llama_index_packs_longrag-0.4.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0

File hashes

Hashes for llama_index_packs_longrag-0.4.0.tar.gz
Algorithm Hash digest
SHA256 958235009d5acb84c94f9f70b8783403a8185b523eec81078c5818a2c8476ce2
MD5 5d7abc2a214cfc37f2da4a4e31f2ff3d
BLAKE2b-256 2d69c8964b1c15ff35c558e5f6681b555f59ee74dcbd36bdcb5a0ea9211a6544

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_packs_longrag-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb502e8558206847af8cc50a85caf9f65846eda6eec9c7185ce57632465e649f
MD5 4cc09f9af12b9aaf02e1cdd769887051
BLAKE2b-256 39a5ac6aafeac55c3e2e733d0834b223230fc76b92bfe7bbe54ac856199b087c

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