Skip to content

Commit 08f0023

Browse files
authored
Merge pull request #2124 from 6vision/update_gemini_model
Update gemini 1.5model
2 parents e311466 + 87525bb commit 08f0023

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

bot/gemini/google_gemini_bot.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ def __init__(self):
2424
self.api_key = conf().get("gemini_api_key")
2525
# 复用文心的token计算方式
2626
self.sessions = SessionManager(BaiduWenxinSession, model=conf().get("model") or "gpt-3.5-turbo")
27-
27+
self.model = conf().get("model") or "gemini-pro"
28+
if self.model == "gemini":
29+
self.model = "gemini-pro"
2830
def reply(self, query, context: Context = None) -> Reply:
2931
try:
3032
if context.type != ContextType.TEXT:
@@ -35,7 +37,7 @@ def reply(self, query, context: Context = None) -> Reply:
3537
session = self.sessions.session_query(query, session_id)
3638
gemini_messages = self._convert_to_gemini_messages(self.filter_messages(session.messages))
3739
genai.configure(api_key=self.api_key)
38-
model = genai.GenerativeModel('gemini-pro')
40+
model = genai.GenerativeModel(self.model)
3941
response = model.generate_content(gemini_messages)
4042
reply_text = response.text
4143
self.sessions.session_reply(reply_text, session_id)

bridge/bridge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self):
3636
self.btype["chat"] = const.QWEN
3737
if model_type in [const.QWEN_TURBO, const.QWEN_PLUS, const.QWEN_MAX]:
3838
self.btype["chat"] = const.QWEN_DASHSCOPE
39-
if model_type in [const.GEMINI]:
39+
if model_type and model_type.startswith("gemini"):
4040
self.btype["chat"] = const.GEMINI
4141
if model_type in [const.ZHIPU_AI]:
4242
self.btype["chat"] = const.ZHIPU_AI

common/const.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
QWEN_DASHSCOPE = "dashscope" # 通义新版sdk和api key
1212

1313

14-
GEMINI = "gemini"
14+
GEMINI = "gemini" # gemini-1.0-pro
1515
ZHIPU_AI = "glm-4"
1616
MOONSHOT = "moonshot"
1717
MiniMax = "minimax"
@@ -51,16 +51,19 @@
5151
LINKAI_4_TURBO = "linkai-4-turbo"
5252
LINKAI_4o = "linkai-4o"
5353

54+
GEMINI_PRO = "gemini-1.0-pro"
55+
GEMINI_15_flash = "gemini-1.5-flash"
56+
GEMINI_15_PRO = "gemini-1.5-pro"
5457

5558
MODEL_LIST = [
5659
GPT35, GPT35_0125, GPT35_1106, "gpt-3.5-turbo-16k",
5760
GPT_4o, GPT4_TURBO, GPT4_TURBO_PREVIEW, GPT4_TURBO_01_25, GPT4_TURBO_11_06, GPT4, GPT4_32k, GPT4_06_13, GPT4_32k_06_13,
5861
WEN_XIN, WEN_XIN_4,
59-
XUNFEI, GEMINI, ZHIPU_AI, MOONSHOT,
62+
XUNFEI, ZHIPU_AI, MOONSHOT, MiniMax,
63+
GEMINI, GEMINI_PRO, GEMINI_15_flash, GEMINI_15_PRO,
6064
"claude", "claude-3-haiku", "claude-3-sonnet", "claude-3-opus", "claude-3-opus-20240229",
6165
"moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k",
6266
QWEN, QWEN_TURBO, QWEN_PLUS, QWEN_MAX,
63-
MiniMax,
6467
LINKAI_35, LINKAI_4_TURBO, LINKAI_4o
6568
]
6669

0 commit comments

Comments
 (0)