Skip to content

Commit

Permalink
Update azure.py
Browse files Browse the repository at this point in the history
Examples of values for azure_endpoint include the trailing forward slash, but 4 string concatenations in this file are not compatible with the inclusion of the trailing character. This commit makes them agnostic to the trailing character.
  • Loading branch information
Jozef833 authored Nov 26, 2024
1 parent 83f4774 commit 673a496
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 673a496

Please sign in to comment.