ai 5.0.89 → 5.0.90

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
@@ -1,5 +1,11 @@
1
1
  # ai
2
2
 
3
+ ## 5.0.90
4
+
5
+ ### Patch Changes
6
+
7
+ - 818b144: fix not catching of empty arrays in validateUIMessage
8
+
3
9
  ## 5.0.89
4
10
 
5
11
  ### Patch Changes
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 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 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.
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
 
@@ -14,38 +14,63 @@ You will need Node.js 18+ and npm (or another package manager) installed on your
14
14
  npm install ai
15
15
  ```
16
16
 
17
- ## Usage
18
-
19
- ### AI SDK Core
20
-
21
- The [AI SDK Core](https://ai-sdk.dev/docs/ai-sdk-core/overview) module provides a unified API to interact with model providers like [OpenAI](https://ai-sdk.dev/providers/ai-sdk-providers/openai), [Anthropic](https://ai-sdk.dev/providers/ai-sdk-providers/anthropic), [Google](https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai), and more.
17
+ ## Unified Provider Architecture
22
18
 
23
- You will then install the model provider of your choice.
19
+ The AI SDK provides a [unified API](https://ai-sdk.dev/docs/foundations/providers-and-models) to interact with model providers like [OpenAI](https://ai-sdk.dev/providers/ai-sdk-providers/openai), [Anthropic](https://ai-sdk.dev/providers/ai-sdk-providers/anthropic), [Google](https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai), and [more](https://ai-sdk.dev/providers/ai-sdk-providers).
24
20
 
25
21
  ```shell
26
- npm install @ai-sdk/openai
22
+ npm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google
27
23
  ```
28
24
 
29
- ###### @/index.ts (Node.js Runtime)
25
+ Alternatively you can use the [Vercel AI Gateway](https://vercel.com/docs/ai-gateway).
26
+
27
+ ## Usage
28
+
29
+ ### Generating Text
30
+
31
+ ```ts
32
+ import { generateText } from 'ai';
33
+
34
+ const { text } = await generateText({
35
+ model: 'openai/gpt-5', // use Vercel AI Gateway
36
+ prompt: 'What is an agent?',
37
+ });
38
+ ```
30
39
 
31
40
  ```ts
32
41
  import { generateText } from 'ai';
33
- import { openai } from '@ai-sdk/openai'; // Ensure OPENAI_API_KEY environment variable is set
42
+ import { openai } from '@ai-sdk/openai';
34
43
 
35
44
  const { text } = await generateText({
36
- model: openai('gpt-4o'),
37
- system: 'You are a friendly assistant!',
38
- prompt: 'Why is the sky blue?',
45
+ model: openai('gpt-5'), // use OpenAI Responses API directly
46
+ prompt: 'What is an agent?',
39
47
  });
48
+ ```
49
+
50
+ ### Generating Structured Data
40
51
 
41
- console.log(text);
52
+ ```ts
53
+ import { generateObject } from 'ai';
54
+ import { z } from 'zod';
55
+
56
+ const { object } = await generateObject({
57
+ model: 'openai/gpt-5',
58
+ schema: z.object({
59
+ recipe: z.object({
60
+ name: z.string(),
61
+ ingredients: z.array(z.object({ name: z.string(), amount: z.string() })),
62
+ steps: z.array(z.string()),
63
+ }),
64
+ }),
65
+ prompt: 'Generate a lasagna recipe.',
66
+ });
42
67
  ```
43
68
 
44
- ### AI SDK UI
69
+ ### UI Integration
45
70
 
46
71
  The [AI SDK UI](https://ai-sdk.dev/docs/ai-sdk-ui/overview) module provides a set of hooks that help you build chatbots and generative user interfaces. These hooks are framework agnostic, so they can be used in Next.js, React, Svelte, and Vue.
47
72
 
48
- You need to install the package for your framework:
73
+ You need to install the package for your framework, e.g.:
49
74
 
50
75
  ```shell
51
76
  npm install @ai-sdk/react
@@ -122,7 +147,7 @@ We've built [templates](https://vercel.com/templates?type=ai) that include AI SD
122
147
 
123
148
  ## Community
124
149
 
125
- The AI SDK community can be found on [GitHub Discussions](https://github.com/vercel/ai/discussions) where you can ask questions, voice ideas, and share your projects with other people.
150
+ The AI SDK community can be found on [the Vercel Community](https://community.vercel.com/c/ai-sdk/62) where you can ask questions, voice ideas, and share your projects with other people.
126
151
 
127
152
  ## Contributing
128
153
 
package/dist/index.js CHANGED
@@ -764,7 +764,7 @@ function detectMediaType({
764
764
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
765
765
 
766
766
  // src/version.ts
767
- var VERSION = true ? "5.0.89" : "0.0.0-test";
767
+ var VERSION = true ? "5.0.90" : "0.0.0-test";
768
768
 
769
769
  // src/util/download/download.ts
770
770
  var download = async ({ url }) => {
@@ -9737,9 +9737,9 @@ var uiMessagesSchema = (0, import_provider_utils32.lazyValidator)(
9737
9737
  })
9738
9738
  })
9739
9739
  ])
9740
- )
9740
+ ).nonempty("Message must contain at least one part")
9741
9741
  })
9742
- )
9742
+ ).nonempty("Messages array must not be empty")
9743
9743
  )
9744
9744
  );
9745
9745
  async function safeValidateUIMessages({