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

fix: clarify error message for missing azure api-key #3256

Merged
merged 2 commits into from
May 21, 2024
Merged
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
5 changes: 5 additions & 0 deletions packages/phoenix-evals/src/phoenix/evals/models/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ def _init_open_ai(self) -> None:
api_key = os.getenv(OPENAI_API_KEY_ENVVAR_NAME)
if api_key is None:
# TODO: Create custom AuthenticationError
if self._is_azure:
raise RuntimeError(
"Azure API key not provided. Pass it as an argument to 'api_key' "
"or set it in your environment: 'export OPENAI_API_KEY=****'"
)
raise RuntimeError(
"OpenAI's API key not provided. Pass it as an argument to 'api_key' "
"or set it in your environment: 'export OPENAI_API_KEY=sk-****'"
Expand Down
Loading