Skip to content

Comments

Adding env var for deployment_name#292

Merged
kxk302 merged 3 commits intomainfrom
UN-3328-Add-environment-variable-for-deployment_name-in-AzureOpenAI
Jul 9, 2025
Merged

Adding env var for deployment_name#292
kxk302 merged 3 commits intomainfrom
UN-3328-Add-environment-variable-for-deployment_name-in-AzureOpenAI

Conversation

@kxk302
Copy link
Contributor

@kxk302 kxk302 commented Jul 9, 2025

No description provided.

@kxk302 kxk302 requested review from Noravee and d1donlydfink July 9, 2025 15:02
azure_endpoint=self.get_value_or_env(config, "azure_endpoint",
"AZURE_OPENAI_ENDPOINT"),
deployment_name=config.get("deployment_name"),
deployment_name=self.get_value_or_env(config, "deployment_name",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First get the value for "deployment_name" from config file (Previous behavior). If not available, get the value from the new env variable

"OPENAI_API_VERSION": ["validation error", "api_version", "OPENAI_API_VERSION", "Error code: 404",
"Resource not found"],
"deployment_name": ["Error code: 404", "Resource not found", "API deployment for this resource does not exist"],
"AZURE_OPENAI_DEPLOYMENT_NAME": ["Error code: 404", "Resource not found", "API deployment for this resource does not exist"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have an env var for this.

@@ -27,7 +27,7 @@
"Connection error"],
"OPENAI_API_VERSION": ["validation error", "api_version", "OPENAI_API_VERSION", "Error code: 404",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@d1donlydfink there is another ticket (https://leaf-ai.atlassian.net/browse/UN-3322) to add a documentation link to the error message in this file on how to set API keys etc for Azure. I've looked at the way the error message is constructed and can't think of a non-hacky way to add this feature. Any thoughts on how to do this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, you could break out a separate dictionary with extra text that gets included based on the env var key here that was found. If there is no entry in such a dictionary, then no extra text is added.
Sound reasonable?

d1donlydfink
d1donlydfink previously approved these changes Jul 9, 2025
@kxk302 kxk302 merged commit 8132dad into main Jul 9, 2025
4 checks passed
@kxk302 kxk302 deleted the UN-3328-Add-environment-variable-for-deployment_name-in-AzureOpenAI branch July 9, 2025 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants