-
Notifications
You must be signed in to change notification settings - Fork 46
[AIT-282] Anthropic message per response guide #3099
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
[AIT-282] Anthropic message per response guide #3099
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 WalkthroughA new documentation guide for streaming Anthropic responses using Ably's message-per-response pattern was added, along with a corresponding navigation entry. The guide covers prerequisites, implementation details, code examples, and operational considerations. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/pages/docs/guides/ai-transport/anthropic-message-per-response.mdx`:
- Around line 98-110: The race occurs because processEvent is async but events
are iterated without awaiting it, so content_block_delta can run before
message_start finishes and msgSerial is still null; fix by awaiting
processEvent(event) inside the for-await loop in streamAnthropicResponse (i.e.,
change "for await (const event of stream) { processEvent(event); }" to "for
await (const event of stream) { await processEvent(event); }") and apply the
same change to the other streaming handler referenced (the block around lines
199-239) so message_start handling always completes before deltas are processed.
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
src/data/nav/aitransport.tssrc/pages/docs/guides/ai-transport/anthropic-message-per-response.mdx
🧰 Additional context used
🪛 LanguageTool
src/pages/docs/guides/ai-transport/anthropic-message-per-response.mdx
[style] ~178-~178: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym.
Context: ...ly Realtime client const realtime = new Ably.Realtime({ key: '{{API_KEY}}' }); // C...
(ADVERB_REPETITION_PREMIUM)
[style] ~275-~275: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym.
Context: ...ly Realtime client const realtime = new Ably.Realtime({ key: '{{API_KEY}}' }); // G...
(ADVERB_REPETITION_PREMIUM)
🔇 Additional comments (3)
src/data/nav/aitransport.ts (1)
92-95: Nav entry addition looks good (consistent naming + correct link).src/pages/docs/guides/ai-transport/anthropic-message-per-response.mdx (2)
99-105: No action required — the code uses Anthropic's currently recommended model identifier.The example correctly uses
claude-sonnet-4-5, which is Anthropic's primary recommended alias for Claude Sonnet in documentation and development. Anthropic provides convenience aliases (likesonnetfor the latest snapshot), but explicitly recommends the versioned alias for documentation clarity. Using the specific, recommended identifier is the appropriate practice for guides.
173-183: All Ably JavaScript SDK v2 APIs used in the code examples are accurate. Verification confirms:
channel.publish()returnsPromise<PublishResult>with aserialsarray, soresult.serials[0]correctly captures the message serial ✓channel.appendMessage()exists onRealtimeChanneland accepts{ serial, data }as shown ✓- Subscribers receive
message.actionas strings'message.create','message.append', and'message.update'as handled in the code ✓await channel.subscribe()is valid and returnsPromise<null | ChannelStateChange>✓The examples in lines 173–231 and 271–307 will work as written with the Ably JS SDK v2.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
mschristensen
left a comment
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.
Nice, LGTM - one comment from code rabbit we should address here and on the openai message per response guide, but approving ahead of that change
Details the message-per-response pattern using Ably `appendMessage` for Anthropic SDK.
3ba63a2 to
0be2d09
Compare
Description
Following the existing structure for AIT streaming guides, add a message-per-response guide for Anthropic SDK.
Review App
Checklist
Summary by CodeRabbit
Documentation
Navigation
✏️ Tip: You can customize this high-level summary in your review settings.