Skip to content

fix(providers/openai): emit source parts for Responses API streaming - #187

Merged
andreynering merged 1 commit into
charmbracelet:mainfrom
coder:fix/openai-responses-api-source-annotations
Mar 25, 2026
Merged

andreynering merged 1 commit into
charmbracelet:mainfrom
coder:fix/openai-responses-api-source-annotations

Conversation

@kylecarbs

Copy link
Copy Markdown
Contributor

The Responses API streaming path was missing a handler for "response.output_text.annotation.added" events. This meant that url_citation and file_citation annotations—which carry source URLs and titles for web search results—were silently dropped during streaming.

The non-streaming Generate path and the Chat Completions API streaming path both handled annotations correctly; only the Responses API Stream path was affected.

Add a case for "response.output_text.annotation.added" that parses the annotation map and yields StreamPartTypeSource parts for url_citation and file_citation types, matching the behavior of the existing Generate path and the Anthropic provider.

Update TestResponsesStream_WebSearchResponse to include annotation.added events in the mock stream and assert that source parts are emitted with the correct URL, title, and type.

  • I have read CONTRIBUTING.md.
  • I have created a discussion that was approved by a maintainer (for new features).

…annotations

The Responses API streaming path was missing a handler for
"response.output_text.annotation.added" events. This meant that
url_citation and file_citation annotations—which carry source
URLs and titles for web search results—were silently dropped
during streaming.

The non-streaming Generate path and the Chat Completions API
streaming path both handled annotations correctly; only the
Responses API Stream path was affected.

Add a case for "response.output_text.annotation.added" that
parses the annotation map and yields StreamPartTypeSource parts
for url_citation and file_citation types, matching the behavior
of the existing Generate path and the Anthropic provider.

Update TestResponsesStream_WebSearchResponse to include
annotation.added events in the mock stream and assert that
source parts are emitted with the correct URL, title, and type.

@andreynering andreynering left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@andreynering
andreynering merged commit 4620329 into charmbracelet:main Mar 25, 2026
9 checks passed
taigrr pushed a commit to taigrr/fantasy that referenced this pull request Apr 20, 2026
…annotations (charmbracelet#187)

The Responses API streaming path was missing a handler for
"response.output_text.annotation.added" events. This meant that
url_citation and file_citation annotations—which carry source
URLs and titles for web search results—were silently dropped
during streaming.

The non-streaming Generate path and the Chat Completions API
streaming path both handled annotations correctly; only the
Responses API Stream path was affected.

Add a case for "response.output_text.annotation.added" that
parses the annotation map and yields StreamPartTypeSource parts
for url_citation and file_citation types, matching the behavior
of the existing Generate path and the Anthropic provider.

Update TestResponsesStream_WebSearchResponse to include
annotation.added events in the mock stream and assert that
source parts are emitted with the correct URL, title, and type.
taigrr pushed a commit to taigrr/fantasy that referenced this pull request Apr 25, 2026
…annotations (charmbracelet#187)

The Responses API streaming path was missing a handler for
"response.output_text.annotation.added" events. This meant that
url_citation and file_citation annotations—which carry source
URLs and titles for web search results—were silently dropped
during streaming.

The non-streaming Generate path and the Chat Completions API
streaming path both handled annotations correctly; only the
Responses API Stream path was affected.

Add a case for "response.output_text.annotation.added" that
parses the annotation map and yields StreamPartTypeSource parts
for url_citation and file_citation types, matching the behavior
of the existing Generate path and the Anthropic provider.

Update TestResponsesStream_WebSearchResponse to include
annotation.added events in the mock stream and assert that
source parts are emitted with the correct URL, title, and type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants