workers-ai-provider 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +11 -6
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
# workers-ai-provider
|
1
|
+
# ⛅️ ✨ workers-ai-provider ✨ ⛅️
|
2
2
|
|
3
3
|
A custom provider that enables [Workers AI](https://ai.cloudflare.com/)'s models for the [Vercel AI SDK](https://sdk.vercel.ai/).
|
4
4
|
|
5
|
-
> [!CAUTION]
|
6
|
-
> This project is in its experimental early stages and is not recommended for production use.
|
7
|
-
|
8
5
|
## Install
|
9
6
|
|
10
7
|
```bash
|
@@ -13,7 +10,7 @@ npm install workers-ai-provider
|
|
13
10
|
|
14
11
|
## Usage
|
15
12
|
|
16
|
-
First, setup an AI binding in `wrangler.toml
|
13
|
+
First, setup an AI binding in `wrangler.toml` in your Workers project:
|
17
14
|
|
18
15
|
```toml
|
19
16
|
# ...
|
@@ -48,7 +45,15 @@ export default {
|
|
48
45
|
],
|
49
46
|
});
|
50
47
|
|
51
|
-
return text.toTextStreamResponse(
|
48
|
+
return text.toTextStreamResponse({
|
49
|
+
headers: {
|
50
|
+
// add these headers to ensure that the
|
51
|
+
// response is chunked and streamed
|
52
|
+
"Content-Type": "text/x-unknown",
|
53
|
+
"content-encoding": "identity",
|
54
|
+
"transfer-encoding": "chunked",
|
55
|
+
},
|
56
|
+
});
|
52
57
|
},
|
53
58
|
};
|
54
59
|
```
|