vercel / ai

Build AI-powered applications with React, Svelte, Vue, and Solid
https://sdk.vercel.ai/docs
Other
10.23k stars 1.54k forks source link

fix: missing trigger onFinal callback #3840

Closed thucpn closed 1 day ago

thucpn commented 4 days ago

Hi @lgrammel, I'm not sure why onFinal is removed in this PR: https://github.com/vercel/ai/pull/3479/files#r1853548735

However, it is still an option in StreamCallbacks. https://github.com/vercel/ai/blob/d10ed1c2dce4313f75b414b871cf984c7a9bcf90/packages/ai/streams/stream-callbacks.ts#L10

You should either remove it from the StreamCallbacks options or ensure that it is triggered.

lgrammel commented 4 days ago

Ah this was an oversight, it should have been removed from the interface as well since it now does the same as onCompletion. However, to avoid breaking changes, adding it back in sounds good.

lgrammel commented 1 day ago

https://github.com/vercel/ai/pull/3860