refactor: name streaming response finalizer

Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/f62076ef-558d-49e8-8fe2-f38d527c9639

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-19 05:51:10 +00:00
committed by GitHub
Unverified
parent b07f055430
commit e1d4f1e11e
@@ -615,6 +615,12 @@ class RawOpenAIChatClient( # type: ignore[misc]
seen_reasoning_delta_item_ids: set[str] = set()
validated_options: dict[str, Any] | None = None
def _finalize_streamed_response(updates: Sequence[ChatResponseUpdate]) -> ChatResponse[Any]:
return self._finalize_response_updates(
updates,
response_format=validated_options.get("response_format") if validated_options else None,
)
async def _stream() -> AsyncIterable[ChatResponseUpdate]:
nonlocal validated_options
if continuation_token is not None:
@@ -681,13 +687,7 @@ class RawOpenAIChatClient( # type: ignore[misc]
except Exception as ex:
self._handle_request_error(ex)
return ResponseStream(
_stream(),
finalizer=lambda updates: self._finalize_response_updates(
updates,
response_format=validated_options.get("response_format") if validated_options else None,
),
)
return ResponseStream(_stream(), finalizer=_finalize_streamed_response)
# Non-streaming
async def _get_response() -> ChatResponse: