@@ -38,7 +38,6 @@ def __init__(self):
38
38
None # instance variables are backups in case saving to a `.env` fails
39
39
)
40
40
41
-
42
41
def initialize_openai (self ):
43
42
if self .verbose :
44
43
print ("[Config][initialize_openai]" )
@@ -76,15 +75,14 @@ def initialize_google(self):
76
75
model = genai .GenerativeModel ("gemini-pro-vision" )
77
76
78
77
return model
79
-
78
+
80
79
def initialize_anthropic (self ):
81
80
if self .anthropic_api_key :
82
81
api_key = self .anthropic_api_key
83
82
else :
84
83
api_key = os .getenv ("ANTHROPIC_API_KEY" )
85
84
return anthropic .Anthropic (api_key = api_key )
86
85
87
-
88
86
def validation (self , model , voice_mode ):
89
87
"""
90
88
Validate the input parameters for the dialog operation.
@@ -101,7 +99,7 @@ def validation(self, model, voice_mode):
101
99
"GOOGLE_API_KEY" , "Google API key" , model == "gemini-pro-vision"
102
100
)
103
101
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"
105
103
)
106
104
107
105
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):
127
125
self .openai_api_key = key_value
128
126
elif key_name == "GOOGLE_API_KEY" :
129
127
self .google_api_key = key_value
128
+ elif key_name == "ANTHROPIC_API_KEY" :
129
+ self .anthropic_api_key = key_value
130
130
self .save_api_key_to_env (key_name , key_value )
131
131
load_dotenv () # Reload environment variables
132
132
# Update the instance attribute with the new key
0 commit comments