Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warnings for deprecated azure oai config changes #4317

Merged
merged 3 commits into from
Nov 25, 2024
Merged
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 @@ -86,10 +86,29 @@ def _azure_openai_client_from_config(config: Mapping[str, Any]) -> AsyncAzureOpe
# Take a copy
copied_config = dict(config).copy()

import warnings
jackgerrits marked this conversation as resolved.
Show resolved Hide resolved

if "azure_deployment" not in copied_config and "model" in copied_config:
warnings.warn(
"Previous behavior of using the model name as the deployment name is deprecated and will be removed in 0.4",
stacklevel=2,
)

if "azure_endpoint" not in copied_config and "base_url" in copied_config:
warnings.warn(
"Previous behavior of using the base_url as the endpoint is deprecated and will be removed in 0.4",
stacklevel=2,
)

# Do some fixups
copied_config["azure_deployment"] = copied_config.get("azure_deployment", config.get("model"))
if copied_config["azure_deployment"] is not None:
copied_config["azure_deployment"] = copied_config["azure_deployment"].replace(".", "")
if "." in copied_config["azure_deployment"]:
warnings.warn(
"Previous behavior stripping '.' from the deployment name is deprecated and will be removed in 0.4",
stacklevel=2,
)
copied_config["azure_deployment"] = copied_config["azure_deployment"].replace(".", "")
copied_config["azure_endpoint"] = copied_config.get("azure_endpoint", copied_config.pop("base_url", None))

# Shave down the config to just the AzureOpenAIChatCompletionClient kwargs
Expand Down
Loading