ai 7.0.17 → 7.0.18
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
package/dist/index.js
CHANGED
|
@@ -1089,7 +1089,7 @@ import {
|
|
|
1089
1089
|
} from "@ai-sdk/provider-utils";
|
|
1090
1090
|
|
|
1091
1091
|
// src/version.ts
|
|
1092
|
-
var VERSION = true ? "7.0.
|
|
1092
|
+
var VERSION = true ? "7.0.18" : "0.0.0-test";
|
|
1093
1093
|
|
|
1094
1094
|
// src/util/download/download.ts
|
|
1095
1095
|
var download = async ({
|
package/dist/internal/index.js
CHANGED
|
@@ -5,10 +5,7 @@ description: Learn how to use the useObject hook.
|
|
|
5
5
|
|
|
6
6
|
# Object Generation
|
|
7
7
|
|
|
8
|
-
<Note>
|
|
9
|
-
`useObject` is an experimental feature and only available in React, Svelte,
|
|
10
|
-
and Vue.
|
|
11
|
-
</Note>
|
|
8
|
+
<Note>`useObject` is only available in React, Svelte, and Vue.</Note>
|
|
12
9
|
|
|
13
10
|
The [`useObject`](/docs/reference/ai-sdk-ui/use-object) hook allows you to create interfaces that represent a structured JSON object that is being streamed.
|
|
14
11
|
|
|
@@ -46,7 +43,7 @@ Please note the code for handling `undefined` values in the JSX.
|
|
|
46
43
|
```tsx filename='app/page.tsx'
|
|
47
44
|
'use client';
|
|
48
45
|
|
|
49
|
-
import {
|
|
46
|
+
import { useObject } from '@ai-sdk/react';
|
|
50
47
|
import { notificationSchema } from './api/notifications/schema';
|
|
51
48
|
|
|
52
49
|
export default function Page() {
|
|
@@ -115,7 +112,7 @@ When using `useObject` with enum output mode, your schema must be an object with
|
|
|
115
112
|
```tsx filename='app/classify/page.tsx'
|
|
116
113
|
'use client';
|
|
117
114
|
|
|
118
|
-
import {
|
|
115
|
+
import { useObject } from '@ai-sdk/react';
|
|
119
116
|
import { z } from 'zod';
|
|
120
117
|
|
|
121
118
|
export default function ClassifyPage() {
|
|
@@ -174,7 +171,7 @@ purposes:
|
|
|
174
171
|
```tsx filename='app/page.tsx' highlight="6,13-20,24"
|
|
175
172
|
'use client';
|
|
176
173
|
|
|
177
|
-
import {
|
|
174
|
+
import { useObject } from '@ai-sdk/react';
|
|
178
175
|
|
|
179
176
|
export default function Page() {
|
|
180
177
|
const { isLoading, object, submit } = useObject({
|
|
@@ -211,7 +208,7 @@ The `stop` function can be used to stop the object generation process. This can
|
|
|
211
208
|
```tsx filename='app/page.tsx' highlight="6,14-16"
|
|
212
209
|
'use client';
|
|
213
210
|
|
|
214
|
-
import {
|
|
211
|
+
import { useObject } from '@ai-sdk/react';
|
|
215
212
|
|
|
216
213
|
export default function Page() {
|
|
217
214
|
const { isLoading, stop, object, submit } = useObject({
|
|
@@ -256,7 +253,7 @@ It can be used to display an error message, or to disable the submit button:
|
|
|
256
253
|
```tsx file="app/page.tsx" highlight="6,13"
|
|
257
254
|
'use client';
|
|
258
255
|
|
|
259
|
-
import {
|
|
256
|
+
import { useObject } from '@ai-sdk/react';
|
|
260
257
|
|
|
261
258
|
export default function Page() {
|
|
262
259
|
const { error, object, submit } = useObject({
|
|
@@ -295,7 +292,7 @@ These callbacks can be used to trigger additional actions, such as logging, anal
|
|
|
295
292
|
```tsx filename='app/page.tsx' highlight="10-20"
|
|
296
293
|
'use client';
|
|
297
294
|
|
|
298
|
-
import {
|
|
295
|
+
import { useObject } from '@ai-sdk/react';
|
|
299
296
|
import { notificationSchema } from './api/notifications/schema';
|
|
300
297
|
|
|
301
298
|
export default function Page() {
|
|
@@ -3,12 +3,9 @@ title: useObject
|
|
|
3
3
|
description: API reference for the useObject hook.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# `
|
|
6
|
+
# `useObject()`
|
|
7
7
|
|
|
8
|
-
<Note>
|
|
9
|
-
`useObject` is an experimental feature and only available in React, Svelte,
|
|
10
|
-
and Vue.
|
|
11
|
-
</Note>
|
|
8
|
+
<Note>`useObject` is only available in React, Svelte, and Vue.</Note>
|
|
12
9
|
|
|
13
10
|
Allows you to consume text streams that represent a JSON object and parse them into a complete object based on a schema.
|
|
14
11
|
You can use it together with [`streamText`](/docs/reference/ai-sdk-core/stream-text) and [`Output.object()`](/docs/reference/ai-sdk-core/output#output-object) in the backend.
|
|
@@ -16,7 +13,7 @@ You can use it together with [`streamText`](/docs/reference/ai-sdk-core/stream-t
|
|
|
16
13
|
```tsx
|
|
17
14
|
'use client';
|
|
18
15
|
|
|
19
|
-
import {
|
|
16
|
+
import { useObject } from '@ai-sdk/react';
|
|
20
17
|
|
|
21
18
|
export default function Page() {
|
|
22
19
|
const { object, submit } = useObject({
|
|
@@ -38,21 +35,21 @@ export default function Page() {
|
|
|
38
35
|
<Tabs items={['React', 'Svelte', 'Vue']}>
|
|
39
36
|
<Tab>
|
|
40
37
|
<Snippet
|
|
41
|
-
text="import {
|
|
38
|
+
text="import { useObject } from '@ai-sdk/react'"
|
|
42
39
|
dark
|
|
43
40
|
prompt={false}
|
|
44
41
|
/>
|
|
45
42
|
</Tab>
|
|
46
43
|
<Tab>
|
|
47
44
|
<Snippet
|
|
48
|
-
text="import {
|
|
45
|
+
text="import { StructuredObject } from '@ai-sdk/svelte'"
|
|
49
46
|
dark
|
|
50
47
|
prompt={false}
|
|
51
48
|
/>
|
|
52
49
|
</Tab>
|
|
53
50
|
<Tab>
|
|
54
51
|
<Snippet
|
|
55
|
-
text="import {
|
|
52
|
+
text="import { useObject } from '@ai-sdk/vue'"
|
|
56
53
|
dark
|
|
57
54
|
prompt={false}
|
|
58
55
|
/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@ai-sdk/gateway": "4.0.
|
|
45
|
+
"@ai-sdk/gateway": "4.0.14",
|
|
46
46
|
"@ai-sdk/provider": "4.0.2",
|
|
47
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
47
|
+
"@ai-sdk/provider-utils": "5.0.6"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@edge-runtime/vm": "^5.0.0",
|