From 1fe0b618541668b8a9f08aa193971372a979858a Mon Sep 17 00:00:00 2001 From: thanseefpp Date: Thu, 26 Oct 2023 14:23:51 +0530 Subject: [PATCH 1/2] deployment_name param updated to deployment_id, openai updated their param as deployment_id --- docs/configuration/providers.md | 2 +- src/marvin/engine/language_models/azure_openai.py | 6 +++--- src/marvin/settings.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/configuration/providers.md b/docs/configuration/providers.md index 85ee78e89..b691b52d2 100644 --- a/docs/configuration/providers.md +++ b/docs/configuration/providers.md @@ -131,7 +131,7 @@ To use the Azure OpenAI service, you can set the following configuration options | --- | --- | --- | :---: | --- | | API key | `MARVIN_AZURE_OPENAI_API_KEY` | `marvin.settings.azure_openai.api_key` | ✅ | | | API base | `MARVIN_AZURE_OPENAI_API_BASE` | `marvin.settings.azure_openai.api_base` | ✅ | The API endpoint; this should have the form `https://YOUR_RESOURCE_NAME.openai.azure.com` | -| Deployment name | `MARVIN_AZURE_OPENAI_DEPLOYMENT_NAME` | `marvin.settings.azure_openai.deployment_name` | ✅ | | +| Deployment name | `MARVIN_AZURE_OPENAI_DEPLOYMENT_ID` | `marvin.settings.azure_openai.deployment_id` | ✅ | | | API type | `MARVIN_AZURE_OPENAI_API_TYPE` | `marvin.settings.azure_openai.api_type` | | Either `azure` (the default) or `azure_ad` (to use Microsoft Active Directory to authenticate to your Azure endpoint).| ### Using a model diff --git a/src/marvin/engine/language_models/azure_openai.py b/src/marvin/engine/language_models/azure_openai.py index b19626da7..d398c071f 100644 --- a/src/marvin/engine/language_models/azure_openai.py +++ b/src/marvin/engine/language_models/azure_openai.py @@ -41,9 +41,9 @@ def _get_openai_settings(self) -> dict: "Azure OpenAI API key not set. Please set it or use the" " MARVIN_AZURE_OPENAI_API_KEY environment variable." ) - if marvin.settings.azure_openai.deployment_name: - openai_kwargs["deployment_name"] = ( - marvin.settings.azure_openai.deployment_name + if marvin.settings.azure_openai.deployment_id: + openai_kwargs["deployment_id"] = ( + marvin.settings.azure_openai.deployment_id ) if marvin.settings.azure_openai.api_type: openai_kwargs["api_type"] = marvin.settings.azure_openai.api_type diff --git a/src/marvin/settings.py b/src/marvin/settings.py index 42372eeed..ad4bb8d43 100644 --- a/src/marvin/settings.py +++ b/src/marvin/settings.py @@ -92,9 +92,9 @@ class Config: # "The endpoint of the Azure OpenAI API. This should have the form https://YOUR_RESOURCE_NAME.openai.azure.com" # noqa api_base: Optional[str] = None api_version: Optional[str] = "2023-07-01-preview" - # `deployment_name` will correspond to the custom name you chose for your deployment when # noqa + # `deployment_id` will correspond to the custom name you chose for your deployment when # noqa # you deployed a model. - deployment_name: Optional[str] = None + deployment_id: Optional[str] = None def get_defaults(self, settings: "Settings") -> dict[str, Any]: import os From e53e87cddea5a8f7885ad3b8d7fa0aa729dd0cbe Mon Sep 17 00:00:00 2001 From: thanseefpp Date: Thu, 26 Oct 2023 14:27:24 +0530 Subject: [PATCH 2/2] precomit fail solved --- src/marvin/engine/language_models/azure_openai.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/marvin/engine/language_models/azure_openai.py b/src/marvin/engine/language_models/azure_openai.py index d398c071f..a20be52dc 100644 --- a/src/marvin/engine/language_models/azure_openai.py +++ b/src/marvin/engine/language_models/azure_openai.py @@ -42,9 +42,7 @@ def _get_openai_settings(self) -> dict: " MARVIN_AZURE_OPENAI_API_KEY environment variable." ) if marvin.settings.azure_openai.deployment_id: - openai_kwargs["deployment_id"] = ( - marvin.settings.azure_openai.deployment_id - ) + openai_kwargs["deployment_id"] = marvin.settings.azure_openai.deployment_id if marvin.settings.azure_openai.api_type: openai_kwargs["api_type"] = marvin.settings.azure_openai.api_type if marvin.settings.azure_openai.api_base: