Unable to access some of the return values from `streamUI()`
Description
Unable to access some of the return values from the returned object of streamUI. I am only being able to access rawCall, rawResponse, stream, value, and warnings. I'm unable to access values like textStream, fullStream, usage, etc. I am using google's gemini-flash as the model. This code is in actions.tsx and I am using [email protected] and [email protected].
Code example
const result = await streamUI({
model: google("models/gemini-1.5-flash-latest"),
messages: [
...aiState.get().messages.map((message: any) => ({
role: message.role,
content: message.content,
name: message.name,
})),
],
})
Additional context
No response
@ashersamuel8 with streamUI, you can use parameters to define callbacks, see https://sdk.vercel.ai/docs/ai-sdk-rsc/streaming-react-components#adding-a-tool
@lgrammel the docs suggest that these methods are returned in the result, similarly to streamText, but that doesn't appear the case. Looking through the commit history, it doesn't seem to have ever been the case in previous releases either.
https://sdk.vercel.ai/docs/reference/ai-sdk-rsc/stream-ui#returns
const result = await streamUI({
model: google("models/gemini-1.5-flash-latest"),
messages: [
...aiState.get().messages.map((message: any) => ({
role: message.role,
content: message.content,
name: message.name,
})),
],
})
// `fullStream` etc is not returned as the docs suggest
const { value, fullStream } = result
The result resolves to:
{
value: ReactNode;
} & {
stream: ReadableStream<LanguageModelV1StreamPart>;
rawCall: {
rawPrompt: unknown;
rawSettings: Record<string, unknown>;
};
rawResponse?: {
headers?: Record<string, string>;
};
warnings?: LanguageModelV1CallWarning[];
}
@Saran33 this information is incorrect. I'll update the docs. thank you
Docs fix: https://github.com/vercel/ai/pull/2871