Skip to content

Commit 69b73c5

Browse files
authoredDec 10, 2024
fix(azure): handle trailing slash in azure_endpoint (#1935)
1 parent 7a83e0f commit 69b73c5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎src/openai/lib/azure.py

+4-4
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)