Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Add note about included field #242

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
:::
Expand Down Expand Up @@ -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.
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.
12 changes: 10 additions & 2 deletions docs/usage-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ await collection.count(); // returns the number of items in the collection
```

</TabItem>

<TabItem value="js" label="Javascript">

`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`
Expand All @@ -309,7 +309,7 @@ let collection = client.createCollection({
```

</TabItem>

</Tabs>

Valid options for `hnsw:space` are "l2", "ip, "or "cosine". The **default** is "l2" which is the squared L2 norm.
Expand Down Expand Up @@ -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.
Expand Down