From 39cb5975a25ffe559103c7df0339cb8f93f001f5 Mon Sep 17 00:00:00 2001 From: Max Isom Date: Tue, 30 Apr 2024 10:24:59 -0700 Subject: [PATCH 1/2] Add note about `included` field --- docs/usage-guide.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/usage-guide.md b/docs/usage-guide.md index 038a116..4e30756 100644 --- a/docs/usage-guide.md +++ b/docs/usage-guide.md @@ -296,7 +296,7 @@ await collection.count(); // returns the number of items in the collection ``` - + `createCollection` also takes an optional `metadata` argument which can be used to customize the distance method of the embedding space by setting the value of `hnsw:space` @@ -309,7 +309,7 @@ let collection = client.createCollection({ ``` - + Valid options for `hnsw:space` are "l2", "ip, "or "cosine". The **default** is "l2" which is the squared L2 norm. @@ -532,6 +532,14 @@ collection.query( ) ``` +The dict returned from `.get` and `.query` has a `included` key that's a list of the fields that were included in the response, including fields returned by default. For example: + +```python +result = collection.get() + +assert result["included"] == ["metadatas", "documents", "distances"] +``` + ### Using Where filters Chroma supports filtering queries by `metadata` and `document` contents. The `where` filter is used to filter by `metadata`, and the `where_document` filter is used to filter by `document` contents. From 1cf4f7d5edb444119ee0576410636cdd741599d3 Mon Sep 17 00:00:00 2001 From: Max Isom Date: Tue, 30 Apr 2024 10:33:23 -0700 Subject: [PATCH 2/2] Update troubleshooting note --- docs/troubleshooting.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 3793750..3868772 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -25,6 +25,8 @@ results = collection.query( ) ``` +You can always inspect `results["included"]` to see what fields were populated in the response. In the above example, `results["included"] == ["embeddings", "documents", "metadatas", "distances"]`. + :::note We may change `None` to something else to more clearly communicate why they were not returned. ::: @@ -58,4 +60,4 @@ Chroma requires SQLite > 3.35, if you encounter issues with having too low of a ## Illegal instruction (core dumped) -If you encounter an error like this during setup and are using Docker - you may have built the library on a machine with a different CPU architecture than the one you are running it on. Try rebuilding the Docker image on the machine you are running it on. \ No newline at end of file +If you encounter an error like this during setup and are using Docker - you may have built the library on a machine with a different CPU architecture than the one you are running it on. Try rebuilding the Docker image on the machine you are running it on.