Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
This PR adds a small chat app in
tests/contrib/streams/examples/chat_app/that uses most parts of the Streams API.ChatSessionWorkflow. It publishes each Turn to a turns Stream, and its model Activity streams token deltas to a tokens Stream through aBufferedPublisher.Supersededitem crosses out the failed tokens. A reload or a server restart resumes each read at the tab's saved offset.client.create_stream. Each copy keeps the Turn's offset and Producer in the chat.CHAT_MODEL_PROVIDERor by which key is set. The app reads no key itself, and a failed call keeps only the error's class.README.mdlists where each API feature is used, and which ones it doesn't use yet.Why?
It shows how the API reads in a real app, not only in examples. The app also found a bug in the Workflow
_nowaitwrites, which #377 fixes.The app uses today's names (
publish,subscribe,BufferedPublisher). It changes with the naming rename after the API review. Live Claude and OpenAI calls are untested, since no working key was available. The Claude call was checked against a local stand-in for the Messages API. The fix for an end signal during continue-as-new has no test, since the race can't be timed reliably.Part of the Streams review series.
Checklist
poe lint, and the Streams suite with the app tests on both backends with Redis.