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 validation checking for azure deployment config #243

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
15 changes: 14 additions & 1 deletion redisvl/utils/vectorize/text/azureopenai.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(
'Deployment name' not the 'Model name'. Defaults to
'text-embedding-ada-002'.
api_config (Optional[Dict], optional): Dictionary containing the
API key, API version, Azure endpoint, and any other API options.
API key, API version, Azure endpoint, Azure deployment, and any other API options.
Defaults to None.

Raises:
Expand Down Expand Up @@ -127,6 +127,19 @@ def _initialize_clients(self, api_config: Optional[Dict]):
"Provide it in api_config or set the AZURE_OPENAI_API_KEY\
environment variable."
)

azure_deployment = (
api_config.pop("azure_deployment")
if api_config
else os.getenv("AZURE_OPENAI_DEPLOYMENT")
)

if not azure_deployment:
raise ValueError(
"AzureOpenAI API deployment is required. "
"Provide it in api_config or set the AZURE_OPENAI_DEPLOYMENT\
environment variable."
)

self._client = AzureOpenAI(
api_key=api_key,
Expand Down
Loading