Repository navigation
Document AI chat streaming with PowerSync - #711
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
|
Reviewed the added AI Chat Streaming guide against the writing standards and cross-checked its technical claims (write/claim-ID conditions, 100 ms flush interval, 150 char/s and 1 s smoothing caps, 100 char/s worker pacing, the 1,600-character/9-write/160-write example, billing and compaction claims, and all internal links/anchors) against powersync-ja/powersync-js#1152 and the existing docs. No issues found; the changes pass review. |
|
Reviewed the diff and verified claims against the merged demo (powersync-ja/powersync-js#1152). Left 3 inline comments: a correctness gap in the retry/claim write condition, and two stale TODOs now that the demo PR has merged. Note: Vale and |
cahofmeyr
left a comment
There was a problem hiding this comment.
I find the way that the introductory section is written confusing: The title of the page talks about AI Chat Streaming: "Stream AI chat replies to clients while the model generates them" but the content after that starts talking about the fact that chats can be treated as ordinary rows in the database, so they are durable, i.e. when you reload, they're still there. So that is about more than just streaming while generating. I suggest changing the title of the page to something like: "AI Chat Use Cases" or something similar, and then clearly explain the different concepts involved and the benefits that PowerSync provides in the different areas:
- Chats can be stored as rows in the database, providing potential benefits like durability, cross-device, multi-user collaboration, etc. (these are just rough notes – need to improve the wording and explanation)
- If you want to incrementally stream responses to clients while they're generating, here are the techniques that we have tested and what PowerSync gives you: ... . This builds on the idea of point 1, i.e. you could do point 1 without doing point 2 at all.
The page also has significant AI smell which makes it not read well. I would rewrite it to remove AI smells.
I do agree that it didn't read well, apologies for that. I've rewritten it and made it more like a guide instead. I renamed the page to "AI Chat" and the content is split in two now.
I also cut out a lot of the demo specific detail. |
Adds a guide on streaming AI chat replies with PowerSync. It covers the two ways I can think of to do it, writing the reply to the database as it generates or streaming it over SSE and saving it once, with the trade-offs of each. It also covers smoothing the text on the client.
The guide links to the new AI chat demo (powersync-ja/powersync-js#1152), which I've also added to the Examples page. Those links won't work until the demo PR is merged.
AI Disclosure
I had Claude Opus 5.5 generate the bulk of the content based off the demo, I manually reviewed and edited it.