@botsrated/ai-sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,21 +3,27 @@
|
|
|
3
3
|
[AI SDK](https://ai-sdk.dev) tools for [BotsRated](https://botsrated.com) (beta). Use them as a
|
|
4
4
|
pre-payment check before an agent pays an x402 seller.
|
|
5
5
|
|
|
6
|
-
**Status:
|
|
7
|
-
|
|
6
|
+
**Status: published on npm as [`@botsrated/ai-sdk`](https://www.npmjs.com/package/@botsrated/ai-sdk) (0.1.0).** It depends on
|
|
7
|
+
[`@botsrated/x402-preflight`](https://www.npmjs.com/package/@botsrated/x402-preflight) `^0.1.0`. Docs: https://botsrated.com/docs/ai-sdk
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @botsrated/ai-sdk ai zod
|
|
11
|
+
```
|
|
8
12
|
|
|
9
13
|
```ts
|
|
10
|
-
import { generateText,
|
|
14
|
+
import { generateText, stepCountIs } from "ai";
|
|
11
15
|
import { botsratedTools } from "@botsrated/ai-sdk";
|
|
12
16
|
|
|
13
17
|
const { text } = await generateText({
|
|
14
18
|
model: "openai/gpt-5-mini",
|
|
15
19
|
prompt: "Before paying https://blockrun.ai/api/v1/chat/completions (payTo 0xe903...1aBf), check it.",
|
|
16
20
|
tools: botsratedTools(), // { botsratedPreflight } – free
|
|
17
|
-
stopWhen: isStepCount(3)
|
|
21
|
+
stopWhen: stepCountIs(3), // AI SDK 7 also exports isStepCount(3)
|
|
18
22
|
});
|
|
19
23
|
```
|
|
20
24
|
|
|
25
|
+
`stepCountIs` works on AI SDK 5, 6 and 7. `isStepCount` is the AI SDK 7 name (AI SDK 7 needs Node 22+).
|
|
26
|
+
|
|
21
27
|
Opt-in paid check, capped by a budget:
|
|
22
28
|
|
|
23
29
|
```ts
|