fix(providers): remove custom cloud httpx client, let SDK handle proxy defaults
chengyongru reviewed #4367 and identified that the cloud branch created a bare httpx.AsyncClient that lacked the SDK's default settings (follow_redirects, connection pool limits). Since the SDK's DefaultAsyncHttpxClient already has trust_env=True and proper defaults, the simplest fix is to let http_client stay None for cloud endpoints. Also updated the test to match the new behavior (http_client is None).
This commit is contained in:
@@ -417,14 +417,9 @@ class OpenAICompatProvider(LLMProvider):
|
||||
timeout=timeout_s,
|
||||
transport=httpx.AsyncHTTPTransport(proxy=None, limits=_local_limits),
|
||||
)
|
||||
else:
|
||||
# Cloud endpoints: respect proxy environment variables
|
||||
# (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY) so corporate
|
||||
# or VPN proxies work without explicit configuration.
|
||||
http_client = httpx.AsyncClient(
|
||||
timeout=timeout_s,
|
||||
trust_env=True,
|
||||
)
|
||||
# else: http_client stays None → SDK creates DefaultAsyncHttpxClient
|
||||
# which already reads proxy env vars via trust_env=True, has proper
|
||||
# connection limits, and follows redirects.
|
||||
self._client = AsyncOpenAI(
|
||||
api_key=self._api_key_for_client,
|
||||
base_url=self._effective_base,
|
||||
|
||||
Reference in New Issue
Block a user