-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional data parameter for client requests #438
Conversation
lib/shared/src/chat/client.ts
Outdated
@@ -131,7 +141,7 @@ export async function createClient({ | |||
isMessageInProgress = true | |||
transcript.addInteraction(interaction) | |||
|
|||
sendTranscript() | |||
sendTranscript(options?.data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of this sendTranscript
here that sends an empty message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, I did not know what it is... maybe we can remove? I can check some more later
sendTranscript() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this sendTranscript
that sends an empty message serves any purpose. Removing it, unless instructed otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I don't know, it seems to get some transcript from the closure but I ran your changes and didn't notice a difference 🙈
sendTranscript() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I don't know, it seems to get some transcript from the closure but I ran your changes and didn't notice a difference 🙈
Add an optional
data?: any
parameter that's returned as-is to clients. This allows us to add something like amessageID
to completion requests and keep track of which request we're receiving back.This is especially useful for streaming responses, where we'd like to be able to handle different streamed responses concurrently, and route them based on the message ID.
Also, instead of returning
null
when the message is done, it returns only thedata
field (if present). This way we know that that message is finished and we can handle it appropriately.Test plan
🤞