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.0.tar.gz
.
File metadata
- Download URL: llama_index_storage_index_store_azure-0.3.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e37696e7be069cfd47323a1764d706404fb8a08ea440cc0f8afa6d8de439f2b |
|
MD5 | 8654dd30723a8a380a9c43ba344ea323 |
|
BLAKE2b-256 | 9831e667656cb8d0199fd54b7fa5c9a9d8d902d86db202ec9ed9c03e8e10c5a4 |
File details
Details for the file llama_index_storage_index_store_azure-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_storage_index_store_azure-0.3.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28766092108ba388a9c0124ddbe15d48918273a1ffca13ea8882c9a9f0dad2bb |
|
MD5 | f8704047c2b0069e44a098672d5ef59b |
|
BLAKE2b-256 | 1e60a12ca5435c32e690ad6095122b8f889c71adb76e9327957c36c01a07d380 |