llama-index packs multi_tenancy_rag integration
Project description
Multi-Tenancy RAG Pack
Create a Multi-Tenancy RAG using VectorStoreIndex.
CLI Usage
You can download llamapacks directly using llamaindex-cli
, which comes installed with the llama-index
python package:
llamaindex-cli download-llamapack MultiTenancyRAGPack --download-dir ./multitenancy_rag_pack
You can then inspect the files at ./multitenancy_rag_pack
and use them as a template for your own project.
Code Usage
You can download the pack to a the ./multitenancy_rag_pack
directory:
from llama_index.core.llama_pack import download_llama_pack
# download and install dependencies
MultiTenancyRAGPack = download_llama_pack(
"MultiTenancyRAGPack", "./multitenancy_rag_pack"
)
# You can use any llama-hub loader to get documents and add them to index for a user!
multitenancy_rag_pack = MultiTenancyRAGPack()
multitenancy_rag_pack.add(documents, "<user>")
From here, you can use the pack, or inspect and modify the pack in ./multitenancy_rag_pack
.
The run()
function is a light wrapper around index.as_query_engine().query()
.
response = multitenancy_rag_pack.run(
"<user query>", user="<user>", similarity_top_k=2
)
You can also use modules individually.
# Use the index directly
index = multitenancy_rag_pack.index
query_engine = index.as_query_engine(
filters=MetadataFilters(
filters=[
ExactMatchFilter(
key="user",
value="<user>",
)
]
)
)
retriver = index.as_retriever(
filters=MetadataFilters(
filters=[
ExactMatchFilter(
key="user",
value="<user>",
)
]
)
)
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
Close
Hashes for llama_index_packs_multi_tenancy_rag-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a5de1c2e2542470bc0ee4761d31929af0e58d0de15e0df19d324181e36ca822 |
|
MD5 | bc96d19f9ee829d0a41be097a1188b54 |
|
BLAKE2b-256 | 02b5af47f20cabf8a9d06d656e3cafa68e72fa81eaa1064eb9566fa474223320 |
Close
Hashes for llama_index_packs_multi_tenancy_rag-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cf63e92b1f702c4a3a672d284754ced44a4344d9be3f30cbb532f02db42b089 |
|
MD5 | 4826f1201ed53f0897384ef4e8e41c1d |
|
BLAKE2b-256 | 1bc74aa8a33e0185371090fb6f21b173eb2cebbf6b3208871573bf721433d829 |