Bug description Neo4jVectorStore does not allow more than 2048 embedding dimensions. However, it uses Neo4j "vector-2.0" provider that should allow up to 4096 dimensions. See: https://neo4j.com/docs/cypher-manual/current/indexes/semantic-indexes/vector-indexes/#indexes-vector-provider-differences
Environment Spring AI 0.8.1
Steps to reproduce
Use Neo4j as the vector store - setup a local instance and add the Spring AI Neo4j as a dependency to you project - e.g. use the starter:
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-neo4j-store-spring-boot-starter</artifactId>
</dependency>
Configure the Neo4j via Spring Boot application.yaml
, set the embedding dimension size greater than 2048:
spring:
ai:
vectorstore:
neo4j:
embedding-dimension: 4096
# Your Neo4j connection configuration
neo4j:
uri: neo4j://localhost:7687
authentication:
username: ....
password: ....
Start tha application. during the start the following error occurs:
Caused by: java.lang.IllegalArgumentException: Dimension has to be withing the boundaries 1 and 2048 (inclusively)
at org.springframework.util.Assert.isTrue(Assert.java:111) ~[spring-core-6.1.5.jar!/:6.1.5]
at org.springframework.ai.vectorstore.Neo4jVectorStore$Neo4jVectorStoreConfig$Builder.withEmbeddingDimension(Neo4jVectorStore.java:141) ~[spring-ai-neo4j-store-0.8.1.jar!/:?]
at org.springframework.ai.autoconfigure.vectorstore.neo4j.Neo4jVectorStoreAutoConfiguration.vectorStore(Neo4jVectorStoreAutoConfiguration.java:43) ~[spring-ai-spring-boot-autoconfigure-0.8.1.jar!/:0.8.1]
Expected behavior Neo4jVectorStore is properly initialized and works fine with up to 4096 embedding dimensions according to Neo4j docs.
Comment From: tzolov
Resolved by b9ba62507dd2e6fa6937efbfd9353c7d3922916f