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

Commit 60293cc

Browse files
committed
docs: Updated js example to align with implementation.
- Also added a note about the max batch size. Ref: chroma-core/chroma#1271
1 parent 578e332 commit 60293cc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

docs/embeddings/cloudflare.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ Chroma provides a convenient wrapper around Cloudflare Workers AI REST API. This
1717

1818
Visit the [Cloudflare Workers AI documentation](https://developers.cloudflare.com/workers-ai/) for more information on getting started.
1919

20+
:::note
21+
Currently cloudflare embeddings endpoints allow batches of maximum 100 documents in a single request. The EF has a hard limit of 100 documents per request, and will raise an error if you try to pass more than 100 documents.
22+
:::
23+
2024
<Tabs queryString groupId="lang" className="hideTabSwitcher">
2125
<TabItem value="py" label="Python">
2226

2327
```python
2428
import chromadb.utils.embedding_functions as embedding_functions
2529
cf_ef = embedding_functions.CloudflareWorkersAIEmbeddingFunction(
2630
api_key = "YOUR_API_KEY",
27-
account_id = "YOUR_ACCOUNT_ID",
31+
account_id = "YOUR_ACCOUNT_ID", # or gateway_endpoint
2832
model_name = "@cf/baai/bge-base-en-v1.5",
2933
)
3034
cf_ef(input=["This is my first text to embed", "This is my second document"])
@@ -39,9 +43,9 @@ You can pass in an optional `model_name` argument, which lets you choose which C
3943
// const {CloudflareWorkersAIEmbeddingFunction} = require('chromadb'); //CJS import
4044
import {CloudflareWorkersAIEmbeddingFunction} from "chromadb"; //ESM import
4145
const embedder = new CloudflareWorkersAIEmbeddingFunction({
42-
api_key: 'YOUR_API_KEY',
43-
account_id: "YOUR_ACCOUNT_ID",
44-
model_name: '@cf/baai/bge-base-en-v1.5',
46+
apiToken: 'YOUR_API_KEY',
47+
accountId: "YOUR_ACCOUNT_ID", // or gatewayEndpoint
48+
model: '@cf/baai/bge-base-en-v1.5',
4549
});
4650

4751
// use directly

0 commit comments

Comments
 (0)