Skip to content

The default settings result in an unworkable library #977

Closed
@ErykCh

Description

@ErykCh

Bug description
I created everything on standard settings. Connection to OpenAI and the Neo4j vector database.

Environment

Steps to reproduce
Create connection to OpenAI and create Neo4j vector database.

public EmbeddingModel embeddingModel() {
    return new OpenAiEmbeddingModel(new OpenAiApi(embeddingBaseUrl, embeddingApiKey), MetadataMode.EMBED, OpenAiEmbeddingOptions.builder().withModel(embeddingModel).build());
}

public Neo4jVectorStore neo4jVectorStore(Driver driver, EmbeddingModel embeddingModel) {
    return new Neo4jVectorStore(driver, embeddingModel, Neo4jVectorStoreConfig.defaultConfig(), true);
}

public List<Document> findSimilarContent(SimilarContentRequest request) {
    SearchRequest searchRequest = SearchRequest.query(request.getQuery())
            .withTopK(request.getTopK())
            .withFilterExpression(buildFilterExpression(request.getMetadata()));
    return vectorStore.similaritySearch(searchRequest);
}

org.neo4j.driver.exceptions.ClientException: Failed to invoke procedure `db.index.vector.queryNodes`: Caused by: java.lang.IllegalArgumentException: Index query vector has 3072 dimensions, but indexed vectors have 1536.

I've check using Neo4j Console
there is index spring-ai-document-index
so created by spring ai
with following settings:
{
"indexProvider": "vector-2.0",
"indexConfig": {
"vector.dimensions": 1536,
"vector.similarity_function": "COSINE"
}
}

so spring ai set the wrong index even though he had the embedding model in hand and couldn't put it together properly, causing the solution not to work

Expected behavior
When I use EmbeddingModel to create VectoreStore everything should be created correctly.
Correct indexes and probably other errors that I will come across

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions