Skip to main content

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

File details

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

File metadata

File hashes

Hashes for llama_index_packs_multi_tenancy_rag-0.4.0.tar.gz
Algorithm Hash digest
SHA256 374cf5f7991aa007f505fc93528193197526547311b2b9d7c5ae314785fdcc2c
MD5 9a89d007fd380a01f7d8de01e57b901d
BLAKE2b-256 17a6972b39a5dc9e5e25ffe15863ca2be6b52ea19f55f260dbd5713442fea8c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_packs_multi_tenancy_rag-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c085cbe82533f695114d985b4affaa38ff59a79d45218e36e30c4d3c4bab48d
MD5 9ed2e44ada5f73baf5ca4d58182b9305
BLAKE2b-256 7e55137adfc648940e4743148894e7733d0c2f558651be40123a9b0a7c0a1db5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page