You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add local/cloud factories and move reset to Client
- Adds `ChromaDB::local()` and `ChromaDB::cloud()` helper methods for easier connection configuration.
- Deprecates `ChromaDB::client()` in favor of `ChromaDB::local()->connect()` or `ChromaDB::factory()->connect()`.
BREAKING CHANGE: `ChromaDB::reset()` has been removed. Use `$client->reset()` instead.
For more installation options and usage details, check the [Chroma CLI Installation Docs](https://docs.trychroma.com/docs/cli/install) and [Run Docs](https://docs.trychroma.com/docs/cli/run).
104
+
105
+
#### Docker
89
106
90
107
To run the docker image, you can use the following command:
91
108
@@ -128,6 +145,11 @@ ChromaDB.)
128
145
129
146
Either way, you can now access ChromaDB at `http://localhost:8000`.
130
147
148
+
### Chroma Cloud
149
+
150
+
You can sign up for the hosted version of ChromaDB at [Chroma Cloud](https://trychroma.com/). Once you have an account,
151
+
you can create a new project and get your API key.
You can also specify the tenant and database if needed:
188
199
189
200
```php
190
201
use Codewithkyrian\ChromaDB\ChromaDB;
191
202
192
-
$chroma = ChromaDB::factory()
193
-
->withAuthToken('test-token')
194
-
->connect();
203
+
$chroma = ChromaDB::cloud(
204
+
apiKey: 'your-api-key',
205
+
tenant: 'new_tenant',
206
+
database: 'new_database'
207
+
)->connect();
208
+
```
209
+
210
+
### Configuring the Connection
211
+
212
+
Both `ChromaDB::local()` and `ChromaDB::cloud()` return a `Factory` instance. This allows you to configure the connection further before establishing it.
213
+
214
+
#### Setting Host and Port
215
+
216
+
You can override the host and port using `withHost()` and `withPort()`:
217
+
218
+
```php
219
+
$chroma = ChromaDB::local()
220
+
->withHost('http://custom-host')
221
+
->withPort(8080)
222
+
->connect();
223
+
```
224
+
225
+
#### Setting Database and Tenant
226
+
227
+
You can specify the database and tenant using `withDatabase()` and `withTenant()`:
228
+
229
+
```php
230
+
$chroma = ChromaDB::local()
231
+
->withDatabase('my_db')
232
+
->withTenant('my_tenant')
233
+
->connect();
234
+
```
235
+
236
+
#### Adding Custom Headers
237
+
238
+
You can add custom headers to your requests using `withHeader()` or `withHeaders()`. This is useful for passing authentication tokens or other metadata required by your proxy or server.
0 commit comments