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
Release history Release notifications | RSS feed
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
Close
Hashes for llama_index_packs_longrag-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc3645462b3140bd91bf0a787f0fd37642bf9afefc63f1dda62f800f53b90727 |
|
MD5 | 15a136b6467df3733f0f64d602ebfd33 |
|
BLAKE2b-256 | d7b470fd640c97fc982e79f014a641085b589bd03196f34601976c75d8636f55 |
Close
Hashes for llama_index_packs_longrag-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e575780d599b9f43a87f4451af9363e3012982b7013dfbf275c6c43a38ea459 |
|
MD5 | 05b6013ce2399d89c88a7d3482605a33 |
|
BLAKE2b-256 | 4279a2847bc6dbc12bcbaddfd2edd7968812ac14e6e0d05c4abd8870d3e3c8dd |