mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
add openai_responses_native_websocket opt-in flag
This commit is contained in:
parent
7dd09daa98
commit
4dacde3b0a
2 changed files with 13 additions and 2 deletions
|
|
@ -424,6 +424,11 @@ disable_aiohttp_trust_env: bool = (
|
|||
)
|
||||
force_ipv4: bool = False # when True, litellm will force ipv4 for all LLM requests. Some users have seen httpx ConnectionError when using ipv6.
|
||||
network_mock: bool = False # When True, use mock transport — no real network calls
|
||||
# When True, proxy Responses API WebSocket sessions directly to
|
||||
# wss://api.openai.com/v1/responses instead of the managed HTTP-streaming path.
|
||||
# Only enable this if your OpenAI deployment / reverse proxy reliably responds to
|
||||
# response.create events over the native WebSocket protocol.
|
||||
openai_responses_native_websocket: bool = False
|
||||
|
||||
####### STOP SEQUENCE LIMIT #######
|
||||
disable_stop_sequence_limit: bool = False # when True, stop sequence limit is disabled
|
||||
|
|
|
|||
|
|
@ -348,15 +348,21 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig):
|
|||
return False
|
||||
|
||||
def supports_native_websocket(self) -> bool:
|
||||
"""Use managed HTTP-streaming path for Responses API WebSocket mode.
|
||||
"""Use managed HTTP-streaming path for Responses API WebSocket mode by default.
|
||||
|
||||
OpenAI's wss://api.openai.com/v1/responses endpoint exists but does not
|
||||
reliably stream events back in response to response.create messages in all
|
||||
deployment contexts. The ManagedResponsesWebSocketHandler makes a normal
|
||||
HTTP streaming call to /v1/responses and forwards the events over the
|
||||
WebSocket, which is proven to work.
|
||||
|
||||
Set ``litellm.openai_responses_native_websocket = True`` to opt back in
|
||||
to the native WebSocket path (e.g. when using a private deployment or
|
||||
reverse proxy that reliably honours the native wss:// protocol).
|
||||
"""
|
||||
return False
|
||||
import litellm
|
||||
|
||||
return bool(getattr(litellm, "openai_responses_native_websocket", False))
|
||||
|
||||
#########################################################
|
||||
########## DELETE RESPONSE API TRANSFORMATION ##############
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue