Repository navigation
Conversation
This branch has not been deployed
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.
Summary
agents.chat_stream(...), which takes the same arguments aschat()but streams Server-Sent Events while the agent works. It sendsstream: truewithAccept: text/event-stream.AgentChatProgress: status updates, e.g. "Searching knowledge graph...".AgentChatResponseChunk: fragments of the reply, to be concatenated as they arrive.AgentChatResponse: the final, complete response (cursor, messages, action calls). Always the last event.UnknownAgentChatStreamEvent: for event types the SDK doesn't know yet.AgentChatStreamEvent. The sync client gets a regular iterator through the codegen.chat()andchat_stream()now share a small helper that builds the request body.A separate method is used instead of a
streamflag onchat(), since a function that returns a response or an iterator depending on a flag is awkward to type, especially for the generated sync client.The codegen adds a
# type: ignore [misc]to generated iterator methods. It isn't needed here (mypy flags it as unused), so it is removed by hand, the same as forgeospatial.stream_features. The codegen's verify step ignores comments, so this stays in sync.Testing
[DONE]sentinel, multi-linedata:fields, comment lines, and a stream without a trailing blank line.AgentChatResponsewith a cursor, and the joined chunks matched the final text.