Skip to content

Add https:// prefix to azure_endpoint when missing #2166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/openai/lib/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down