ai 7.0.61 → 7.0.63
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 +15 -0
- package/dist/index.d.ts +9 -5
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +1 -1
- package/docs/02-foundations/02-providers-and-models.mdx +1 -0
- package/docs/03-ai-sdk-core/38-video-generation.mdx +16 -15
- package/docs/04-ai-sdk-ui/05-completion.mdx +21 -0
- package/docs/07-reference/01-ai-sdk-core/31-ui-message.mdx +4 -0
- package/docs/07-reference/02-ai-sdk-ui/02-use-completion.mdx +15 -2
- package/package.json +2 -2
- package/src/types/provider.ts +1 -1
- package/src/ui/process-ui-message-stream.ts +1 -0
- package/src/ui/ui-messages.ts +5 -0
- package/src/ui/use-completion.ts +4 -4
- package/src/ui/validate-ui-messages.ts +1 -0
package/dist/internal/index.js
CHANGED
|
@@ -116,6 +116,7 @@ Here are the capabilities of popular models:
|
|
|
116
116
|
|
|
117
117
|
| Provider | Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
|
|
118
118
|
| -------------------------------------------------- | ------------------------------------------- | ----------- | ----------------- | ---------- | -------------- |
|
|
119
|
+
| [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-4.6` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
119
120
|
| [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-4.5` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
120
121
|
| [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-4` | <Cross /> | <Check /> | <Check /> | <Check /> |
|
|
121
122
|
| [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-3` | <Cross /> | <Check /> | <Check /> | <Check /> |
|
|
@@ -466,20 +466,21 @@ try {
|
|
|
466
466
|
|
|
467
467
|
## Video Models
|
|
468
468
|
|
|
469
|
-
| Provider | Model | Features
|
|
470
|
-
| ----------------------------------------------------------------------- | --------------------------- |
|
|
471
|
-
| [FAL](/providers/ai-sdk-providers/fal#video-models) | `luma-dream-machine/ray-2` | Text-to-video, image-to-video
|
|
472
|
-
| [FAL](/providers/ai-sdk-providers/fal#video-models) | `minimax-video` | Text-to-video
|
|
473
|
-
| [Google](/providers/ai-sdk-providers/google#video-models) | `veo-2.0-generate-001` | Text-to-video, up to 4 videos per call
|
|
474
|
-
| [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.1-generate-001` | Text-to-video, audio generation
|
|
475
|
-
| [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.1-fast-generate-001` | Text-to-video, audio generation
|
|
476
|
-
| [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.0-generate-001` | Text-to-video, audio generation
|
|
477
|
-
| [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.0-fast-generate-001` | Text-to-video, audio generation
|
|
478
|
-
| [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-2.0-generate-001` | Text-to-video, up to 4 videos per call
|
|
479
|
-
| [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-t2v` | Text-to-video
|
|
480
|
-
| [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-i2v` | Image-to-video
|
|
481
|
-
| [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-motion-control` | Motion control
|
|
482
|
-
| [Replicate](/providers/ai-sdk-providers/replicate#video-models) | `minimax/video-01` | Text-to-video
|
|
483
|
-
| [xAI](/providers/ai-sdk-providers/xai#video-models) | `grok-imagine-video` | Text-to-video, image-to-video, editing, extension, R2V
|
|
469
|
+
| Provider | Model | Features |
|
|
470
|
+
| ----------------------------------------------------------------------- | --------------------------- | ----------------------------------------------------------------------------- |
|
|
471
|
+
| [FAL](/providers/ai-sdk-providers/fal#video-models) | `luma-dream-machine/ray-2` | Text-to-video, image-to-video |
|
|
472
|
+
| [FAL](/providers/ai-sdk-providers/fal#video-models) | `minimax-video` | Text-to-video |
|
|
473
|
+
| [Google](/providers/ai-sdk-providers/google#video-models) | `veo-2.0-generate-001` | Text-to-video, up to 4 videos per call |
|
|
474
|
+
| [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.1-generate-001` | Text-to-video, audio generation |
|
|
475
|
+
| [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.1-fast-generate-001` | Text-to-video, audio generation |
|
|
476
|
+
| [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.0-generate-001` | Text-to-video, audio generation |
|
|
477
|
+
| [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.0-fast-generate-001` | Text-to-video, audio generation |
|
|
478
|
+
| [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-2.0-generate-001` | Text-to-video, up to 4 videos per call |
|
|
479
|
+
| [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-t2v` | Text-to-video |
|
|
480
|
+
| [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-i2v` | Image-to-video |
|
|
481
|
+
| [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-motion-control` | Motion control |
|
|
482
|
+
| [Replicate](/providers/ai-sdk-providers/replicate#video-models) | `minimax/video-01` | Text-to-video |
|
|
483
|
+
| [xAI](/providers/ai-sdk-providers/xai#video-models) | `grok-imagine-video` | Text-to-video, image-to-video, editing, extension, R2V |
|
|
484
|
+
| [xAI](/providers/ai-sdk-providers/xai#video-models) | `grok-imagine-video-1.5` | Text-to-video, image-to-video, editing, extension, R2V (with reference audio) |
|
|
484
485
|
|
|
485
486
|
Above are a small subset of the video models supported by the AI SDK providers. For more, see the respective provider documentation.
|
|
@@ -185,3 +185,24 @@ const { messages, input, handleInputChange, handleSubmit } = useCompletion({
|
|
|
185
185
|
```
|
|
186
186
|
|
|
187
187
|
In this example, the `useCompletion` hook sends a POST request to the `/api/completion` endpoint with the specified headers, additional body fields, and credentials for that fetch request. On your server side, you can handle the request with these additional information.
|
|
188
|
+
|
|
189
|
+
You can provide a type for the additional body fields. The type applies to
|
|
190
|
+
both the body configured on the hook and the body passed to `complete`:
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
type CompletionBody = {
|
|
194
|
+
model: 'fast' | 'smart';
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const { complete } = useCompletion<CompletionBody>({
|
|
198
|
+
body: {
|
|
199
|
+
model: 'fast',
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
await complete('What is a completion?', {
|
|
204
|
+
body: {
|
|
205
|
+
model: 'smart',
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
```
|
|
@@ -42,6 +42,19 @@ Allows you to create text completion based capabilities for your application. It
|
|
|
42
42
|
|
|
43
43
|
## API Signature
|
|
44
44
|
|
|
45
|
+
### Type Parameters
|
|
46
|
+
|
|
47
|
+
<PropertiesTable
|
|
48
|
+
content={[
|
|
49
|
+
{
|
|
50
|
+
name: 'BODY',
|
|
51
|
+
type: 'object',
|
|
52
|
+
description:
|
|
53
|
+
'The type of the additional request body passed through the hook options or the complete function. Defaults to object.',
|
|
54
|
+
},
|
|
55
|
+
]}
|
|
56
|
+
/>
|
|
57
|
+
|
|
45
58
|
### Parameters
|
|
46
59
|
|
|
47
60
|
<PropertiesTable
|
|
@@ -88,7 +101,7 @@ Allows you to create text completion based capabilities for your application. It
|
|
|
88
101
|
},
|
|
89
102
|
{
|
|
90
103
|
name: 'body',
|
|
91
|
-
type: '
|
|
104
|
+
type: 'BODY',
|
|
92
105
|
description:
|
|
93
106
|
'An optional, additional body object to be passed to the API endpoint.',
|
|
94
107
|
},
|
|
@@ -134,7 +147,7 @@ Allows you to create text completion based capabilities for your application. It
|
|
|
134
147
|
},
|
|
135
148
|
{
|
|
136
149
|
name: 'complete',
|
|
137
|
-
type: '(prompt: string, options?: { headers?: Record<string, string> | Headers, body?:
|
|
150
|
+
type: '(prompt: string, options?: { headers?: Record<string, string> | Headers, body?: BODY }) => Promise<string | null | undefined>',
|
|
138
151
|
description:
|
|
139
152
|
'Function to execute text completion based on the provided prompt. Returns the completion result when finished.',
|
|
140
153
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.63",
|
|
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,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@ai-sdk/gateway": "4.0.
|
|
45
|
+
"@ai-sdk/gateway": "4.0.50",
|
|
46
46
|
"@ai-sdk/provider": "4.0.7",
|
|
47
47
|
"@ai-sdk/provider-utils": "5.0.27"
|
|
48
48
|
},
|
package/src/types/provider.ts
CHANGED
|
@@ -484,6 +484,7 @@ export function processUIMessageStream<UI_MESSAGE extends UIMessage>({
|
|
|
484
484
|
case 'reasoning-start': {
|
|
485
485
|
const reasoningPart: ReasoningUIPart = {
|
|
486
486
|
type: 'reasoning',
|
|
487
|
+
id: chunk.id,
|
|
487
488
|
text: '',
|
|
488
489
|
providerMetadata: chunk.providerMetadata,
|
|
489
490
|
state: 'streaming',
|
package/src/ui/ui-messages.ts
CHANGED
package/src/ui/use-completion.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FetchFunction } from '@ai-sdk/provider-utils';
|
|
2
2
|
|
|
3
|
-
export type CompletionRequestOptions = {
|
|
3
|
+
export type CompletionRequestOptions<BODY extends object = object> = {
|
|
4
4
|
/**
|
|
5
5
|
* An optional object of headers to be passed to the API endpoint.
|
|
6
6
|
*/
|
|
@@ -9,10 +9,10 @@ export type CompletionRequestOptions = {
|
|
|
9
9
|
/**
|
|
10
10
|
* An optional object to be passed to the API endpoint.
|
|
11
11
|
*/
|
|
12
|
-
body?:
|
|
12
|
+
body?: BODY;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export type UseCompletionOptions = {
|
|
15
|
+
export type UseCompletionOptions<BODY extends object = object> = {
|
|
16
16
|
/**
|
|
17
17
|
* The API endpoint that accepts a `{ prompt: string }` object and returns
|
|
18
18
|
* a stream of tokens of the AI completion response. Defaults to `/api/completion`.
|
|
@@ -69,7 +69,7 @@ export type UseCompletionOptions = {
|
|
|
69
69
|
* })
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
|
-
body?:
|
|
72
|
+
body?: BODY;
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* Streaming protocol that is used. Defaults to `data`.
|