ai 0.0.0-156c9f7b-20250115085202 → 0.0.0-677c097b-20250505090413

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/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  # AI SDK
4
4
 
5
- The [AI SDK](https://sdk.vercel.ai/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 using popular frameworks like Next.js, React, Svelte, Vue and runtimes like Node.js.
6
6
 
7
- To learn more about how to use the AI SDK, check out our [API Reference](https://sdk.vercel.ai/docs/reference) and [Documentation](https://sdk.vercel.ai/docs).
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
 
9
9
  ## Installation
10
10
 
@@ -18,7 +18,7 @@ npm install ai
18
18
 
19
19
  ### AI SDK Core
20
20
 
21
- The [AI SDK Core](https://sdk.vercel.ai/docs/ai-sdk-core/overview) module provides a unified API to interact with model providers like [OpenAI](https://sdk.vercel.ai/providers/ai-sdk-providers/openai), [Anthropic](https://sdk.vercel.ai/providers/ai-sdk-providers/anthropic), [Google](https://sdk.vercel.ai/providers/ai-sdk-providers/google-generative-ai), and more.
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.
22
22
 
23
23
  You will then install the model provider of your choice.
24
24
 
@@ -43,25 +43,38 @@ console.log(text);
43
43
 
44
44
  ### AI SDK UI
45
45
 
46
- The [AI SDK UI](https://sdk.vercel.ai/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, Vue, and SolidJS.
46
+ 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
+
48
+ You need to install the package for your framework:
49
+
50
+ ```shell
51
+ npm install @ai-sdk/react
52
+ ```
47
53
 
48
54
  ###### @/app/page.tsx (Next.js App Router)
49
55
 
50
56
  ```tsx
51
57
  'use client';
52
58
 
53
- import { useChat } from 'ai/react';
59
+ import { useChat } from '@ai-sdk/react';
54
60
 
55
61
  export default function Page() {
56
- const { messages, input, handleSubmit, handleInputChange, isLoading } =
62
+ const { messages, input, handleSubmit, handleInputChange, status } =
57
63
  useChat();
58
64
 
59
65
  return (
60
66
  <div>
61
67
  {messages.map(message => (
62
68
  <div key={message.id}>
63
- <div>{message.role}</div>
64
- <div>{message.content}</div>
69
+ <strong>{`${message.role}: `}</strong>
70
+ {message.parts.map((part, index) => {
71
+ switch (part.type) {
72
+ case 'text':
73
+ return <span key={index}>{part.text}</span>;
74
+
75
+ // other cases can handle images, tool calls, etc
76
+ }
77
+ })}
65
78
  </div>
66
79
  ))}
67
80
 
@@ -70,7 +83,7 @@ export default function Page() {
70
83
  value={input}
71
84
  placeholder="Send a message..."
72
85
  onChange={handleInputChange}
73
- disabled={isLoading}
86
+ disabled={status !== 'ready'}
74
87
  />
75
88
  </form>
76
89
  </div>