fix: Change extra_headers to additional_headers (#17950)
This commit is contained in:
parent
7b2f33b9b4
commit
9f88d61d10
@ -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,
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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",
|
||||
},
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user