@ai-sdk/valibot 2.0.0-beta.51 → 2.0.0-beta.52

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @ai-sdk/valibot
2
2
 
3
+ ## 2.0.0-beta.52
4
+
5
+ ### Patch Changes
6
+
7
+ - 763d04a: feat: Standard JSON Schema support
8
+ - Updated dependencies [763d04a]
9
+ - @ai-sdk/provider-utils@4.0.0-beta.52
10
+
3
11
  ## 2.0.0-beta.51
4
12
 
5
13
  ### Patch Changes
package/README.md CHANGED
@@ -1,7 +1,42 @@
1
1
  # AI SDK - Valibot Schema Support
2
2
 
3
+ Allows you to use [Valibot](https://valibot.dev/) schemas with AI SDK.
4
+
5
+ The `valibotSchema` function supports both validation and JSON schema conversion
6
+ for Valibot schemas.
7
+
3
8
  ## Setup
4
9
 
5
10
  ```bash
6
- npm i @ai-sdk/valibot
11
+ npm install @ai-sdk/valibot
12
+ ```
13
+
14
+ ## Example
15
+
16
+ ```ts
17
+ import { anthropic } from '@ai-sdk/anthropic';
18
+ import { valibotSchema } from '@ai-sdk/valibot';
19
+ import { generateText, Output } from 'ai';
20
+ import * as v from 'valibot';
21
+
22
+ const result = await generateText({
23
+ model: anthropic('claude-3-7-sonnet-latest'),
24
+ output: Output.object({
25
+ schema: valibotSchema(
26
+ v.object({
27
+ recipe: v.object({
28
+ name: v.string(),
29
+ ingredients: v.array(
30
+ v.object({
31
+ name: v.string(),
32
+ amount: v.string(),
33
+ }),
34
+ ),
35
+ steps: v.array(v.string()),
36
+ }),
37
+ }),
38
+ ),
39
+ }),
40
+ prompt: 'Generate a lasagna recipe.',
41
+ });
7
42
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/valibot",
3
- "version": "2.0.0-beta.51",
3
+ "version": "2.0.0-beta.52",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -20,7 +20,7 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@ai-sdk/provider-utils": "4.0.0-beta.51"
23
+ "@ai-sdk/provider-utils": "4.0.0-beta.52"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "20.17.24",