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

Commit b23273b

Browse files
jeffchuberatroyn
andauthored
update docs to use the new CLI as the default happy path (#121)
* update docs to use the new CLI * Updated docs * Clean up auth * HTTP Client already exitsts --------- Co-authored-by: atroyn <anton.troynikov@gmail.com>
1 parent 53eda97 commit b23273b

File tree

6 files changed

+261
-200
lines changed

6 files changed

+261
-200
lines changed

docs/api-reference.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ title: "📖 API Cheatsheet"
55

66
# 📖 API Cheatsheet
77

8-
:::note
8+
:::note
99
This is a quick cheatsheet of the API. For full API docs, refer to the JS and Python docs in the sidebar.
1010
:::
1111

12-
***
12+
---
1313

1414
import Tabs from '@theme/Tabs';
1515
import TabItem from '@theme/TabItem';
@@ -21,8 +21,7 @@ import TabItem from '@theme/TabItem';
2121
<TabItem value="js" label="JavaScript"></TabItem>
2222
</Tabs>
2323

24-
***
25-
24+
---
2625

2726
<Tabs queryString groupId="lang" className="hideTabSwitcher">
2827
<TabItem value="py" label="Python">
@@ -47,7 +46,9 @@ client = chromadb.PersistentClient(path="/path/to/data")
4746

4847
### Run chroma just as a client to talk to a backend service
4948

50-
For many use cases, an in-memory database will not cut it. Run `docker-compose up -d --build` to run a persistent backend in Docker. Simply update your API initialization and then use the API the same way as before.
49+
You can run Chroma a standalone Chroma server using the Chroma command line. Run `chroma run --path /db_path` to run a server.
50+
51+
Then update your API initialization and then use the API the same way as before.
5152

5253
```python
5354
import chromadb
@@ -151,12 +152,12 @@ collection.delete()
151152

152153
### Run the backend
153154

154-
Run `docker-compose up -d --build` to run a backend in Docker on your local computer.
155+
Run `chroma run --path /db_path` to run the Chroma backend as a standalone server on your local computer.
155156

156157
## Initialize client - JS
157158

158159
```javascript
159-
import { ChromaClient } from 'chromadb'
160+
import { ChromaClient } from "chromadb";
160161
const client = new ChromaClient();
161162
```
162163

@@ -170,23 +171,23 @@ Collections are similar to AWS s3 buckets in their naming requirements because t
170171

171172
```javascript
172173
// list all collections
173-
await client.listCollections()
174+
await client.listCollections();
174175

175176
// make a new collection
176-
const collection = await client.createCollection({name: "testname"})
177+
const collection = await client.createCollection({ name: "testname" });
177178

178179
// get an existing collection
179-
const collection = await client.getCollection({name: "testname"})
180+
const collection = await client.getCollection({ name: "testname" });
180181

181182
// delete a collection
182-
await client.deleteCollection({name: "testname"})
183+
await client.deleteCollection({ name: "testname" });
183184
```
184185

185186
### Utility methods
186187

187188
```javascript
188189
// resets entire database - this *cant* be undone!
189-
await client.reset()
190+
await client.reset();
190191
```
191192

192193
## Methods on Collection
@@ -202,7 +203,7 @@ await collection.add({
202203
embeddings: [1.5, 2.9, 3.4],
203204
metadatas: {"source": "my_source"},
204205
documents: "This is a document",
205-
})
206+
})
206207
// or many, up to 100k+!
207208
await collection.add({
208209
ids: ["uri9", "uri10"],
@@ -243,8 +244,6 @@ await collection.delete()
243244

244245
```
245246

246-
247247
</TabItem>
248248

249249
</Tabs>
250-

docs/deployment.md

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ title: "☁️ Deployment"
55

66
:::caution Alpha Status
77
Chroma Server is currently in Alpha. We are working hard to move Chroma from an in-memory single-process oriented library to a distributed production-grade DB!
8+
89
- [x] Alpha <- Currently
910
- [ ] Technical Preview - ~1 month away, powered by a completely new backend
1011
- [ ] Full production
1112
- [ ] GA - General Availability
13+
1214
:::
1315

1416
# ☁️ Deployment
@@ -21,12 +23,49 @@ provided a very simple AWS CloudFormation template to experiment with
2123
deploying Chroma to EC2 on AWS.
2224

2325
## Hosted Chroma
24-
We want to offer hosted Chroma, and we need your help.
26+
27+
We want to offer hosted Chroma, and we need your help.
2528

2629
Fill out the survey to jump the wait-list. Coming Q3 2023.
2730

2831
[📝 30 second survey](https://airtable.com/shrOAiDUtS2ILy5vZ)
2932

33+
## Docker
34+
35+
You can run a Chroma server in a Docker container.
36+
37+
You can get the Chroma Docker image from [Docker Hub](https://hub.docker.com/r/chromadb/chroma), or from the [Chroma GitHub Container Registry](https://github.com/chroma-core/chroma/pkgs/container/chroma)
38+
39+
```sh
40+
docker pull chromadb/chroma
41+
docker run -p 8000:8000 chromadb/chroma
42+
```
43+
44+
You can also build the Docker image yourself from the Dockerfile in the [Chroma GitHub repository](https://github.com/chroma-core/chroma)
45+
46+
```sh
47+
git clone git@github.com:chroma-core/chroma.git
48+
cd chroma
49+
docker-compose up -d --build
50+
```
51+
52+
The Chroma client can then be configured to connect to the server running in the Docker container.
53+
54+
```python
55+
import chromadb
56+
chroma_client = chromadb.HttpClient(host='localhost', port=8000)
57+
```
58+
59+
### Authentication with Docker
60+
61+
By default, the Docker image will run with no authentication. Follow the [Authentication](./usage-guide#authentication) section of the Usage Guide to configure authentication in the Docker container.
62+
63+
You can also create a `.chroma_env` file setting the required environment variables and pass it to the Docker container with the `--env-file` flag when running the container.
64+
65+
```sh
66+
docker run --env-file ./.chroma_env -p 8000:8000 chromadb/chroma
67+
```
68+
3069
## Simple AWS Deployment
3170

3271
:warning: Chroma and its underlying database need at least 2gb of RAM,
@@ -47,7 +86,6 @@ serious production use (with high availability, backups, etc.) please
4786
read and understand the CloudFormation template and use it as a basis
4887
for what you need, or reach out to the Chroma team for assistance.
4988

50-
5189
### Step 1: Get an AWS Account
5290

5391
You will need an AWS Account. You can use one you already have, or
@@ -65,17 +103,20 @@ and will be using environment variables to configure AWS.
65103

66104
Export the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables in your shell:
67105

68-
69106
```
70-
export AWS_ACCESS_KEY_ID=****************
71-
export AWS_SECRET_ACCESS_KEY=**********************
107+
108+
export AWS_ACCESS_KEY_ID=**\*\***\*\*\*\***\*\***
109+
export AWS_SECRET_ACCESS_KEY=****\*\*****\*\*****\*\*****
110+
72111
```
73112

74113
You can also configure AWS to use a region of your choice using the
75114
`AWS_REGION` environment variable:
76115

77116
```
117+
78118
export AWS_REGION=us-east-1
119+
79120
```
80121

81122
### Step 3: Run CloudFormation
@@ -85,7 +126,9 @@ Chroma publishes Cloudformation templates to S3 for each release.
85126
To launch the template using AWS CloudFormation, run the following command line invocation:
86127

87128
```
129+
88130
aws cloudformation create-stack --stack-name my-chroma-stack --template-url https://s3.amazonaws.com/public.trychroma.com/cloudformation/latest/chroma.cf.json
131+
89132
```
90133

91134
Replace `--stack-name my-chroma-stack` with a different stack name, if you wish.
@@ -94,7 +137,9 @@ Wait a few minutes for the server to boot up, and Chroma will be
94137
available! You can get the public IP address of your new Chroma server using the AWS console, or using the following command:
95138

96139
```
140+
97141
aws cloudformation describe-stacks --stack-name my-chroma-stack --query 'Stacks[0].Outputs'
142+
98143
```
99144

100145
### Step 4: Customize the Stack (optional)
@@ -114,15 +159,13 @@ above, but on a `m5.4xlarge` EC2 instance, and adding a KeyPair named
114159
`mykey` so anyone with the associated private key can SSH into the
115160
machine:
116161

117-
118-
```
119-
aws cloudformation create-stack --stack-name my-chroma-stack --template-url https://s3.amazonaws.com/public.trychroma.com/cloudformation/latest/chroma.cf.json \
120-
--parameters ParameterKey=KeyName,ParameterValue=mykey \
121-
ParameterKey=InstanceType,ParameterValue=m5.4xlarge
122162
```
123163
164+
aws cloudformation create-stack --stack-name my-chroma-stack --template-url https://s3.amazonaws.com/public.trychroma.com/cloudformation/latest/chroma.cf.json \
165+
--parameters ParameterKey=KeyName,ParameterValue=mykey \
166+
ParameterKey=InstanceType,ParameterValue=m5.4xlarge
124167
125-
168+
```
126169

127170
### Step 5: Configure the Chroma Library
128171

@@ -132,33 +175,37 @@ you need to do is configure it to use the server's IP address and port
132175

133176
###### Using Environment Variables
134177

135-
136178
```
179+
137180
export CHROMA_API_IMPL=rest
138181
export CHROMA_SERVER_HOST=<server IP address>
139182
export CHROMA_SERVER_HTTP_PORT=8000
140-
```
141183
184+
```
142185

143186
###### In Code
144187

145188
```
189+
146190
import chromadb
147191
from chromadb.config import Settings
148192
chroma = chromadb.HttpClient(host=<server IP address>, port=8000)
193+
149194
```
150195

151196
### Step 6: Clean Up (optional).
152197

153198
To destroy the stack and remove all AWS resources, use the AWS CLI `delete-stack` command.
154199

155200
```
201+
156202
aws cloudformation delete-stack --stack-name my-chroma-stack
203+
157204
```
158205

159206
:warning: This will destroy all the data in your Chroma database,
160207
unless you've taken a snapshot or otherwise backed it up.
161208

162209
### Troubleshooting
163210

164-
If you get an error saying `No default VPC for this user` when creating `ChromaInstanceSecurityGroup`, head to [AWS VPC section]( https://us-east-1.console.aws.amazon.com/vpc/home?region=us-east-1#vpcs) and create a default VPC for your user.
211+
If you get an error saying `No default VPC for this user` when creating `ChromaInstanceSecurityGroup`, head to [AWS VPC section](https://us-east-1.console.aws.amazon.com/vpc/home?region=us-east-1#vpcs) and create a default VPC for your user.

0 commit comments

Comments
 (0)