AI SDK RSCrender (Deprecated)
render
(Deprecated)
A helper function to create a streamable UI from LLM providers. This function is similar to AI SDK Core APIs and supports the same model interfaces.
Note:
render
has been deprecated in favor ofstreamUI
. During migration, please ensure that themessages
parameter follows the updated specification.
Import
import { render } from "ai/rsc"
Object Parameter
model:
Model identifier, must be OpenAI SDK compatible.
provider:
Currently the only provider available is OpenAI. This needs to match the model name.
initial?:
The initial UI to render.
messages:
A list of messages that represent a conversation.
SystemMessage
role:
The role for the system message.
content:
The content of the message.
UserMessage
role:
The role for the user message.
content:
The content of the message.
AssistantMessage
role:
The role for the assistant message.
content:
The content of the message.
tool_calls:
A list of tool calls made by the model.
ToolCall
id:
The id of the tool call.
type:
The type of the tool call.
function:
The function to call.
Function
name:
The name of the function.
arguments:
The arguments of the function.
ToolMessage
role:
The role for the tool message.
content:
The content of the message.
toolCallId:
The id of the tool call.
functions?:
Tools that are accessible to and can be called by the model.
Tool
description?:
Information about the purpose of the tool including details on how and when it can be used by the model.
parameters:
The typed schema that describes the parameters of the tool that can also be used to validation and error handling.
render?:
An async function that is called with the arguments from the tool call and produces a result.
tools?:
Tools that are accessible to and can be called by the model.
Tool
description?:
Information about the purpose of the tool including details on how and when it can be used by the model.
parameters:
The typed schema that describes the parameters of the tool that can also be used to validation and error handling.
render?:
An async function that is called with the arguments from the tool call and produces a result.
text?:
Callback to handle the generated tokens from the model.
Text
content:
The full content of the completion.
delta:
The delta.
done:
Is it done?
temperature?:
The temperature to use for the model.
Returns
It can return any valid ReactNode.