Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get vectorStoreTest with MongoDBAtlasVectorStore to work locally #1573

Open
jrgleason opened this issue Oct 21, 2024 · 2 comments
Open

Comments

@jrgleason
Copy link

jrgleason commented Oct 21, 2024

Bug description
I am having trouble with MongoDBAtlasVectorStore. Basically when I copy and paste this into my project because the similarity search isn't working...

List<Document> ds = List.of(
                new Document(
                        "Spring AI rocks!! Spring AI rocks!! Spring AI rocks!! Spring AI rocks!! Spring AI rocks!!",
                        Collections.singletonMap("meta1", "meta1")),
                new Document("Hello World Hello World Hello World Hello World Hello World Hello World Hello World"),
                new Document(
                        "Great Depression Great Depression Great Depression Great Depression Great Depression Great Depression",
                        Collections.singletonMap("meta2", "meta2")));

        vectorStore.add(ds);
        Thread.sleep(25000); // Await a second for the document to be indexed

        List<Document> results = vectorStore.similaritySearch(SearchRequest.query("Great").withTopK(1));

The result I see is not correct...

image

Environment
Java 23
Spring AI 1.0.0-M3

Steps to reproduce
See repo here. You can add the code above to that and see it doesn't work

Expected behavior
I would expect it to return a document as it does in the test.

Minimal Complete Reproducible example
See above more available here

@jrgleason jrgleason changed the title Can't get vectorStoreTest to work locally Can't get vectorStoreTest with MongoDBAtlasVectorStore to work locally Oct 21, 2024
@jrgleason
Copy link
Author

Got debugging into source working now trying to understand why the query is returning 0 records. Also running the build locally with mvn clean install to make sure it isn't an environment issue.

@jrgleason
Copy link
Author

It seems that the way the vector store is working isn't allowing me to aggregate properly. I added a script

https://github.com/jrgleason/spring-ai-example/blob/ADD_MQTT_SUPPORT/app/debug/mongodb/test-count.js

That seems to confirm this can someone see what I am doing wring with my config?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant