How to store streaming results in a database #164
Answered
by
MaxLeiter
yutakobayashidev
asked this question in
Help
-
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.
Answered by
MaxLeiter
Jun 20, 2023
Replies: 1 comment 1 reply
-
On the client, you can use the On the server, you can use the |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
MaxLeiter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On the client, you can use the
onFinish
callback available in use-completion and use-chat.On the server, you can use the
onCompletion
callback that's part ofAIStream
: https://sdk.vercel.ai/docs/api-reference/ai-stream#aistreamcallbacks, like in this example