diff --git a/src/openai/lib/azure.py b/src/openai/lib/azure.py index ea7bd20d99..df586375f7 100644 --- a/src/openai/lib/azure.py +++ b/src/openai/lib/azure.py @@ -225,6 +225,10 @@ def __init__( if azure_endpoint is not None: raise ValueError("base_url and azure_endpoint are mutually exclusive") + # if base url does not start with https, we should add it + if not base_url.startswith("https://"): + base_url = f"https://{base_url}" + if api_key is None: # define a sentinel value to avoid any typing issues api_key = API_KEY_SENTINEL @@ -499,6 +503,10 @@ def __init__( if azure_endpoint is not None: raise ValueError("base_url and azure_endpoint are mutually exclusive") + # if base url does not start with https, we should add it + if not base_url.startswith("https://"): + base_url = f"https://{base_url}" + if api_key is None: # define a sentinel value to avoid any typing issues api_key = API_KEY_SENTINEL