Skip to content

Commit 673a496

Browse files
authored
Update azure.py
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.
1 parent 83f4774 commit 673a496

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/openai/lib/azure.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ def __init__(
193193
)
194194

195195
if azure_deployment is not None:
196-
base_url = f"{azure_endpoint}/openai/deployments/{azure_deployment}"
196+
base_url = f"{azure_endpoint.rstrip("/")}/openai/deployments/{azure_deployment}"
197197
else:
198-
base_url = f"{azure_endpoint}/openai"
198+
base_url = f"{azure_endpoint.rstrip("/")}/openai"
199199
else:
200200
if azure_endpoint is not None:
201201
raise ValueError("base_url and azure_endpoint are mutually exclusive")
@@ -433,9 +433,9 @@ def __init__(
433433
)
434434

435435
if azure_deployment is not None:
436-
base_url = f"{azure_endpoint}/openai/deployments/{azure_deployment}"
436+
base_url = f"{azure_endpoint.rstrip("/")}/openai/deployments/{azure_deployment}"
437437
else:
438-
base_url = f"{azure_endpoint}/openai"
438+
base_url = f"{azure_endpoint.rstrip("/")}/openai"
439439
else:
440440
if azure_endpoint is not None:
441441
raise ValueError("base_url and azure_endpoint are mutually exclusive")

0 commit comments

Comments
 (0)