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>",
)
]
)
)
retriever = 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.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70f51b969b9f9ddf62c2e09ebd006f0d10fdab64440aaa1b9e65e2048d150772 |
|
MD5 | 76849e9d751e53fa5c201908380e8b3a |
|
BLAKE2b-256 | e5600ab607eed4c88983e3011a671592a1d624f101d9302b391a42e9ec5d5859 |
Close
Hashes for llama_index_packs_multi_tenancy_rag-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6a6229a3155c29c6ebd23c8ce72b99c0e7d3e7a0df94b6dc4142a3ff1245f61 |
|
MD5 | ee58dcdf87d08f5b8493708c13c4e7a9 |
|
BLAKE2b-256 | 2724ac715c255a1850f2eec927fcd406e82dbb15016ce248e85d1ad169cc478f |