Description

In MilvusVectorStoreAutoConfiguration, the @Bean method for MilvusVectorStore only passes .initializeSchema(properties.isInitializeSchema()) to configure the MilvusVectorStore. Other important properties from MilvusVectorStoreProperties are missing, which limits the configurability of the Milvus vector store.

Affected Component

  • Class: MilvusVectorStoreAutoConfiguration
  • Method: public MilvusVectorStore vectorStore(...)
  • Missing Properties:
  • databaseName
  • collectionName
  • embeddingDimension
  • indexType
  • metricType
  • indexParameters
  • idFieldName
  • isAutoId
  • contentFieldName
  • metadataFieldName
  • embeddingFieldName

Expected Behavior

All relevant properties defined in MilvusVectorStoreProperties should be properly passed to the MilvusVectorStore builder to ensure full configuration capability.

Current Behavior

Only .initializeSchema(properties.isInitializeSchema()) is being set, causing other configuration settings to be ignored.

Steps to Reproduce

  1. Use MilvusVectorStoreAutoConfiguration in an application.
  2. Define properties such as databaseName, collectionName, or indexType.
  3. Observe that these properties are not applied to the MilvusVectorStore instance.

Possible Fix

Modify the vectorStore bean definition to include all necessary properties:

@Bean
@ConditionalOnMissingBean
public MilvusVectorStore vectorStore(MilvusServiceClient milvusClient, EmbeddingModel embeddingModel,
        MilvusVectorStoreProperties properties, BatchingStrategy batchingStrategy,
        ObjectProvider<ObservationRegistry> observationRegistry,
        ObjectProvider<VectorStoreObservationConvention> customObservationConvention) {

    return MilvusVectorStore.builder(milvusClient, embeddingModel)
        .initializeSchema(properties.isInitializeSchema())
        .databaseName(properties.getDatabaseName())
        .collectionName(properties.getCollectionName())
        .embeddingDimension(properties.getEmbeddingDimension())
        .indexType(properties.getIndexType())
        .metricType(properties.getMetricType())
        .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))
        .build();
}

Additional Context

This issue prevents users from fully configuring MilvusVectorStore through Spring Boot properties, reducing the flexibility of the auto-configuration setup.

Comment From: waileong

Closed by https://github.com/spring-projects/spring-ai/commit/0822c91ad7620566a3868b3dad47d3e4c7985a0e