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.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_vector_stores_azurecosmosnosql-1.4.0.tar.gz
Algorithm Hash digest
SHA256 88abc0f68732d70b222467140b283718f48866bdd73bedba4b947c625b2448f5
MD5 dbdae5a0351db38347b46da441e0502a
BLAKE2b-256 a28273532104ca4494b782f0d00592ef2984991bf8cfc89eec0cb5b8e100806b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_vector_stores_azurecosmosnosql-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a79d8e07ab09f63f757cc2b6c0bde74cecfd33ab2feb74ec467caa462a089a5b
MD5 ff567c09582114d1034ad5057e511223
BLAKE2b-256 acbc299221e3a604b512ba4dbb56b13347514028bf44138a1f69240accebdd08

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