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

File metadata

File hashes

Hashes for llama_index_vector_stores_azurecosmosnosql-1.3.0.tar.gz
Algorithm Hash digest
SHA256 0b8e3b4b4932ab9b7ae84d01660a3dc7019b3491d6b19278e93a8c7cfcc3c1b1
MD5 ee2b6ff4dd817ad65dc7af4cb32ded48
BLAKE2b-256 4585d7ebe3db11b5a2f56897aac5a1ae770d0c33aa5a6162771fa9c630d67a83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_vector_stores_azurecosmosnosql-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e5b662a5ae8cd7dd26824a7fcd0c9ddaa1751d7b033cc6baae990cfeb68ff6c
MD5 1b4d69ce77bf5cb159b80b780f695836
BLAKE2b-256 c9c61b1f4fb684083333d777b8b6e5b72f62898ed88bd305b26e13d942dfa819

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