mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-25 08:45:09 +00:00
Make missing OPENAI_API_KEY error actionable
The OpenAI provider raised a bare "OPENAI_API_KEY is required", which misdirects CrewAI AMP users who configured an org-wide LLM Connection. The error now explains the remediation (set the OPENAI_API_KEY environment variable or pass api_key to LLM()) and clarifies that org-wide LLM Connections do not apply to code-first AMP deployments, which read keys from deployment environment variables. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -383,7 +383,11 @@ def test_classify_missing_openai_key_is_warning(tmp_path: Path) -> None:
|
||||
v._classify_import_error(
|
||||
"ImportError",
|
||||
"Error importing native provider: 1 validation error for OpenAICompletion\n"
|
||||
" Value error, OPENAI_API_KEY is required",
|
||||
" Value error, OPENAI_API_KEY is required. Set the OPENAI_API_KEY "
|
||||
"environment variable or pass api_key to LLM(). On CrewAI AMP, "
|
||||
"code-first deployments read API keys from deployment environment "
|
||||
"variables — org-wide LLM Connections do not apply to code-first "
|
||||
"deployments.",
|
||||
tb="",
|
||||
)
|
||||
assert len(v.results) == 1
|
||||
|
||||
Reference in New Issue
Block a user