Skip to content
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

Allow callbacks after append and stream #6805

Merged
merged 4 commits into from
May 8, 2024
Merged

Conversation

ahuang11
Copy link
Contributor

@ahuang11 ahuang11 commented May 1, 2024

Motivated by holoviz/lumen#544

I'd like to trigger a callback after every new message, but it's hard to do right now because of the various ways to append a message.

Initially I wanted to just super append but it doesn't cover the case of streaming (e.g. the contents were empty for the callback trigger). Here, I wait for all the streaming to be done before triggering append callback.

@ahuang11 ahuang11 marked this pull request as draft May 1, 2024 17:30
@ahuang11 ahuang11 requested a review from philippjfr May 2, 2024 17:53
@ahuang11 ahuang11 marked this pull request as ready for review May 2, 2024 17:54
@philippjfr
Copy link
Member

Hmm, should we not simply be waiting to trigger the regular callback until it's done streaming?

@ahuang11
Copy link
Contributor Author

ahuang11 commented May 7, 2024

to trigger the regular callback until it's done streaming?

If I understand correctly, the regular callback triggers the streaming, i.e.

  1. user sends a message
  2. "regular callback" runs the response callback that could stream output
  3. append_callback runs after the regular callback

@philippjfr philippjfr merged commit f2e2128 into main May 8, 2024
13 of 14 checks passed
@philippjfr philippjfr deleted the add_append_callback branch May 8, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants