Closed ashersamuel8 closed 2 months ago
@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
Description
Unable to access some of the return values from the returned object of
streamUI
. I am only being able to accessrawCall
,rawResponse
,stream
,value
, andwarnings
. I'm unable to access values liketextStream
,fullStream
,usage
, etc. I am using google's gemini-flash as the model. This code is in actions.tsx and I am using next@14.2.4 and ai@3.2.16.Code example
Additional context
No response