Skip to content

Commit d5753b2

Browse files
committed
Fix: AzureOpenAIInferenceEngine fails if api_version is not set
Signed-off-by: Martín Santillán Cooper <[email protected]>
1 parent 0e3d2cb commit d5753b2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/unitxt/inference.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ def _prepare_credentials(self) -> CredentialsOpenAi:
17711771
), "Error while trying to run AzureOpenAIInferenceEngine: Missing environment variable param AZURE_OPENAI_HOST or OPENAI_API_VERSION"
17721772
api_url = f"{azure_openapi_host}/openai/deployments/{self.model_name}/chat/completions?api-version={api_version}"
17731773

1774-
return {"api_key": api_key, "api_url": api_url}
1774+
return {"api_key": api_key, "api_url": api_url, "api_version": api_version}
17751775

17761776
def create_client(self):
17771777
from openai import AzureOpenAI
@@ -1780,6 +1780,7 @@ def create_client(self):
17801780
return AzureOpenAI(
17811781
api_key=self.credentials["api_key"],
17821782
base_url=self.credentials["api_url"],
1783+
api_version=self.credentials["api_version"],
17831784
default_headers=self.get_default_headers(),
17841785
)
17851786

0 commit comments

Comments
 (0)