mirror of
https://github.com/yihong0618/bilingual_book_maker.git
synced 2025-06-07 03:55:30 +00:00
option to select claude model
This commit is contained in:
parent
daea974d68
commit
efaa673226
@ -375,7 +375,7 @@ So you are close to reaching the limit. You have to choose your own value, there
|
|||||||
API_KEY = options.deepl_key or env.get("BBM_DEEPL_API_KEY")
|
API_KEY = options.deepl_key or env.get("BBM_DEEPL_API_KEY")
|
||||||
if not API_KEY:
|
if not API_KEY:
|
||||||
raise Exception("Please provide deepl key")
|
raise Exception("Please provide deepl key")
|
||||||
elif options.model == "claude":
|
elif options.model.startswith("claude"):
|
||||||
API_KEY = options.claude_key or env.get("BBM_CLAUDE_API_KEY")
|
API_KEY = options.claude_key or env.get("BBM_CLAUDE_API_KEY")
|
||||||
if not API_KEY:
|
if not API_KEY:
|
||||||
raise Exception("Please provide claude key")
|
raise Exception("Please provide claude key")
|
||||||
@ -494,6 +494,8 @@ So you are close to reaching the limit. You have to choose your own value, there
|
|||||||
e.translate_model.set_gpt4omini_models()
|
e.translate_model.set_gpt4omini_models()
|
||||||
if options.model == "gpt4o":
|
if options.model == "gpt4o":
|
||||||
e.translate_model.set_gpt4o_models()
|
e.translate_model.set_gpt4o_models()
|
||||||
|
if options.model.startswith("claude-"):
|
||||||
|
e.translate_model.set_claude_model(options.model)
|
||||||
if options.block_size > 0:
|
if options.block_size > 0:
|
||||||
e.block_size = options.block_size
|
e.block_size = options.block_size
|
||||||
if options.batch_flag:
|
if options.batch_flag:
|
||||||
|
@ -21,6 +21,11 @@ MODEL_DICT = {
|
|||||||
"deepl": DeepL,
|
"deepl": DeepL,
|
||||||
"deeplfree": DeepLFree,
|
"deeplfree": DeepLFree,
|
||||||
"claude": Claude,
|
"claude": Claude,
|
||||||
|
"claude-3-5-sonnet-latest": Claude,
|
||||||
|
"claude-3-5-sonnet-20241022": Claude,
|
||||||
|
"claude-3-5-sonnet-20240620": Claude,
|
||||||
|
"claude-3-5-haiku-latest": Claude,
|
||||||
|
"claude-3-5-haiku-20241022": Claude,
|
||||||
"gemini": Gemini,
|
"gemini": Gemini,
|
||||||
"geminipro": Gemini,
|
"geminipro": Gemini,
|
||||||
"groq": GroqClient,
|
"groq": GroqClient,
|
||||||
|
@ -30,6 +30,9 @@ class Claude(Base):
|
|||||||
def rotate_key(self):
|
def rotate_key(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def set_claude_model(self, model_name):
|
||||||
|
self.model = model_name
|
||||||
|
|
||||||
def translate(self, text):
|
def translate(self, text):
|
||||||
print(text)
|
print(text)
|
||||||
self.rotate_key()
|
self.rotate_key()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user