本页还没有译文
本页 9 段还没译成Español,下面显示的是英文原文。AI SDK UI
还没翻译译自英文(ai-sdk.dev)本页 9 段都还没译
AI SDK UI is designed to help you build interactive chat, completion, and assistant applications with ease. It is a framework-agnostic toolkit, streamlining the integration of advanced AI functionalities into your applications.
AI SDK UI contains the following hooks:
- useChat: Use a hook to interact with language models in a chat interface.
- useCompletion: Use a hook to interact with language models in a completion interface.
- useObject: Use a hook for consuming a streamed JSON objects.
- experimental_useRealtime: Use a hook to build realtime voice conversations.
- convertToModelMessages: Convert useChat messages to ModelMessages for AI functions.
- pruneMessages: Prunes model messages from a list of model messages.
- createUIMessageStream: Create a UI message stream to stream additional data to the client.
- createUIMessageStreamResponse: Create a response object to stream UI messages to the client.
- pipeUIMessageStreamToResponse: Pipe a UI message stream to a Node.js ServerResponse object.
- readUIMessageStream: Transform a stream of UIMessageChunk objects into an AsyncIterableStream of UIMessage objects.
- WebSocketChatTransport: Send correlated chat requests and UI message streams over a persistent WebSocket connection.
- experimental_MCPAppRenderer: Render interactive MCP App tool UIs in React.
UI Framework Support
AI SDK UI supports the following frameworks: React, Svelte, Vue.js, Angular, and SolidJS.
Here is a comparison of the supported functions across these frameworks:
| useChat | useCompletion | useObject | MCP Apps | |
|---|---|---|---|---|
React @ai-sdk/react | ✓ | ✓ | ✓ | ✓ |
Vue.js @ai-sdk/vue | ✓ Chat | ✓ | ✓ | ✗ |
Svelte @ai-sdk/svelte | ✓ Chat | ✓ Completion | ✓ StructuredObject | ✗ |
Angular @ai-sdk/angular | ✓ Chat | ✓ Completion | ✓ StructuredObject | ✗ |
| SolidJS (community) | ✓ | ✓ | ✓ | ✗ |
Note
Contributions are welcome to implement missing features for non-React frameworks.
AI 翻译查看英文原文