Skip to main content

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


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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file llama_index_vector_stores_azurecosmosnosql-1.4.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_vector_stores_azurecosmosnosql-1.4.1.tar.gz
Algorithm Hash digest
SHA256 bf08dfcc9b02afc8ecd4ec4ea24e32c3a3adcd0e752c101a3e4375418726fcf3
MD5 0cbdc4f1ec6d41a11d33169912de3040
BLAKE2b-256 12a9d0f55836a7e4c6c21e3477f6dd388dc02a9ab19b0f42d16bac27ade096ea

See more details on using hashes here.

File details

Details for the file llama_index_vector_stores_azurecosmosnosql-1.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_vector_stores_azurecosmosnosql-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c96932c7d2acd4c69cd1036eee9b194b22c5e879698f5da4b6ccd448bef7625b
MD5 244d1ad9eb0659a996b093c51dde5752
BLAKE2b-256 86758911110aea9718bf8519972cb7cef4824c2524acf7c9cfdc5f40f1a09812

See more details on using hashes here.

Supported by

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