Update framework documentation#184
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
0b7db70 to
b51190a
Compare
msullivan
left a comment
There was a problem hiding this comment.
LGTM mostly!
I didn't look at the SKILLs really. Let me know if you think I should
| This adapter provides integration with the UI part of the sister AI SDK | ||
| in TypeScript. | ||
|
|
||
| ## Parse UI messages | ||
| AI SDK UI provides `useChat`, which handles streaming complexity on the | ||
| client side, such as collecting message chunks and optimistically updating | ||
| the UI when the user submits a new message. | ||
|
|
||
| Accept `UIMessage` values from an AI SDK UI client, then convert them to | ||
| runtime messages: | ||
| The AI SDK UI's data model is significantly different from the AI SDK for | ||
| Python's, which is why you need to convert events and messages back and forth | ||
| using the adapter. |
There was a problem hiding this comment.
Probably we want to put some links in here
|
|
||
| @app.post("/chat") | ||
| async def chat(request: ChatRequest): | ||
| messages, approvals = ai.agents.ui.ai_sdk.to_messages(request.messages) |
There was a problem hiding this comment.
Do we want to mention the new tools argument?
| behavior. | ||
|
|
||
| ## When to customize the loop | ||
| ## Explore the standard loop shape |
There was a problem hiding this comment.
I wonder if we should mention somewhere explicitly that loop runs in a separate task that communicates via a queue and so doesn't run in lock-step with the calling code?
| `ai.stream` accepts a list of `ai.Tool`, however, it does not have any | ||
| framework-side tool execution machinery. Use an agent when you want the SDK to |
There was a problem hiding this comment.
I think we should stick with saying that it does not execute function tools locally, or some such. I think "does not have any framework-side tool execution machinery" is unduly complicated
| yield part | ||
| ``` | ||
|
|
||
| Return `UI_MESSAGE_STREAM_HEADERS` on streamed AI SDK UI responses. |
| Keep messages as the durable boundary. Streams, tool runners, hook futures, and | ||
| provider clients are runtime state. |
There was a problem hiding this comment.
This is too AI-terse to be helpful
| stream.context | ||
| stream.messages | ||
| stream.output | ||
| ``` |
There was a problem hiding this comment.
Do we want to explain these some more?
| - `HookSuspension` | ||
| - `HookResolution` | ||
|
|
||
| Stream event unions: |
| `yield_from`. | ||
| - `HookEvent`: Carries an internal hook message and `HookPart`. | ||
|
|
||
| Agent event unions: |
|
|
||
| async def main() -> None: | ||
| model = ai.get_model("gateway:anthropic/claude-sonnet-4") | ||
| model = ai.get_model("anthropic/claude-sonnet-4") |
There was a problem hiding this comment.
Should we update all the claude-sonnet-4's to 4.6 or 5?
66e5f3c to
48c25e2
Compare
Restructures and refactors framework documentation, both
docsandskills.