Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def create_base_chat_model(self, config: Dict[str, Any],
# Azure-specific
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

"AZURE_OPENAI_DEPLOYMENT_NAME"),
openai_api_version=self.get_value_or_env(config, "openai_api_version",
"OPENAI_API_VERSION"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?

"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.

}


Expand Down
Loading