chroma icon indicating copy to clipboard operation
chroma copied to clipboard

[Bug]: Operator $in and $nin do not exist.

Open JanBeelte opened this issue 2 years ago • 6 comments

What happened?

The documentation talks about $in and $nin operators here and here However the validate_where function throws: ValueError: Expected where operator to be one of $gt, $gte, $lt, $lte, $ne, $eq, got $nin

Browsing through the code I do not see $in and $nin mentioned anywhere.

Versions

Chroma v0.48, Python 3.11.3, Manjaro Linux

Relevant log output

Traceback (most recent call last):
  File "print_chroma.py", line 31, in <module>
    file = collection.get(
           ^^^^^^^^^^^^^^^
  File "lib/python3.11/site-packages/chromadb/api/models/Collection.py", line 125, in get
    where = validate_where(where) if where else None
            ^^^^^^^^^^^^^^^^^^^^^
  File "lib/python3.11/site-packages/chromadb/api/types.py", line 243, in validate_where
    raise ValueError(
ValueError: Expected where operator to be one of $gt, $gte, $lt, $lte, $ne, $eq, got $nin

JanBeelte avatar Sep 06 '23 09:09 JanBeelte

Please upgrade to 0.4.9. Those operators were released in that version.

HammadB avatar Sep 06 '23 14:09 HammadB

If I understand correctly 0.48 is the current „stable“ release, should the documentation not always feature that version? Is it possible to check the documentation of a specific version?

JanBeelte avatar Sep 06 '23 14:09 JanBeelte

Unfortunately we don't have versioned documentation yet. We 100% want to do that.

0.4.9 is the latest stable release.

HammadB avatar Sep 06 '23 14:09 HammadB

Does JavaScript version support the $in and $nin in where operators?

The current version is chromadb 1.5.9

lanvige avatar Sep 18 '23 02:09 lanvige

@lanvige, PR for JS support is coming soon

tazarov avatar Sep 18 '23 18:09 tazarov

chroma v1.8.1

Still running into this error:

  const vectorDocs = await vectorCollection.get({
      where: {
        knowledgeBaseId: {
          $in: knowledgeBaseIds, // array of strings
        },
      },
    });

Error:

{
  error: "ValueError('Expected where operator to be one of $gt, $gte, $lt, $lte, $ne, $eq, got $in')"
}

Am i querying it wrong?

aadityarajkumawat avatar Jul 29 '24 23:07 aadityarajkumawat

Hey all, closing this since feature is available in newer Chroma versions, and newer version of our JS-client. Please feel free to open another issue if you are running into this problem again with Chroma v0.6.0 or later.

itaismith avatar Jan 02 '25 06:01 itaismith