-
Notifications
You must be signed in to change notification settings - Fork 2.4k
OpenAI responses streaming #5837
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
Conversation
…nses-streaming * 'main' of github.com:block/goose: fix: adjust strange spacing in agent.rs (#5877)
…nses-streaming * 'main' of github.com:block/goose: Feat/automatic update installation (#5345) fix: Added "Merged consecutive assistant messages" to the acceptable issues for moim injection check (#5933) fix: anthropic provider model fetching (#5932) [MCP-UI] add CSP for images to proxy HTML (#5931) fix: correct typo in blog post (AIMDOEL -> AIMODEL) (#5902) feat: @goose in terminal (native terminal support) (#5887) docs: adding AI-friendly features (#5918) Blog/advent of ai announcement (#5917) Extension selector behind ALPHA flag (#5892) blog: typo fixes (#5896) blog: fixing img url (#5895) blog: MCPs for Developers (#5884) docs: Extension Manager MCP (#5883) Update cleanup marker logic for Fedora users. (#5868) Improve AWS credential loading and configuration handling in BedrockProvider (#5699)
|
Still figuring out how to get usage data for the streaming, but otherwise this is working pretty well. Interestingly usage comes through when there's a tool call. |
|
@michaelneale This seems to be working pretty well for me. Want to take it for test drive? |
…nses-streaming * 'main' of github.com:block/goose: blog: MCP Sampling (#5987) Update Anthropic and Google Gemini models to latest API versions (#5980) docs: chat recall tutorial (#5975) fix: `final assistant content cannot end with trailing whitespace` error from Anthropic (#5967) 5527 multiple file popups (#5905) Groq configure fix (#5833) added sidebar contextual information for firefox (#5433) docs: council of mine MCP (#5979) docs: nano banana extension (#5977) fix: remove prompt change, read model from config (#5976) Enable recipe deeplink parameters for pre-population (#5757) chore: upgrade npm packages (#5951) feat: ActionRequired (#5897) feat(acp): support loading sessions in acp (#5942) docs: add videos to multi-model page (#5938)
…nses-streaming * 'main' of github.com:block/goose: Onboarding detect provider from api key (#5955) Fix PATH on Windows for extensions (#6000) recipe(datahub): Add a recipe for searching & understanding data in DataHub (#5859) fix params not being substituted in activities (#5992)
…nses-streaming * 'main' of github.com:block/goose: blog: How to stop your ai agent from making unwanted code changes (#6055) Fix typo in prompt (#6007) Docs for new terminal integration feature (#6042) fix: linux goosed crashing libssl error (#6051) chore(release): release version 1.16.0 (minor) (#5985) fix: metrics on posthog (#6024) gov: new LF Projects LLC section (#6027) Cleanup: Remove Recipe Key Flow (#6015) chore(deps): bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /documentation (#5963) remove problematic corrupted woff font (#6006) Added search bar / filtering for recipes (#6019) Hide recipe icon in empty chat (#6022) docs: provider and model config (#6008) Show modal selector after configuring a provider (#6005) docs: additional mcp sampling resources (#6020) Flutter PR Code Review (#6011) feat(mcp): elicitation support (#5965)
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.
Pull request overview
This PR implements support for OpenAI's new Responses API format with streaming capabilities, enabling Goose to work with newer OpenAI models (gpt-5-codex and gpt-5.1-codex) that use a different API format than the traditional Chat Completions endpoint.
Key changes:
- Added a new format handler for the OpenAI Responses API with full streaming support
- Updated the OpenAI provider to route requests based on model name, using the Responses API for gpt-5-codex models
- Implemented proper token counting and usage tracking for the new format
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/goose/src/providers/openai.rs | Added model detection logic to route gpt-5-codex models to the Responses API, with separate handling for both complete and stream methods |
| crates/goose/src/providers/formats/openai_responses.rs | New format handler implementing full Responses API support including request creation, response parsing, streaming, and usage tracking |
| crates/goose/src/providers/formats/mod.rs | Registered the new openai_responses module |
michaelneale
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 one @katzdave tested it with gpt-5.2 and codex 5.1 and worked nicely! awesome
|
@michaelneale Hi guys , I am doing a project where i need deep research, what is the outlook for this landing in the next release ? |
DOsinga
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.
let's remove some of the obvious comments, but other than that, great
one concern I have is how we handle base_path. for these models we just ignore it. but if the user overrides it through a custom provider, we probably shouldn't. not sure what the best way of handling this is, tbh. in some ideal world, we would never have set the base_path to v1/ instead of the whole path and then we could append
so one way could be to detect whether the base_path has been overwritten instead of giving it a default and then when we need it, see if ends on /completions/reply or what have you and replace that with what we want and if it doesn't, just use it as is?
| &response_str | ||
| }; | ||
|
|
||
| // Skip [DONE] marker |
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.
I can see that
| } | ||
|
|
||
| ResponsesStreamEvent::ResponseCompleted { response, .. } => { | ||
| // Always set final usage (use default if not provided) |
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.
same
| } | ||
|
|
||
| fn uses_responses_api(model_name: &str) -> bool { | ||
| model_name.starts_with("gpt-5-codex") || model_name.starts_with("gpt-5.1-codex") |
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.
after your model normalization this might work, but right now, does this cover like databricks? also, people might change the base_path to v1/responses for models that support both
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.
I don't actually see the codex models inside of databricks. I gave goose-gpt-5.2 a try and it failed to configure very cryptically with:
Request failed: Bad request (400): {"external_model_provider":"databricks-model-serving","external_model_error":{"error_code":"BAD_REQUEST","message":"BAD_REQUEST: Invalid role in the chat message. The role must be one of: "system", "user", "assistant", "tool", "function"."}}
Saw there was another thread about that.
Good callout on the base path. We probably need to parse that + also be aware about which models support both.
I did a quick test of the openrouter endpoint I'm using for canonical models and seems like you can infer which models support completions/responses based on the supported_parameters part of the payload.
So I think we follow up with adding something to canonical model around supported_formats.
For the openai provider, if the model supports both, trust the user on the base path. If the model only supports responses, continue to modify the base path suffix for them.
…oose into dkatz/openai-responses-streaming * 'dkatz/openai-responses-streaming' of github.com:block/goose: Rm stray leave errors in the context blog: How to stop your ai agent from making unwanted code changes (#6055) Fix typo in prompt (#6007) Docs for new terminal integration feature (#6042) fix: linux goosed crashing libssl error (#6051) chore(release): release version 1.16.0 (minor) (#5985) fix: metrics on posthog (#6024) gov: new LF Projects LLC section (#6027) Cleanup: Remove Recipe Key Flow (#6015) chore(deps): bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /documentation (#5963) remove problematic corrupted woff font (#6006) Added search bar / filtering for recipes (#6019) Hide recipe icon in empty chat (#6022) docs: provider and model config (#6008) Show modal selector after configuring a provider (#6005) docs: additional mcp sampling resources (#6020) Flutter PR Code Review (#6011) feat(mcp): elicitation support (#5965)
…nses-streaming * 'main' of github.com:block/goose: Fix community page mobile responsiveness and horizontal overflow (#6082) Tool reply meta (#6074) chore: avoid accidentally using native tls again (#6086) Update vars to be capitalised to be in line with other variables in config file (#6085) docs: restructure recipe reference (#5972) docs: configure custom providers (#6044) docs: Community All-Stars Spotlight November 2025, CodeTV Hackathon edition (#6070) fix: include file attachments in queued messages (#5961) fix(ui): prevent incorrect provider type suffix in update dialog #5908 (#5909) docs: mcp elicitation (#6060)
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.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
* main: fix: Make datetime info message more explicit to prevent LLM confusion about current year (#6101) refactor: unify subagent and subrecipe tools into single tool (#5893) goose repo is too big for the issue solver workflow worker (#6099) fix: use system not developer role in db (#6098) Add /goose issue solver github workflow (#6068) OpenAI responses streaming (#5837) Canonical models for Providers (#5694) feat: add Inception provider for Mercury models (#6029) fix old sessions with tool results not loading (#6094) Fix community page mobile responsiveness and horizontal overflow (#6082)
* 'main' of github.com:block/goose: (22 commits) Disallow subagents with no extensions (#5825) chore(deps): bump js-yaml in /documentation (#6093) feat: external goosed server (#5978) fix: Make datetime info message more explicit to prevent LLM confusion about current year (#6101) refactor: unify subagent and subrecipe tools into single tool (#5893) goose repo is too big for the issue solver workflow worker (#6099) fix: use system not developer role in db (#6098) Add /goose issue solver github workflow (#6068) OpenAI responses streaming (#5837) Canonical models for Providers (#5694) feat: add Inception provider for Mercury models (#6029) fix old sessions with tool results not loading (#6094) Fix community page mobile responsiveness and horizontal overflow (#6082) Tool reply meta (#6074) chore: avoid accidentally using native tls again (#6086) Update vars to be capitalised to be in line with other variables in config file (#6085) docs: restructure recipe reference (#5972) docs: configure custom providers (#6044) docs: Community All-Stars Spotlight November 2025, CodeTV Hackathon edition (#6070) fix: include file attachments in queued messages (#5961) ... # Conflicts: # crates/goose-server/src/routes/agent.rs # crates/goose/src/agents/extension_manager.rs # ui/desktop/src/api/sdk.gen.ts
Co-authored-by: Michael Neale <[email protected]> Co-authored-by: Copilot <[email protected]>
…sions * 'main' of github.com:block/goose: (22 commits) Disallow subagents with no extensions (#5825) chore(deps): bump js-yaml in /documentation (#6093) feat: external goosed server (#5978) fix: Make datetime info message more explicit to prevent LLM confusion about current year (#6101) refactor: unify subagent and subrecipe tools into single tool (#5893) goose repo is too big for the issue solver workflow worker (#6099) fix: use system not developer role in db (#6098) Add /goose issue solver github workflow (#6068) OpenAI responses streaming (#5837) Canonical models for Providers (#5694) feat: add Inception provider for Mercury models (#6029) fix old sessions with tool results not loading (#6094) Fix community page mobile responsiveness and horizontal overflow (#6082) Tool reply meta (#6074) chore: avoid accidentally using native tls again (#6086) Update vars to be capitalised to be in line with other variables in config file (#6085) docs: restructure recipe reference (#5972) docs: configure custom providers (#6044) docs: Community All-Stars Spotlight November 2025, CodeTV Hackathon edition (#6070) fix: include file attachments in queued messages (#5961) ... # Conflicts: # crates/goose-server/src/routes/agent.rs # crates/goose/src/agents/extension_manager.rs # ui/desktop/src/api/sdk.gen.ts
This PR implements support for OpenAI's Responses API with streaming