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 <wai_leong1015@hotmail.com>

Apply spring-javaformat

Signed-off-by: waileong <wai_leong1015@hotmail.com>
This commit is contained in:
waileong
2025-02-24 07:10:17 +08:00
committed by Ilayaperumal Gopinathan
parent 07c2b9df1b
commit 0822c91ad7

View File

@@ -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))