Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion packages/ai/rsc/stream-ui/stream-ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ type RenderText = Renderer<
* If `true`, the `content` will be the final output and this call will be the last.
*/
done: boolean;

/**
* The provider metadata.
*/
providerMetadata: ProviderMetadata<{
perplexity: {
citations: string[]
}
}>;
},
]
>;
Expand Down Expand Up @@ -206,6 +215,11 @@ functionality that can be fully encapsulated in the provider.
rawResponse?: {
headers?: Record<string, string>;
};
providerMetadata: ProviderMetadata<{
perplexity: {
citations: string[]
}
}>;
} | null = null;

async function render({
Expand Down Expand Up @@ -370,6 +384,7 @@ functionality that can be fully encapsulated in the provider.
usage: calculateLanguageModelUsage(value.usage),
warnings: result.warnings,
rawResponse: result.rawResponse,
providerMetadata: result.providerMetadata,
};
break;
}
Expand All @@ -379,7 +394,7 @@ functionality that can be fully encapsulated in the provider.
if (!hasToolCall) {
render({
renderer: textRender,
args: [{ content, done: true }],
args: [{ content, done: true, providerMetadata: finishEvent?.providerMetadata || {} }],
streamableUI: ui,
isLastCall: true,
});
Expand Down