@@ -38,7 +38,6 @@ def __init__(self):
3838 None # instance variables are backups in case saving to a `.env` fails
3939 )
4040
41-
4241 def initialize_openai (self ):
4342 if self .verbose :
4443 print ("[Config][initialize_openai]" )
@@ -76,15 +75,14 @@ def initialize_google(self):
7675 model = genai .GenerativeModel ("gemini-pro-vision" )
7776
7877 return model
79-
78+
8079 def initialize_anthropic (self ):
8180 if self .anthropic_api_key :
8281 api_key = self .anthropic_api_key
8382 else :
8483 api_key = os .getenv ("ANTHROPIC_API_KEY" )
8584 return anthropic .Anthropic (api_key = api_key )
8685
87-
8886 def validation (self , model , voice_mode ):
8987 """
9088 Validate the input parameters for the dialog operation.
@@ -101,7 +99,7 @@ def validation(self, model, voice_mode):
10199 "GOOGLE_API_KEY" , "Google API key" , model == "gemini-pro-vision"
102100 )
103101 self .require_api_key (
104- "ANTHROPIC_API_KEY" , "Anthropic API key" , model == "claude-3-with-ocr "
102+ "ANTHROPIC_API_KEY" , "Anthropic API key" , model == "claude-3"
105103 )
106104
107105 def require_api_key (self , key_name , key_description , is_required ):
@@ -127,6 +125,8 @@ def prompt_and_save_api_key(self, key_name, key_description):
127125 self .openai_api_key = key_value
128126 elif key_name == "GOOGLE_API_KEY" :
129127 self .google_api_key = key_value
128+ elif key_name == "ANTHROPIC_API_KEY" :
129+ self .anthropic_api_key = key_value
130130 self .save_api_key_to_env (key_name , key_value )
131131 load_dotenv () # Reload environment variables
132132 # Update the instance attribute with the new key
0 commit comments