ai 6.0.212 → 6.0.214
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 +19 -0
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/03-ai-sdk-core/16-mcp-tools.mdx +46 -0
- package/docs/03-ai-sdk-core/38-video-generation.mdx +15 -0
- package/docs/07-reference/01-ai-sdk-core/13-generate-video.mdx +7 -0
- package/docs/07-reference/01-ai-sdk-core/23-create-mcp-client.mdx +42 -0
- package/package.json +4 -4
- package/src/generate-video/generate-video.ts +8 -0
package/dist/internal/index.js
CHANGED
|
@@ -152,7 +152,7 @@ function detectMediaType({
|
|
|
152
152
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
153
153
|
|
|
154
154
|
// src/version.ts
|
|
155
|
-
var VERSION = true ? "6.0.
|
|
155
|
+
var VERSION = true ? "6.0.214" : "0.0.0-test";
|
|
156
156
|
|
|
157
157
|
// src/util/download/download.ts
|
|
158
158
|
var download = async ({
|
package/dist/internal/index.mjs
CHANGED
|
@@ -313,6 +313,52 @@ Resource templates are dynamic URI patterns that allow flexible queries. List al
|
|
|
313
313
|
const templates = await mcpClient.listResourceTemplates();
|
|
314
314
|
```
|
|
315
315
|
|
|
316
|
+
## Using MCP Completions
|
|
317
|
+
|
|
318
|
+
MCP servers can provide autocompletion suggestions for prompt arguments and
|
|
319
|
+
resource template variables when they advertise the `completions` capability.
|
|
320
|
+
Use `complete` to ask the server for suggestions based on the current partial
|
|
321
|
+
argument value:
|
|
322
|
+
|
|
323
|
+
```typescript
|
|
324
|
+
const completion = await mcpClient.complete({
|
|
325
|
+
ref: {
|
|
326
|
+
type: 'ref/resource',
|
|
327
|
+
uri: 'file:///{path}',
|
|
328
|
+
},
|
|
329
|
+
argument: {
|
|
330
|
+
name: 'path',
|
|
331
|
+
value: 'doc',
|
|
332
|
+
},
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
console.log(completion.completion.values);
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
For resource templates or prompts with multiple arguments, pass already resolved
|
|
339
|
+
values through `context.arguments`:
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
const completion = await mcpClient.complete({
|
|
343
|
+
ref: {
|
|
344
|
+
type: 'ref/resource',
|
|
345
|
+
uri: 'kubernetes://namespaced/{plural}/{namespace}',
|
|
346
|
+
},
|
|
347
|
+
argument: {
|
|
348
|
+
name: 'namespace',
|
|
349
|
+
value: 'auth',
|
|
350
|
+
},
|
|
351
|
+
context: {
|
|
352
|
+
arguments: {
|
|
353
|
+
plural: 'deployments',
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
});
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
If the connected server does not advertise `capabilities.completions`, the
|
|
360
|
+
client throws an `MCPClientError`.
|
|
361
|
+
|
|
316
362
|
## Using MCP Prompts
|
|
317
363
|
|
|
318
364
|
<Note type="warning">
|
|
@@ -94,6 +94,21 @@ const { video } = await generateVideo({
|
|
|
94
94
|
});
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
### Audio Generation
|
|
98
|
+
|
|
99
|
+
Some video models can generate audio alongside the video. Use the `generateAudio` option to control this:
|
|
100
|
+
|
|
101
|
+
```tsx highlight={"7"}
|
|
102
|
+
import { experimental_generateVideo as generateVideo } from 'ai';
|
|
103
|
+
__PROVIDER_IMPORT__;
|
|
104
|
+
|
|
105
|
+
const { video } = await generateVideo({
|
|
106
|
+
model: __VIDEO_MODEL__,
|
|
107
|
+
prompt: 'A jazz band playing in a cozy club',
|
|
108
|
+
generateAudio: true,
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
97
112
|
### Generating Multiple Videos
|
|
98
113
|
|
|
99
114
|
`experimental_generateVideo` supports generating multiple videos at once:
|
|
@@ -110,6 +110,13 @@ console.log(videos);
|
|
|
110
110
|
isOptional: true,
|
|
111
111
|
description: 'Seed for the video generation.',
|
|
112
112
|
},
|
|
113
|
+
{
|
|
114
|
+
name: 'generateAudio',
|
|
115
|
+
type: 'boolean',
|
|
116
|
+
isOptional: true,
|
|
117
|
+
description:
|
|
118
|
+
'Whether the model should generate audio alongside the video.',
|
|
119
|
+
},
|
|
113
120
|
{
|
|
114
121
|
name: 'providerOptions',
|
|
115
122
|
type: 'ProviderOptions',
|
|
@@ -10,6 +10,7 @@ Creates a lightweight Model Context Protocol (MCP) client that connects to an MC
|
|
|
10
10
|
- **Tools**: Automatic conversion between MCP tools and AI SDK tools
|
|
11
11
|
- **Resources**: Methods to list, read, and discover resource templates from MCP servers
|
|
12
12
|
- **Prompts**: Methods to list available prompts and retrieve prompt messages
|
|
13
|
+
- **Completions**: Methods to request autocompletion suggestions for prompt arguments and resource template variables
|
|
13
14
|
- **Elicitation**: Support for handling server requests for additional input during tool execution
|
|
14
15
|
|
|
15
16
|
It currently does not support accepting notifications from an MCP server, and custom configuration of the client.
|
|
@@ -294,6 +295,47 @@ Returns a Promise that resolves to an `MCPClient` with the following properties
|
|
|
294
295
|
},
|
|
295
296
|
],
|
|
296
297
|
},
|
|
298
|
+
{
|
|
299
|
+
name: 'complete',
|
|
300
|
+
type: `async (args: CompleteRequestParams & {
|
|
301
|
+
options?: RequestOptions;
|
|
302
|
+
}) => Promise<CompleteResult>`,
|
|
303
|
+
description:
|
|
304
|
+
'Requests autocompletion suggestions for a prompt argument or resource template variable. The server must advertise the completions capability.',
|
|
305
|
+
properties: [
|
|
306
|
+
{
|
|
307
|
+
type: 'args',
|
|
308
|
+
parameters: [
|
|
309
|
+
{
|
|
310
|
+
name: 'ref',
|
|
311
|
+
type: "{ type: 'ref/prompt'; name: string } | { type: 'ref/resource'; uri: string }",
|
|
312
|
+
description:
|
|
313
|
+
'Reference to the prompt or resource template being completed.',
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
name: 'argument',
|
|
317
|
+
type: '{ name: string; value: string }',
|
|
318
|
+
description:
|
|
319
|
+
'Argument name and current partial value to complete.',
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: 'context',
|
|
323
|
+
type: '{ arguments: Record<string, string> }',
|
|
324
|
+
isOptional: true,
|
|
325
|
+
description:
|
|
326
|
+
'Previously resolved argument values used to provide context for multi-argument prompts or resource templates.',
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: 'options',
|
|
330
|
+
type: 'RequestOptions',
|
|
331
|
+
isOptional: true,
|
|
332
|
+
description:
|
|
333
|
+
'Optional request options including signal and timeout.',
|
|
334
|
+
},
|
|
335
|
+
],
|
|
336
|
+
},
|
|
337
|
+
],
|
|
338
|
+
},
|
|
297
339
|
{
|
|
298
340
|
name: 'experimental_listPrompts',
|
|
299
341
|
type: `async (options?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.214",
|
|
4
4
|
"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.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@opentelemetry/api": "^1.9.0",
|
|
48
|
-
"@ai-sdk/gateway": "3.0.
|
|
49
|
-
"@ai-sdk/provider": "3.0.
|
|
50
|
-
"@ai-sdk/provider-utils": "4.0.
|
|
48
|
+
"@ai-sdk/gateway": "3.0.139",
|
|
49
|
+
"@ai-sdk/provider": "3.0.12",
|
|
50
|
+
"@ai-sdk/provider-utils": "4.0.33"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@edge-runtime/vm": "^5.0.0",
|
|
@@ -49,6 +49,7 @@ export type GenerateVideoPrompt =
|
|
|
49
49
|
* @param duration - Duration of the video in seconds.
|
|
50
50
|
* @param fps - Frames per second for the video.
|
|
51
51
|
* @param seed - Seed for the video generation.
|
|
52
|
+
* @param generateAudio - Whether the model should generate audio alongside the video.
|
|
52
53
|
* @param providerOptions - Additional provider-specific options that are passed through to the provider
|
|
53
54
|
* as body parameters.
|
|
54
55
|
* @param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
|
|
@@ -69,6 +70,7 @@ export async function experimental_generateVideo({
|
|
|
69
70
|
duration,
|
|
70
71
|
fps,
|
|
71
72
|
seed,
|
|
73
|
+
generateAudio,
|
|
72
74
|
providerOptions,
|
|
73
75
|
maxRetries: maxRetriesArg,
|
|
74
76
|
abortSignal,
|
|
@@ -120,6 +122,11 @@ export async function experimental_generateVideo({
|
|
|
120
122
|
*/
|
|
121
123
|
seed?: number;
|
|
122
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Whether the model should generate audio alongside the video.
|
|
127
|
+
*/
|
|
128
|
+
generateAudio?: boolean;
|
|
129
|
+
|
|
123
130
|
/**
|
|
124
131
|
* Additional provider-specific options that are passed through to the provider
|
|
125
132
|
* as body parameters.
|
|
@@ -190,6 +197,7 @@ export async function experimental_generateVideo({
|
|
|
190
197
|
duration,
|
|
191
198
|
fps,
|
|
192
199
|
seed,
|
|
200
|
+
generateAudio,
|
|
193
201
|
image,
|
|
194
202
|
providerOptions: providerOptions ?? {},
|
|
195
203
|
headers: headersWithUserAgent,
|