fix: Change extra_headers to additional_headers (#17950)

This commit is contained in:
Lucas Sugi 2025-12-18 00:27:20 -03:00 committed by GitHub
parent 7b2f33b9b4
commit 9f88d61d10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 8 deletions

View File

@ -94,7 +94,7 @@ class AzureOpenAIRealtime(AzureChatCompletion):
ssl_context = get_shared_realtime_ssl_context()
async with websockets.connect( # type: ignore
url,
extra_headers={
additional_headers={
"api-key": api_key, # type: ignore
},
max_size=REALTIME_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES,

View File

@ -3646,7 +3646,7 @@ class BaseLLMHTTPHandler:
ssl_context = get_shared_realtime_ssl_context()
async with websockets.connect( # type: ignore
url,
extra_headers=headers,
additional_headers=headers,
max_size=REALTIME_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES,
ssl=ssl_context,
) as backend_ws:

View File

@ -59,7 +59,7 @@ class OpenAIRealtime(OpenAIChatCompletion):
ssl_context = get_shared_realtime_ssl_context()
async with websockets.connect( # type: ignore
url,
extra_headers={
additional_headers={
"Authorization": f"Bearer {api_key}", # type: ignore
"OpenAI-Beta": "realtime=v1",
},

View File

@ -196,7 +196,7 @@ async def _realtime_health_check(
ssl_context = get_shared_realtime_ssl_context()
async with websockets.connect( # type: ignore
url,
extra_headers={
additional_headers={
"api-key": api_key, # type: ignore
},
max_size=REALTIME_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES,

View File

@ -195,10 +195,10 @@ async def test_async_realtime_url_contains_model():
# Verify proper headers were set
called_kwargs = mock_ws_connect.call_args[1]
assert "extra_headers" in called_kwargs
extra_headers = called_kwargs["extra_headers"]
assert extra_headers["Authorization"] == f"Bearer {api_key}"
assert extra_headers["OpenAI-Beta"] == "realtime=v1"
assert "additional_headers" in called_kwargs
additional_headers = called_kwargs["additional_headers"]
assert additional_headers["Authorization"] == f"Bearer {api_key}"
assert additional_headers["OpenAI-Beta"] == "realtime=v1"
assert called_kwargs["ssl"] is shared_context
mock_realtime_streaming.assert_called_once()