Request: Clarifying Conversation Handling in conversations
API
#9029
Unanswered
tomfuller71
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Has anyone successfully used the Conversations API to replicate the old “thread” concept from the Assistants API?
My assistant conversations can get quite long, and I’d like to implement a flow similar to the previous thread model:
Initial Message
I can use the
sendMessage
function returned from theuseChat
hook to include aChatRequestOptions
headers object with afirstMessage: true
header. I can use this in my api route to trigger the creation of a new conversation using the Conversations API and receive theconversation_id
(similar to the old “create thread”). In my API route, I would then create a chat session record in my database to hold UIMessages plus metadata.How should I send the
conversation_id
back to the client?providerMetadata
onfinish
?useChat
hook be extended to maintain state forconversationId
?Subsequent Messages
If I can receive the
conversation_id
client-side, I can include it as a header option insendMessage
. But how do I pass this sameconversation_id
tostreamText
in my api route so that it gets included in the underlyingResponse
API call?Beta Was this translation helpful? Give feedback.
All reactions