Skip to content

Commit

Permalink
fix(azure): handle trailing slash in azure_endpoint (#1935)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjihikmatullah authored and stainless-app[bot] committed Dec 10, 2024
1 parent 6a1ab55 commit 3cf3dd7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/openai/lib/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ def __init__(
)

if azure_deployment is not None:
base_url = f"{azure_endpoint}/openai/deployments/{azure_deployment}"
base_url = f"{azure_endpoint.rstrip('/')}/openai/deployments/{azure_deployment}"
else:
base_url = f"{azure_endpoint}/openai"
base_url = f"{azure_endpoint.rstrip('/')}/openai"
else:
if azure_endpoint is not None:
raise ValueError("base_url and azure_endpoint are mutually exclusive")
Expand Down Expand Up @@ -433,9 +433,9 @@ def __init__(
)

if azure_deployment is not None:
base_url = f"{azure_endpoint}/openai/deployments/{azure_deployment}"
base_url = f"{azure_endpoint.rstrip('/')}/openai/deployments/{azure_deployment}"
else:
base_url = f"{azure_endpoint}/openai"
base_url = f"{azure_endpoint.rstrip('/')}/openai"
else:
if azure_endpoint is not None:
raise ValueError("base_url and azure_endpoint are mutually exclusive")
Expand Down

0 comments on commit 3cf3dd7

Please sign in to comment.