GithubHelp home page GithubHelp logo

Comments (5)

tzolov avatar tzolov commented on June 10, 2024

@habuma, By specification the upsert endpoint is expected to return a boolean: https://docs.trychroma.com/js_reference/Collection#returns-8
Furthermore the existing IT is successfully verifying this behaviour:

var success = chroma.upsertEmbeddings(newCollection.id(), addEmbeddingRequest);
assertThat(success).isTrue();

So I'm puzzled by the statement?

(I've confirmed this by using curl to POST documents to the upsert endpoint)
Could it be that we are running different Chroma version (the ITs are based on the chroma:0.4.15)?

from spring-ai.

habuma avatar habuma commented on June 10, 2024

I'm running 0.4.22. (Started by Spring Boot's Docker Compose support via a docker-compose.yaml).

I just now used curl to POST a few broken JSON files to the upsert endpoint and get responses like this one:

{"error":"IndexError('list index out of range')"}

(In this case, I had two IDs, but only 1 document and 1 set of embeddings in the body.)

If there's a JSON error (e.g., a missing comma) I get a response like this:

{"detail":[{"type":"json_invalid","loc":["body",21],"msg":"JSON decode error","input":{},"ctx":{"error":"Expecting ',' delimiter"}}]}

But, if the body that I'm posting is correct and if the document is added successfully, I get this:

null

Per the Swagger documentation at http://localhost:8000/docs, the response for a success should be an any. The response for a validation error should be a JSON response similar to what I show above for a JSON error. (The Swagger doc doesn't mention the other JSON response, but I can assure you that I get it.)

Moreover, what even led me to this was much higher level. I have the following code that exhibits what I'm seeing:

    @Bean
    ApplicationRunner go(VectorStore vectorStore) {
        return args -> {
            try {
                vectorStore.add(List.of(new Document("99999", "Rich Purnell is a steely eyed missile man.", Map.of("test", "doc"))));
            } catch (Exception e) {
                System.err.println("Error adding documents: " + e);
                // ignore errors because of problem with Chroma vector store
            }
        };
    }

When run, I see this in the console:

Error adding documents: java.lang.NullPointerException: Cannot invoke "java.lang.Boolean.booleanValue()" because "success" is null

from spring-ai.

habuma avatar habuma commented on June 10, 2024

Followup: I changed my docker-compose.yaml to force 0.4.15 and I do get true when a document is successfully upserted. So, something changed between 0.4.15 and 0.4.22.

The comments on chroma-core/chroma#1466 mention this behavior, saying it was introduced in 0.4.16 and suggesting that it is intentional, not a bug.

from spring-ai.

tzolov avatar tzolov commented on June 10, 2024

@habuma thanks for clarifying this.
Maybe they did some breaking changes in the API.
Will investigate further with the 0.4.22

from spring-ai.

tzolov avatar tzolov commented on June 10, 2024

@habuma i can confirm that Chroma has changed their API, so that the upsert doesn't return boolean anymore.
Their JS client docs still claims that it is possible , but the Python counterpart suggest None as return value.
Also noticed another change in the getEmbedding as well. The where filter doesn't doesn't support the complex operators (like with the query) but only simple matches.
A fix for the above issues will follow shortly.

from spring-ai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.