forked from phoenix/litellm-mirror
fix(router.py): add no-proxy support for router
This commit is contained in:
parent
cb221cc88b
commit
1ba21a8c58
1 changed files with 9 additions and 0 deletions
|
@ -1704,6 +1704,7 @@ class Router:
|
||||||
# Check if the HTTP_PROXY and HTTPS_PROXY environment variables are set and use them accordingly.
|
# Check if the HTTP_PROXY and HTTPS_PROXY environment variables are set and use them accordingly.
|
||||||
http_proxy = os.getenv("HTTP_PROXY", None)
|
http_proxy = os.getenv("HTTP_PROXY", None)
|
||||||
https_proxy = os.getenv("HTTPS_PROXY", None)
|
https_proxy = os.getenv("HTTPS_PROXY", None)
|
||||||
|
no_proxy = os.getenv("NO_PROXY", None)
|
||||||
|
|
||||||
# Create the proxies dictionary only if the environment variables are set.
|
# Create the proxies dictionary only if the environment variables are set.
|
||||||
sync_proxy_mounts = None
|
sync_proxy_mounts = None
|
||||||
|
@ -1722,6 +1723,14 @@ class Router:
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# assume no_proxy is a list of comma separated urls
|
||||||
|
if no_proxy is not None and isinstance(no_proxy, str):
|
||||||
|
no_proxy_urls = no_proxy.split(",")
|
||||||
|
|
||||||
|
for url in no_proxy_urls: # set no-proxy support for specific urls
|
||||||
|
sync_proxy_mounts[url] = None # type: ignore
|
||||||
|
async_proxy_mounts[url] = None # type: ignore
|
||||||
|
|
||||||
organization = litellm_params.get("organization", None)
|
organization = litellm_params.get("organization", None)
|
||||||
if isinstance(organization, str) and organization.startswith("os.environ/"):
|
if isinstance(organization, str) and organization.startswith("os.environ/"):
|
||||||
organization_env_name = organization.replace("os.environ/", "")
|
organization_env_name = organization.replace("os.environ/", "")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue