Skip to content

Commit e258d1c

Browse files
committed
add doc changes
1 parent e32efcf commit e258d1c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/azure-cosmos-db.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ The following configuration properties are available for the Cosmos DB vector st
118118
| spring.ai.vectorstore.cosmosdb.vectorStoreThroughput | The throughput for the vector store.
119119
| spring.ai.vectorstore.cosmosdb.vectorDimensions | The number of dimensions for the vectors.
120120
| spring.ai.vectorstore.cosmosdb.endpoint | The endpoint for the Cosmos DB.
121-
| spring.ai.vectorstore.cosmosdb.key | The key for the Cosmos DB.
121+
| spring.ai.vectorstore.cosmosdb.key | The key for the Cosmos DB (if key is not present, [DefaultAzureCredential](https://learn.microsoft.com/azure/developer/java/sdk/authentication/credential-chains#defaultazurecredential-overview) will be used).
122122
|===
123123

124124

@@ -152,7 +152,7 @@ List<Document> results = vectorStore.similaritySearch(SearchRequest.builder().qu
152152

153153
== Setting up Azure Cosmos DB Vector Store without Auto Configuration
154154

155-
The following code demonstrates how to set up the `CosmosDBVectorStore` without relying on auto-configuration:
155+
The following code demonstrates how to set up the `CosmosDBVectorStore` without relying on auto-configuration. [DefaultAzureCredential](https://learn.microsoft.com/azure/developer/java/sdk/authentication/credential-chains#defaultazurecredential-overview) is recommended for authentication to Azure Cosmos DB.
156156

157157
[source,java]
158158
----
@@ -161,7 +161,7 @@ public VectorStore vectorStore(ObservationRegistry observationRegistry) {
161161
// Create the Cosmos DB client
162162
CosmosAsyncClient cosmosClient = new CosmosClientBuilder()
163163
.endpoint(System.getenv("COSMOSDB_AI_ENDPOINT"))
164-
.key(System.getenv("COSMOSDB_AI_KEY"))
164+
.credential(new DefaultAzureCredentialBuilder().build())
165165
.userAgentSuffix("SpringAI-CDBNoSQL-VectorStore")
166166
.gatewayMode()
167167
.buildAsyncClient();

0 commit comments

Comments
 (0)