From 673a496582ccf5d960e26a846cd6df81e837a9f9 Mon Sep 17 00:00:00 2001 From: Jozef833 Date: Mon, 25 Nov 2024 19:06:02 -0500 Subject: [PATCH 1/2] 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. --- src/openai/lib/azure.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openai/lib/azure.py b/src/openai/lib/azure.py index 5d21f10b70..037f1179cc 100644 --- a/src/openai/lib/azure.py +++ b/src/openai/lib/azure.py @@ -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") @@ -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") From 2d082e5ebc0e352b3ca3ff64c030c8d58768a579 Mon Sep 17 00:00:00 2001 From: Jozef833 Date: Tue, 17 Dec 2024 10:24:04 -0500 Subject: [PATCH 2/2] Update azure.py --- src/openai/lib/azure.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openai/lib/azure.py b/src/openai/lib/azure.py index 037f1179cc..54122dbecb 100644 --- a/src/openai/lib/azure.py +++ b/src/openai/lib/azure.py @@ -193,9 +193,9 @@ def __init__( ) if azure_deployment is not None: - base_url = f"{azure_endpoint.rstrip("/")}/openai/deployments/{azure_deployment}" + base_url = f"{azure_endpoint.rstrip('/')}/openai/deployments/{azure_deployment}" else: - base_url = f"{azure_endpoint.rstrip("/")}/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") @@ -433,9 +433,9 @@ def __init__( ) if azure_deployment is not None: - base_url = f"{azure_endpoint.rstrip("/")}/openai/deployments/{azure_deployment}" + base_url = f"{azure_endpoint.rstrip('/')}/openai/deployments/{azure_deployment}" else: - base_url = f"{azure_endpoint.rstrip("/")}/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")