Bug description Milvus vector store does not allow more than 2048 embedding dimensions. However I'm using mistral 7B as an embedding model so It produces vectors with a dimension of 4096.
Environment Spring AI 0.8.1 Milvus v2.4.0-rc.1 (standalone docker)
Steps to reproduce Use Milvus as a vector store, setup a local instance of Milvus and add the starter to the pom.xml :
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-milvus-store-spring-boot-starter</artifactId>
</dependency>
Configure Spring-boot's application.properties file :
spring.ai.ollama.embedding.options.model=mistral
spring.ai.vectorstore.milvus.client.uri=http://localhost:19530
spring.ai.vectorstore.milvus.embedding-dimension=4096
#...
Run the application :
org.springframework.beans.BeanInstantiationException: 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)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:177) ~[spring-beans-6.1.5.jar:6.1.5]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644) ~[spring-beans-6.1.5.jar:6.1.5]
... 33 common frames omitted
Expected behavior Milvus supports embeddings with a size of 4096 therefore spring ai implementation should too
Proposed solution MilvusVectorStore.java line 418
public Builder withEmbeddingDimension(int newEmbeddingDimension) {
Assert.isTrue(newEmbeddingDimension >= 1 && newEmbeddingDimension <= 32768,
"Dimension has to be withing the boundaries 1 and 32768 (inclusively)");
this.embeddingDimension = newEmbeddingDimension;
return this;
}