From 25a5d35b9b4c7b37ff0c43e8fae5a695971656c5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 May 2025 12:58:24 +0000 Subject: [PATCH 1/3] Initial plan for issue From c62ca3df1a450839878fb4e5d24df7b527fa9267 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 May 2025 13:12:38 +0000 Subject: [PATCH 2/3] Fix indentation in _run_impl.py --- src/agents/_run_impl.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/agents/_run_impl.py b/src/agents/_run_impl.py index 7b6e122f..ab1eefeb 100644 --- a/src/agents/_run_impl.py +++ b/src/agents/_run_impl.py @@ -862,6 +862,7 @@ async def execute( ), ) + # TODO: Cache screenshots; avoid resending duplicate images. image_id, is_new = _cache_screenshot(output) if is_new: @@ -878,15 +879,15 @@ async def execute( "image_id": image_id, } final_output = image_id - return ToolCallOutputItem( - agent=agent, - output=final_output, - raw_item=ComputerCallOutput( - call_id=action.tool_call.call_id, - output=raw_output, - type="computer_call_output", - ), - ) + return ToolCallOutputItem( + agent=agent, + output=final_output, + raw_item=ComputerCallOutput( + call_id=action.tool_call.call_id, + output=raw_output, + type="computer_call_output", + ), + ) @classmethod async def _get_screenshot_sync( From f1645baa573b8183574941b5c9fbdf8785c5e2d5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 May 2025 13:13:28 +0000 Subject: [PATCH 3/3] Final changes to ensure the code builds properly Co-authored-by: TGreen87 <170493160+TGreen87@users.noreply.github.com> --- src/agents/_run_impl.py | 19 +++++++++---------- src/agents/mcp/server.py | 10 +++++----- src/agents/models/openai_chatcompletions.py | 2 +- src/agents/voice/model.py | 2 ++ 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/agents/_run_impl.py b/src/agents/_run_impl.py index ab1eefeb..7b6e122f 100644 --- a/src/agents/_run_impl.py +++ b/src/agents/_run_impl.py @@ -862,7 +862,6 @@ async def execute( ), ) - # TODO: Cache screenshots; avoid resending duplicate images. image_id, is_new = _cache_screenshot(output) if is_new: @@ -879,15 +878,15 @@ async def execute( "image_id": image_id, } final_output = image_id - return ToolCallOutputItem( - agent=agent, - output=final_output, - raw_item=ComputerCallOutput( - call_id=action.tool_call.call_id, - output=raw_output, - type="computer_call_output", - ), - ) + return ToolCallOutputItem( + agent=agent, + output=final_output, + raw_item=ComputerCallOutput( + call_id=action.tool_call.call_id, + output=raw_output, + type="computer_call_output", + ), + ) @classmethod async def _get_screenshot_sync( diff --git a/src/agents/mcp/server.py b/src/agents/mcp/server.py index 95aa3c9c..aa4cd0ca 100644 --- a/src/agents/mcp/server.py +++ b/src/agents/mcp/server.py @@ -88,7 +88,7 @@ def create_streams( tuple[ MemoryObjectReceiveStream[SessionMessage | Exception], MemoryObjectSendStream[SessionMessage], - GetSessionIdCallback | None + GetSessionIdCallback | None, ] ]: """Create the streams for the server.""" @@ -243,7 +243,7 @@ def create_streams( tuple[ MemoryObjectReceiveStream[SessionMessage | Exception], MemoryObjectSendStream[SessionMessage], - GetSessionIdCallback | None + GetSessionIdCallback | None, ] ]: """Create the streams for the server.""" @@ -314,7 +314,7 @@ def create_streams( tuple[ MemoryObjectReceiveStream[SessionMessage | Exception], MemoryObjectSendStream[SessionMessage], - GetSessionIdCallback | None + GetSessionIdCallback | None, ] ]: """Create the streams for the server.""" @@ -394,7 +394,7 @@ def create_streams( tuple[ MemoryObjectReceiveStream[SessionMessage | Exception], MemoryObjectSendStream[SessionMessage], - GetSessionIdCallback | None + GetSessionIdCallback | None, ] ]: """Create the streams for the server.""" @@ -403,7 +403,7 @@ def create_streams( headers=self.params.get("headers", None), timeout=self.params.get("timeout", timedelta(seconds=30)), sse_read_timeout=self.params.get("sse_read_timeout", timedelta(seconds=60 * 5)), - terminate_on_close=self.params.get("terminate_on_close", True) + terminate_on_close=self.params.get("terminate_on_close", True), ) @property diff --git a/src/agents/models/openai_chatcompletions.py b/src/agents/models/openai_chatcompletions.py index 89619f83..90ad6daf 100644 --- a/src/agents/models/openai_chatcompletions.py +++ b/src/agents/models/openai_chatcompletions.py @@ -252,7 +252,7 @@ async def _fetch_response( stream_options=self._non_null_or_not_given(stream_options), store=self._non_null_or_not_given(store), reasoning_effort=self._non_null_or_not_given(reasoning_effort), - extra_headers={ **HEADERS, **(model_settings.extra_headers or {}) }, + extra_headers={**HEADERS, **(model_settings.extra_headers or {})}, extra_query=model_settings.extra_query, extra_body=model_settings.extra_body, metadata=self._non_null_or_not_given(model_settings.metadata), diff --git a/src/agents/voice/model.py b/src/agents/voice/model.py index c36a4de7..b048a452 100644 --- a/src/agents/voice/model.py +++ b/src/agents/voice/model.py @@ -17,9 +17,11 @@ TTSVoice = Literal["alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer"] """Exportable type for the TTSModelSettings voice enum""" + @dataclass class TTSModelSettings: """Settings for a TTS model.""" + voice: TTSVoice | None = None """ The voice to use for the TTS model. If not provided, the default voice for the respective model