Skip to main content

llama-index index_store azure integration

Project description

LlamaIndex Index_Store Integration: Azure Table Storage

AzureIndexStore utilizes Azure Table Storage and Cosmos DB to provide an index storage solution for indexing documents or data.

Installation

Before using the AzureIndexStore, ensure you have Python installed and then proceed to install the required packages:

pip install llama-index-storage-index-store-azure
pip install azure-data-tables
pip install azure-identity  # Only needed for AAD token authentication

Initializing AzureIndexStore

AzureIndexStore can be initialized in several ways depending on the authentication method and the Azure service (Table Storage or Cosmos DB) you are using:

1. Using a Connection String

from llama_index.storage.index_store.azure import AzureIndexStore
from llama_index.storage.kvstore.azure.base import ServiceMode

store = AzureIndexStore.from_connection_string(
    connection_string="your_connection_string_here",
    namespace="your_namespace",
    service_mode=ServiceMode.STORAGE,  # or ServiceMode.COSMOS
)

2. Using Account Name and Key

store = AzureIndexStore.from_account_and_key(
    account_name="your_account_name",
    account_key="your_account_key",
    service_mode=ServiceMode.STORAGE,  # or ServiceMode.COSMOS
)

3. Using SAS Token

store = AzureIndexStore.from_sas_token(
    endpoint="your_endpoint",
    sas_token="your_sas_token",
    service_mode=ServiceMode.STORAGE,  # or ServiceMode.COSMOS
)

4. Using Azure Active Directory (AAD) Token

store = AzureIndexStore.from_aad_token(
    endpoint="your_endpoint",
    service_mode=ServiceMode.STORAGE,  # or ServiceMode.COSMOS
)

End-to-end example:

from llama_index.core import SimpleDirectoryReader, StorageContext
from llama_index.core.node_parser import SentenceSplitter
from llama_index.core import VectorStoreIndex

reader = SimpleDirectoryReader("./data/paul_graham/")
documents = reader.load_data()
nodes = SentenceSplitter().get_nodes_from_documents(documents)

storage_context = StorageContext.from_defaults(
    index_store=AzureIndexStore.from_account_and_key(
        "your_account_name",
        "your_account_key",
        service_mode=ServiceMode.STORAGE,
    ),
)

storage_context.docstore.add_documents(nodes)

keyword_table_index = SimpleKeywordTableIndex(
    nodes, storage_context=storage_context
)

vector_index = VectorStoreIndex(nodes, storage_context=storage_context)

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_storage_index_store_azure-0.3.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_storage_index_store_azure-0.3.1.tar.gz
Algorithm Hash digest
SHA256 df8e895e90883a0b9dd042d1bfdc8b28cd8210a88b089f128bb8f356f864d24c
MD5 f88d228f1a0392cf7515402455c84da2
BLAKE2b-256 6af5bcad5e2ae74da138ad26cbcb4c15636eaafbc48801532fe17d0461f0c76f

See more details on using hashes here.

File details

Details for the file llama_index_storage_index_store_azure-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_storage_index_store_azure-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e1ecf682ad8f71b349043fdcb3326b081844246ce77afeaf4ccd6240b1d7109e
MD5 d0fde262d9ddbd6e9b5d04b691e83e06
BLAKE2b-256 af0833dd6b43c619310e54ea590f9c186682fd6e22b123d6f68201fdb3a1ee96

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