ai 7.0.61 → 7.0.62
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 +6 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/internal/index.js +1 -1
- 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/02-ai-sdk-ui/02-use-completion.mdx +15 -2
- package/package.json +1 -1
- package/src/ui/use-completion.ts +4 -4
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -5761,7 +5761,7 @@ declare class TextStreamChatTransport<UI_MESSAGE extends UIMessage> extends Http
|
|
|
5761
5761
|
protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
|
|
5762
5762
|
}
|
|
5763
5763
|
|
|
5764
|
-
type CompletionRequestOptions = {
|
|
5764
|
+
type CompletionRequestOptions<BODY extends object = object> = {
|
|
5765
5765
|
/**
|
|
5766
5766
|
* An optional object of headers to be passed to the API endpoint.
|
|
5767
5767
|
*/
|
|
@@ -5769,9 +5769,9 @@ type CompletionRequestOptions = {
|
|
|
5769
5769
|
/**
|
|
5770
5770
|
* An optional object to be passed to the API endpoint.
|
|
5771
5771
|
*/
|
|
5772
|
-
body?:
|
|
5772
|
+
body?: BODY;
|
|
5773
5773
|
};
|
|
5774
|
-
type UseCompletionOptions = {
|
|
5774
|
+
type UseCompletionOptions<BODY extends object = object> = {
|
|
5775
5775
|
/**
|
|
5776
5776
|
* The API endpoint that accepts a `{ prompt: string }` object and returns
|
|
5777
5777
|
* a stream of tokens of the AI completion response. Defaults to `/api/completion`.
|
|
@@ -5821,7 +5821,7 @@ type UseCompletionOptions = {
|
|
|
5821
5821
|
* })
|
|
5822
5822
|
* ```
|
|
5823
5823
|
*/
|
|
5824
|
-
body?:
|
|
5824
|
+
body?: BODY;
|
|
5825
5825
|
/**
|
|
5826
5826
|
* Streaming protocol that is used. Defaults to `data`.
|
|
5827
5827
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1143,7 +1143,7 @@ import {
|
|
|
1143
1143
|
} from "@ai-sdk/provider-utils";
|
|
1144
1144
|
|
|
1145
1145
|
// src/version.ts
|
|
1146
|
-
var VERSION = true ? "7.0.
|
|
1146
|
+
var VERSION = true ? "7.0.62" : "0.0.0-test";
|
|
1147
1147
|
|
|
1148
1148
|
// src/util/download/download.ts
|
|
1149
1149
|
var download = async ({
|
package/dist/internal/index.js
CHANGED
|
@@ -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.62",
|
|
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",
|
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`.
|