llama-index vector_stores azurecosmosnosql integration
Project description
Azure Cosmos DB for NoSQL Vector Store
This integration makes possible to use Azure Cosmos DB for NoSQL as a vector store in LlamaIndex.
Quick start
Install the integration with:
pip install llama-index-vector-stores-azurecosmosnosql
Create the CosmosDB client:
URI = "AZURE_COSMOSDB_URI"
KEY = "AZURE_COSMOSDB_KEY"
client = CosmosClient(URI, credential=KEY)
Specify the vector store properties:
indexing_policy = {
"indexingMode": "consistent",
"includedPaths": [{"path": "/*"}],
"excludedPaths": [{"path": '/"_etag"/?'}],
"vectorIndexes": [{"path": "/embedding", "type": "quantizedFlat"}],
}
vector_embedding_policy = {
"vectorEmbeddings": [
{
"path": "/embedding",
"dataType": "float32",
"distanceFunction": "cosine",
"dimensions": 3072,
}
]
}
Create the vector store:
store = AzureCosmosDBNoSqlVectorSearch(
cosmos_client=client,
vector_embedding_policy=vector_embedding_policy,
indexing_policy=indexing_policy,
cosmos_container_properties={"partition_key": PartitionKey(path="/id")},
cosmos_database_properties={},
create_container=True,
)
Finally, create the index from a list containing documents:
storage_context = StorageContext.from_defaults(vector_store=store)
index = VectorStoreIndex.from_documents(
documents, storage_context=storage_context
)
Project details
Release history Release notifications | RSS feed
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_vector_stores_azurecosmosnosql-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 054474ee3012baac81efc8256ecda4260b3497e81c8ec4f91eeaf31087814c18 |
|
MD5 | 4a7fcb999f1ae785a195d70adf247953 |
|
BLAKE2b-256 | 7cab428575966f623cab649771c77f360e833bc6293c0285a4cf5fb9e1dbdf62 |
Close
Hashes for llama_index_vector_stores_azurecosmosnosql-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d223f1d2cdaa24767db77f9ef48c8a11eb98d65300718ac44aa84ba3ff125d0e |
|
MD5 | cfac3b407165a90dbd681eed1f1252b9 |
|
BLAKE2b-256 | 074002ad1688ca9ea27ddad62b4c5b1cd63a919384a460c8a463078100b96810 |