ai 6.0.0-beta.98 → 6.0.0
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 +829 -0
- package/README.md +17 -13
- package/dist/index.d.mts +931 -626
- package/dist/index.d.ts +931 -626
- package/dist/index.js +1409 -979
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1216 -780
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +103 -6
- package/dist/internal/index.d.ts +103 -6
- package/dist/internal/index.js +124 -107
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +97 -79
- package/dist/internal/index.mjs.map +1 -1
- package/dist/test/index.d.mts +19 -19
- package/dist/test/index.d.ts +19 -19
- package/dist/test/index.js +2 -2
- package/dist/test/index.js.map +1 -1
- package/dist/test/index.mjs +2 -2
- package/dist/test/index.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# AI SDK
|
|
4
4
|
|
|
5
|
-
The [AI SDK](https://ai-sdk.dev/docs) is a TypeScript toolkit designed to help you build AI-powered applications and agents using popular frameworks like Next.js, React, Svelte, Vue and runtimes like Node.js.
|
|
5
|
+
The [AI SDK](https://ai-sdk.dev/docs) is a provider-agnostic TypeScript toolkit designed to help you build AI-powered applications and agents using popular UI frameworks like Next.js, React, Svelte, Vue, Angular, and runtimes like Node.js.
|
|
6
6
|
|
|
7
7
|
To learn more about how to use the AI SDK, check out our [API Reference](https://ai-sdk.dev/docs/reference) and [Documentation](https://ai-sdk.dev/docs).
|
|
8
8
|
|
|
@@ -50,16 +50,20 @@ const { text } = await generateText({
|
|
|
50
50
|
### Generating Structured Data
|
|
51
51
|
|
|
52
52
|
```ts
|
|
53
|
-
import {
|
|
53
|
+
import { generateText, Output } from 'ai';
|
|
54
54
|
import { z } from 'zod';
|
|
55
55
|
|
|
56
|
-
const {
|
|
57
|
-
model: 'openai/gpt-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
const { output } = await generateText({
|
|
57
|
+
model: 'openai/gpt-5',
|
|
58
|
+
output: Output.object({
|
|
59
|
+
schema: z.object({
|
|
60
|
+
recipe: z.object({
|
|
61
|
+
name: z.string(),
|
|
62
|
+
ingredients: z.array(
|
|
63
|
+
z.object({ name: z.string(), amount: z.string() }),
|
|
64
|
+
),
|
|
65
|
+
steps: z.array(z.string()),
|
|
66
|
+
}),
|
|
63
67
|
}),
|
|
64
68
|
}),
|
|
65
69
|
prompt: 'Generate a lasagna recipe.',
|
|
@@ -72,10 +76,10 @@ const { object } = await generateObject({
|
|
|
72
76
|
import { ToolLoopAgent } from 'ai';
|
|
73
77
|
|
|
74
78
|
const sandboxAgent = new ToolLoopAgent({
|
|
75
|
-
model: 'openai/gpt-5
|
|
79
|
+
model: 'openai/gpt-5',
|
|
76
80
|
system: 'You are an agent with access to a shell environment.',
|
|
77
81
|
tools: {
|
|
78
|
-
|
|
82
|
+
shell: openai.tools.localShell({
|
|
79
83
|
execute: async ({ action }) => {
|
|
80
84
|
const [cmd, ...args] = action.command;
|
|
81
85
|
const sandbox = await getSandbox(); // Vercel Sandbox
|
|
@@ -106,7 +110,7 @@ import { ToolLoopAgent, InferAgentUIMessage } from 'ai';
|
|
|
106
110
|
export const imageGenerationAgent = new ToolLoopAgent({
|
|
107
111
|
model: openai('gpt-5'),
|
|
108
112
|
tools: {
|
|
109
|
-
|
|
113
|
+
generateImage: openai.tools.imageGeneration({
|
|
110
114
|
partialImages: 3,
|
|
111
115
|
}),
|
|
112
116
|
},
|
|
@@ -182,7 +186,7 @@ export default function Page() {
|
|
|
182
186
|
switch (part.type) {
|
|
183
187
|
case 'text':
|
|
184
188
|
return <div key={index}>{part.text}</div>;
|
|
185
|
-
case 'tool-
|
|
189
|
+
case 'tool-generateImage':
|
|
186
190
|
return <ImageGenerationView key={index} invocation={part} />;
|
|
187
191
|
}
|
|
188
192
|
})}
|