amikos-tech / chroma-go

The Go client for Chroma vector database
https://go-client.chromadb.dev
MIT License
60 stars 13 forks source link

[bug] the Metadata taken from Chroma is inconsistent? #9

Open theoneLee opened 11 months ago

theoneLee commented 11 months ago

I run Demo, but I find the Metadata taken from Chroma is inconsistent. Is it a bug?

this is a log:

image
col, _ := client.CreateCollection(collectionName, metadata, true, embeddingFunction, distanceFunction)
    documents := []string{
        "This is a document about cats. Cats are great.",
        "this is a document about dogs. Dogs are great.",
    }
    ids := []string{
        "ID1",
        "ID2",
    }

    metadatas := []map[string]any{
        {"key1": "value1"},
        {"key2": "value2"},
    }
    _, addError := col.Add(nil, metadatas, documents, ids)
    if addError != nil {
        fmt.Printf("Error adding documents: %s", addError)
        return
    }
    countDocs, qrerr := col.Count()
    if qrerr != nil {
        fmt.Printf("Error counting documents: %s", qrerr)
        return
    }
    fmt.Printf("countDocs: %v\n", countDocs) //this should result in 2
    qr, qrerr := col.Query([]string{"I love dogs"}, 5, nil, nil, nil)
    if qrerr != nil {
        fmt.Printf("Error querying documents: %s", qrerr)
        return
    }
    fmt.Printf("qr: %v\n", toJson(qr))
    fmt.Printf("qr.Documents[0][0]: %v\n", qr.Documents[0][0]) //this should result in the document about dogs
tazarov commented 11 months ago

@theoneLee, this looks weird. Let me have a look.

tazarov commented 6 months ago

@theoneLee this should be fixed in v0.1.0