Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
spikechroma committed Aug 24, 2024
1 parent 55da033 commit 01a648a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 22 deletions.
24 changes: 23 additions & 1 deletion docs/docs.trychroma.com/pages/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,23 @@ const collection = await client.createCollection({

### 4. Add some text documents to the collection

Chroma will store your text and handle embedding and indexing automatically. You can also customize the embedding model.
Chroma will store your text and handle embedding and indexing automatically. You can also customize the embedding model. When you add documents, IDs are optional. If you don't provide `ids`, Chroma will automatically generate `ids` using uuid v4 for you.

{% tabs group="code-lang" hideTabs=true %}
{% tab label="Python" %}

```python
# Add docs without IDs
result = collection.add(
documents=[
"This is a document about pineapple",
"This is a document about oranges"
]
)

ids = result["ids"]

# Add docs with IDs
collection.add(
documents=[
"This is a document about pineapple",
Expand All @@ -162,6 +173,17 @@ collection.add(
{% tab label="Javascript" %}

```js
// Add docs without Ids
result = await client.addRecords(collection, {
documents: [
"This is a document about pineapple",
"This is a document about oranges",
]
});

ids = result.ids

// Add docs with Ids
await client.addRecords(collection, {
documents: [
"This is a document about pineapple",
Expand Down
13 changes: 3 additions & 10 deletions docs/docs.trychroma.com/pages/guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ async def main():
collection = await client.create_collection(name="my_collection")

await collection.add(
documents=["hello world"],
ids=["id1"]
documents=["hello world"]
)

asyncio.run(main())
Expand Down Expand Up @@ -358,8 +357,7 @@ Raw documents:
```python
collection.add(
documents=["lorem ipsum...", "doc2", "doc3", ...],
metadatas=[{"chapter": "3", "verse": "16"}, {"chapter": "3", "verse": "5"}, {"chapter": "29", "verse": "11"}, ...],
ids=["id1", "id2", "id3", ...]
metadatas=[{"chapter": "3", "verse": "16"}, {"chapter": "3", "verse": "5"}, {"chapter": "29", "verse": "11"}, ...]
)
```

Expand All @@ -372,7 +370,6 @@ Raw documents:

```javascript
await client.addRecords(collection, {
ids: ["id1", "id2", "id3", ...],
metadatas: [{"chapter": "3", "verse": "16"}, {"chapter": "3", "verse": "5"}, {"chapter": "29", "verse": "11"}, ...],
documents: ["lorem ipsum...", "doc2", "doc3", ...],
})
Expand Down Expand Up @@ -401,7 +398,6 @@ collection.add(
documents=["doc1", "doc2", "doc3", ...],
embeddings=[[1.1, 2.3, 3.2], [4.5, 6.9, 4.4], [1.1, 2.3, 3.2], ...],
metadatas=[{"chapter": "3", "verse": "16"}, {"chapter": "3", "verse": "5"}, {"chapter": "29", "verse": "11"}, ...],
ids=["id1", "id2", "id3", ...]
)
```

Expand All @@ -410,7 +406,6 @@ collection.add(

```javascript
await client.addRecords(collection, {
ids: ["id1", "id2", "id3", ...],
embeddings: [[1.1, 2.3, 3.2], [4.5, 6.9, 4.4], [1.1, 2.3, 3.2], ...],
metadatas: [{"chapter": "3", "verse": "16"}, {"chapter": "3", "verse": "5"}, {"chapter": "29", "verse": "11"}, ...],
documents: ["lorem ipsum...", "doc2", "doc3", ...],
Expand All @@ -432,8 +427,7 @@ You can also store documents elsewhere, and just supply a list of `embeddings` a
```python
collection.add(
embeddings=[[1.1, 2.3, 3.2], [4.5, 6.9, 4.4], [1.1, 2.3, 3.2], ...],
metadatas=[{"chapter": "3", "verse": "16"}, {"chapter": "3", "verse": "5"}, {"chapter": "29", "verse": "11"}, ...],
ids=["id1", "id2", "id3", ...]
metadatas=[{"chapter": "3", "verse": "16"}, {"chapter": "3", "verse": "5"}, {"chapter": "29", "verse": "11"}, ...]
)
```

Expand All @@ -442,7 +436,6 @@ collection.add(

```javascript
await client.addRecords(collection, {
ids: ["id1", "id2", "id3", ...],
embeddings: [[1.1, 2.3, 3.2], [4.5, 6.9, 4.4], [1.1, 2.3, 3.2], ...],
metadatas: [{"chapter": "3", "verse": "16"}, {"chapter": "3", "verse": "5"}, {"chapter": "29", "verse": "11"}, ...],
})
Expand Down
3 changes: 0 additions & 3 deletions docs/docs.trychroma.com/pages/guides/multimodal.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ You can add data to a multi-modal collection by specifying the data modality. Fo

```python
collection.add(
ids=['id1', 'id2', 'id3'],
images=[...] # A list of numpy arrays representing images
)
```
Expand All @@ -76,7 +75,6 @@ However, you can use Chroma in combination with data stored elsewhere, by adding

```python
collection.add(
ids=['id1', 'id2', 'id3'],
uris=[...] # A list of strings representing URIs to data
)
```
Expand All @@ -85,7 +83,6 @@ Since the embedding function is multi-modal, you can also add text to the same c

```python
collection.add(
ids=['id4', 'id5', 'id6'],
texts=["This is a document", "This is another document", "This is a third document"]
)
```
Expand Down
6 changes: 0 additions & 6 deletions docs/docs.trychroma.com/pages/reference/cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,15 @@ collection.add(
embeddings=[1.5, 2.9, 3.4],
metadatas={"uri": "img9.png", "style": "style1"},
documents="doc1000101",
ids="uri9",
)
# or many, up to 100k+!
collection.add(
embeddings=[[1.5, 2.9, 3.4], [9.8, 2.3, 2.9]],
metadatas=[{"style": "style1"}, {"style": "style2"}],
ids=["uri9", "uri10"],
)
collection.add(
documents=["doc1000101", "doc288822"],
metadatas=[{"style": "style1"}, {"style": "style2"}],
ids=["uri9", "uri10"],
)

# update items in a collection
Expand Down Expand Up @@ -200,21 +197,18 @@ await collection.count()
// add new items to a collection
// either one at a time
await collection.add({
ids: "id1",
embeddings: [1.5, 2.9, 3.4],
metadatas: {"source": "my_source"},
documents: "This is a document",
})
// or many, up to 100k+!
await collection.add({
ids: ["uri9", "uri10"],
embeddings: [[1.5, 2.9, 3.4], [9.8, 2.3, 2.9]],
metadatas: [{"style": "style1"}, {"style": "style2"}],
documents: ["This is a document", 'that is a document']
})
// including just documents
await collection.add({
ids: ["uri9", "uri10"],
metadatas: [{"style": "style1"}, {"style": "style2"}],
documents: ["doc1000101", "doc288822"],
})
Expand Down
1 change: 0 additions & 1 deletion docs/docs.trychroma.com/pages/reference/js-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Add items to the collection

```javascript
const response = await collection.add({
ids: ["id1", "id2"],
embeddings: [
[1, 2, 3],
[4, 5, 6],
Expand Down
2 changes: 1 addition & 1 deletion docs/docs.trychroma.com/pages/reference/py-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Add embeddings to the data store.

**Arguments**:

- `ids` - The ids of the embeddings you wish to add. If None, Chroma will generate IDs using uuid v4.
- `ids` - The ids of the embeddings you wish to add. If None, Chroma will generate the ids using uuid v4.
- `embeddings` - The embeddings to add. If None, embeddings will be computed based on the documents using the embedding_function set for the Collection. Optional.
- `metadatas` - The metadata to associate with the embeddings. When querying, you can filter on this metadata. Optional.
- `documents` - The documents to associate with the embeddings. Optional.
Expand Down

0 comments on commit 01a648a

Please sign in to comment.