Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

feat: Add api key link in error info (#1630)

TTS639d4b028368
diff --git a/camel/utils/commons.py b/camel/utils/commons.py
index d0aa11331..d6e211b9e 100644
--- a/camel/utils/commons.py
+++ b/camel/utils/commons.py
@@ -306,11 +306,54 @@ def api_keys_required(
value = os.environ.get(env_var_name)
if not value or value.strip() == "":
missing_keys.append(env_var_name)
-
+
+ key_way = "the official website"
+ if env_var_name=='ANTHROPIC_API_KEY':
+ key_way = "https://docs.anthropic.com/zh-CN/api/getting-started"
+ elif env_var_name=='AIML_API_KEY':
+ key_way = "https://aimlapi.com/"
+ elif env_var_name=='COHERE_API_KEY':
+ key_way = "https://cohere.com/"
+ elif env_var_name=='DEEPSEEK_API_KEY':
+ key_way = "https://www.deepseek.com/"
+ elif env_var_name=='AZURE_OPENAI_API_KEY':
+ key_way = "https://portal.azure.com/"
+ elif env_var_name=='OPENAI_API_KEY':
+ key_way = "https://platform.openai.com/docs/overview"
+ elif env_var_name=='FISHAUDIO_API_KEY':
+ key_way = "https://fish.audio/"
+ elif env_var_name=='GEMINI_API_KEY':
+ key_way = "https://gemini.google.com/"
+ elif env_var_name=='INTERNLM_API_KEY':
+ key_way = "https://internlm-chat.intern-ai.org.cn/puyu/api/v1"
+ elif env_var_name=='GROQ_API_KEY':
+ key_way = "https://api.groq.com/openai/v1"
+ elif env_var_name=='MISTRAL_API_KEY':
+ key_way = "https://mistral.ai/"
+ elif env_var_name=='MOONSHOT_API_KEY':
+ key_way = "https://api.moonshot.cn/v1"
+ elif env_var_name=='NVIDIA_API_KEY':
+ key_way = "https://integrate.api.nvidia.com/"
+ elif env_var_name=='OPENAI_COMPATIBILIY_API_KEY':
+ key_way = "https://platform.openai.com/docs/overview"
+ elif env_var_name=='QWEN_API_KEY':
+ key_way = "https://tongyi.aliyun.com/"
+ elif env_var_name=='REKA_API_KEY':
+ key_way = "https://docs.reka.ai/quick-start"
+ elif env_var_name=='SAMBA_API_KEY':
+ key_way = "https://community.sambanova.ai/t/looking-for-api-key-and-url-for-sambanova/576"
+ elif env_var_name=='TOGETHER_API_KEY':
+ key_way = "https://docs.together.ai/docs/quickstart"
+ elif env_var_name=='YI_API_KEY':
+ key_way = "https://platform.lingyiwanwu.com/docs"
+ elif env_var_name=='ZHIPUAI_API_KEY':
+ key_way = "https://www.zhipuai.cn/"
+
if missing_keys:
raise ValueError(
"Missing or empty required API keys in "
- f"environment variables: {', '.join(missing_keys)}"
+ f"environment variables: {', '.join(missing_keys)}.\n"
+ f"You can obtain the API key from {key_way}"
)
return func(*args, **kwargs)