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
File details
Details for the file llama_index_vector_stores_azurecosmosnosql-1.2.0.tar.gz
.
File metadata
- Download URL: llama_index_vector_stores_azurecosmosnosql-1.2.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05e9ad56b5f18b68222f6b6cc78b510866b56ad225171fb4b271416aa496409c |
|
MD5 | 9f1a7966563b13d5ba8e5adebc6bcd7d |
|
BLAKE2b-256 | 529956335ccc8093c1130f006c78ad4f3c7812e19cb0451cbb2546bc81bd1a24 |
File details
Details for the file llama_index_vector_stores_azurecosmosnosql-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_vector_stores_azurecosmosnosql-1.2.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e3b9811ce14297db4553125d623eb348cc9881b7bf04a16d3ba5820db19c020 |
|
MD5 | 5a713c3d209f9b44e5e00fc1200c1d35 |
|
BLAKE2b-256 | 37d3f785902b7ecbf720f9245a14abceb6d9e5e2b4fc0c2cdbb61a704732bd37 |