AI SDK RSCgetAIState

getAIState

AI SDK RSC is currently experimental. We recommend using AI SDK UI for production. For guidance on migrating from RSC to UI, see our migration guide.

Get the current AI state.

Import

import { getAIState } from "ai/rsc"

API Signature

Parameters

key?:

string
Returns the value of the specified key in the AI state, if it's an object.

Returns

The AI state.

Examples