Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
||
| ### Handling append failures <a id="append-failures"/> | ||
|
|
||
| When appending without awaiting, it is possible for an intermediate append to fail while subsequent appends succeed. This creates a gap in the streamed response. For example, if a rate limit is exceeded, a single append may be rejected while the following tokens continue to be accepted. |
There was a problem hiding this comment.
| When appending without awaiting, it is possible for an intermediate append to fail while subsequent appends succeed. This creates a gap in the streamed response. For example, if a rate limit is exceeded, a single append may be rejected while the following tokens continue to be accepted. | |
| The examples above append successive tokens to a response message by pipelining the append operations - that is, the agent will publish an append operation without waiting for prior operations to complete. This is necessary in order to avoid the append rate being capped by the round-trip time from the agent to the Ably endpoint. However, this means that the agent does not await the outcome of each append operation, and that can result in the agent continuing to submit append operations after an earlier operation has failed. For example, if a rate limit is exceeded, a single append may be rejected while the following tokens continue to be accepted. | |
| The agent needs to obtain the outcome of each append operation, and take corrective action in the event that any operation failed for some reason. A simple but effective way to do this is simply to ensure that, if streaming of a response fails for any reason, then the message is updated with the final complete response text once it is available. This means that although the streaming experience is disrupted in the case of failure, there is no consistency problem with the final result once the response completes. |
|
|
||
| When appending without awaiting, it is possible for an intermediate append to fail while subsequent appends succeed. This creates a gap in the streamed response. For example, if a rate limit is exceeded, a single append may be rejected while the following tokens continue to be accepted. | ||
|
|
||
| To detect failures, keep a reference to each append operation and check for rejections after the stream completes: |
There was a problem hiding this comment.
| To detect failures, keep a reference to each append operation and check for rejections after the stream completes: | |
| To detect append failures, keep a reference to each append operation and check for rejections after the stream completes: |
|
|
||
| ### Handling publish failures <a id="publish-failures"/> | ||
|
|
||
| When publishing without awaiting, it is possible for an intermediate publish to fail while subsequent publishes succeed. This creates a gap in the streamed response. For example, if a rate limit is exceeded, a single token may be rejected while the following tokens continue to be accepted. |
There was a problem hiding this comment.
I suggest updating this text in a similar way to proposed above
20df5cb to
01ab0f8
Compare
d347b2f to
eb190d3
Compare
GregHolmes
left a comment
There was a problem hiding this comment.
Should we also be adding the other languages on the page for these code snippets? Currently your changes only support JavaScript, but we also have Java and Python. If these aren't relevant for this new section. We should add an If around the entire block of text and code so it only shows for JS.
I've also added a few comments. Thank you.
| ``` | ||
| </Code> | ||
|
|
||
| <Aside data-type="note"> |
There was a problem hiding this comment.
Are we sure we want 2 Asides immediately after eachother? Feels like it breaks the flow of the page.
If we are adding Python and Java to the other AIT examples then I think it's also relevant here. I'm not confident to write to on either, so maybe that would need someone else to do it. Or I can try to have Claude have a go at it, at which point I might be able to review simple snippets and check for consistency with other examples. What do you think we should do here @GregHolmes ? |
If you get Claude to add them, then can always ask @ttypic to review those code snippets. |
Pushed 165014d with the Python and Java examples. |
|
@GregHolmes since @paddybyers has approved it, do you think we can merge it? Or would you rather still have someone validate the Java and Python examples? |
165014d to
01996c1
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
01996c1 to
a3d5a18
Compare
Description
Context: https://ably.atlassian.net/browse/AIT-238
Overall the questions I think need to be answers in these docs sections are: