Closed pavlogolovatyy closed 1 week ago
This should be able to do something similar, but maybe outdated: https://github.com/vercel-labs/gemini-chatbot
I'm also interested in a solution to be able to implement chain of thoughts using AI SDK.
It seems like the issue might stem from the following lines of code in prompt-form.tsx:
const [_, setMessages] = useUIState<typeof AI>()
const responseMessage = await submitUserMessage(value)
setMessages(currentMessages => [...currentMessages, responseMessage])
The submitUserMessage
function is returning a single message. Additionally, during refresh, the messages are being fetched from AIState
.
@pavlogolovatyy Curious to see if you found a better way.
The Completions API has a single output. You may want to look into the assistants API
AI SDK 3.2 has new feature that maybe helpful
Something like in the docs of AI SDK RSC:
User: What's the status of my wife's upcoming flight? Function: lookupContacts() -> ["John Doe", "Jane Doe"] Function: lookupBooking("Jane Doe") -> "BA123 confirmed" Function: lookupFlight("BA123") -> "Flight BA123 is scheduled to depart on 12th December." Model: Your wife's flight BA123 is confirmed and scheduled to depart on 12th December.
Before refreshing the chat, only the last UI will be visible: lookupFlight.
How to handle all functions return without refreshing the page?