-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Bug description
Milvus supports up to 4096 embedding size of 4096. Mistral dimension is 4096 https://huggingface.co/spaces/mteb/leaderboard . However MilvusVectorStore is hardcoded for OpenAI model size "Dimension has to be withing the boundaries 1 and 2048 (inclusively)"
Environment
Spring AI version: 0.8.1,
Java version: OpenJDK 21
Vector store: Milvus: 2.3.13
Model: Mistral
Steps to reproduce
Spring boot configuration:
spring.ai.vectorstore.milvus.embedding-dimension=4096
spring.ai.vectorstore.milvus.index-type=IVF_FLAT
spring.ai.vectorstore.milvus.metric-type=cosine
spring.ai.vectorstore.milvus.database-name=default
spring.ai.vectorstore.milvus.collection-name=vector_store
Expected behavior
Setting embedding-dimension=4096 should overwrite default dimension. Assertion should be changed from:
Assert.isTrue(newEmbeddingDimension >= 1 && newEmbeddingDimension <= 2048,
"Dimension has to be withing the boundaries 1 and 2048 (inclusively)");
to
Assert.isTrue(newEmbeddingDimension >= 1 && newEmbeddingDimension <= 4096,
"Dimension has to be withing the boundaries 1 and 4096 (inclusively)");
Additionally MilvusVectorStore should not have hardcoded OpenAI specific properties and values i.e. "public static final int OPENAI_EMBEDDING_DIMENSION_SIZE = 1536;"
Minimal Complete Reproducible example
ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ragOllamaAIClient' defined in file [/app/classes/llm/RagOllamaAIClient.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'vectorStore' defined in class path resource [org/springframework/ai/autoconfigure/vectorstore/milvus/MilvusVectorStoreAutoConfiguration.class]: Failed to instantiate [org.springframework.ai.vectorstore.MilvusVectorStore]: Factory method 'vectorStore' threw exception with message: Dimension has to be withing the boundaries 1 and 2048 (inclusively)