File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/any_llm/providers/anthropic Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1414from openai .types .chat .chat_completion_message import ChatCompletionMessage
1515from openai .types .chat .chat_completion_message_tool_call import ChatCompletionMessageToolCall , Function
1616from any_llm .provider import Provider , ApiConfig
17+ from any_llm .exceptions import MissingApiKeyError
1718
1819# Define a constant for the default max_tokens value
1920DEFAULT_MAX_TOKENS = 4096
@@ -186,8 +187,10 @@ def __init__(self, config: ApiConfig) -> None:
186187 if not config .api_key :
187188 config .api_key = os .getenv ("ANTHROPIC_API_KEY" )
188189 if not config .api_key :
189- msg = "No Anthropic API key provided. Please provide it in the config or set the ANTHROPIC_API_KEY environment variable."
190- raise ValueError (msg )
190+ raise MissingApiKeyError (
191+ "Anthropic" ,
192+ "ANTHROPIC_API_KEY" ,
193+ )
191194 self .client = Anthropic (api_key = config .api_key , base_url = config .api_base )
192195
193196 def completion (
You can’t perform that action at this time.
0 commit comments