From 0822c91ad7620566a3868b3dad47d3e4c7985a0e Mon Sep 17 00:00:00 2001 From: waileong Date: Mon, 24 Feb 2025 07:10:17 +0800 Subject: [PATCH] Added configuration options for database, collection names, embedding dimensions, index and metric types, and field names in the MilvusVectorStoreAutoConfiguration. - Configuration options like `databaseName`, `collectionName`, `embeddingDimension`, `indexType`, and `metricType` were added. - Additional parameters including `indexParameters`, `iDFieldName`, `contentFieldName`, `metadataFieldName`, and `embeddingFieldName` were incorporated into the builder method. Signed-off-by: waileong Apply spring-javaformat Signed-off-by: waileong --- .../milvus/MilvusVectorStoreAutoConfiguration.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/milvus/MilvusVectorStoreAutoConfiguration.java b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/milvus/MilvusVectorStoreAutoConfiguration.java index 09905a623..bb432b135 100644 --- a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/milvus/MilvusVectorStoreAutoConfiguration.java +++ b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/milvus/MilvusVectorStoreAutoConfiguration.java @@ -22,6 +22,8 @@ import io.micrometer.observation.ObservationRegistry; import io.milvus.client.MilvusServiceClient; import io.milvus.param.ConnectParam; +import io.milvus.param.IndexType; +import io.milvus.param.MetricType; import org.springframework.ai.embedding.BatchingStrategy; import org.springframework.ai.embedding.EmbeddingModel; import org.springframework.ai.embedding.TokenCountBatchingStrategy; @@ -70,6 +72,17 @@ public class MilvusVectorStoreAutoConfiguration { return MilvusVectorStore.builder(milvusClient, embeddingModel) .initializeSchema(properties.isInitializeSchema()) + .databaseName(properties.getDatabaseName()) + .collectionName(properties.getCollectionName()) + .embeddingDimension(properties.getEmbeddingDimension()) + .indexType(IndexType.valueOf(properties.getIndexType().name())) + .metricType(MetricType.valueOf(properties.getMetricType().name())) + .indexParameters(properties.getIndexParameters()) + .iDFieldName(properties.getIdFieldName()) + .autoId(properties.isAutoId()) + .contentFieldName(properties.getContentFieldName()) + .metadataFieldName(properties.getMetadataFieldName()) + .embeddingFieldName(properties.getEmbeddingFieldName()) .batchingStrategy(batchingStrategy) .observationRegistry(observationRegistry.getIfUnique(() -> ObservationRegistry.NOOP)) .customObservationConvention(customObservationConvention.getIfAvailable(() -> null))