Skip to content

Fix spacing inconsistencies and adhere to style guidelines #612

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/agents/models/openai_chatcompletions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 2 additions & 0 deletions src/agents/voice/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions tests/test_extra_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ class DummyResponses:
async def create(self, **kwargs):
nonlocal called_kwargs
called_kwargs = kwargs

class DummyResponse:
id = "dummy"
output = []
usage = type(
"Usage", (), {"input_tokens": 0, "output_tokens": 0, "total_tokens": 0}
)()

return DummyResponse()

class DummyClient:
def __init__(self):
self.responses = DummyResponses()



model = OpenAIResponsesModel(model="gpt-4", openai_client=DummyClient()) # type: ignore
model = OpenAIResponsesModel(model="gpt-4", openai_client=DummyClient()) # type: ignore
extra_headers = {"X-Test-Header": "test-value"}
await model.get_response(
system_instructions=None,
Expand All @@ -47,7 +47,6 @@ def __init__(self):
assert called_kwargs["extra_headers"]["X-Test-Header"] == "test-value"



@pytest.mark.allow_call_model_methods
@pytest.mark.asyncio
async def test_extra_headers_passed_to_openai_client():
Expand Down Expand Up @@ -76,7 +75,7 @@ def __init__(self):
self.chat = type("_Chat", (), {"completions": DummyCompletions()})()
self.base_url = "https://api.openai.com"

model = OpenAIChatCompletionsModel(model="gpt-4", openai_client=DummyClient()) # type: ignore
model = OpenAIChatCompletionsModel(model="gpt-4", openai_client=DummyClient()) # type: ignore
extra_headers = {"X-Test-Header": "test-value"}
await model.get_response(
system_instructions=None,
Expand Down