How to store streaming results in a database #164
-
|
Hello, thank you for creating this library. Is there a way for the Edge API to save the message to the database (@planetscale/database) when the stream is completed, like the share feature in the Vercel AI Playground? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
On the client, you can use the On the server, you can use the |
Beta Was this translation helpful? Give feedback.
-
|
This discussion was automatically locked because it has not been updated in over 30 days. If you still have questions about this topic, please ask us at community.vercel.com/ai-sdk |
Beta Was this translation helpful? Give feedback.
On the client, you can use the
onFinishcallback available in use-completion and use-chat.On the server, you can use the
onCompletioncallback that's part ofAIStream: https://sdk.vercel.ai/docs/api-reference/ai-stream#aistreamcallbacks, like in this example