Update gemini 1.5modelmaster
@@ -24,7 +24,9 @@ class GoogleGeminiBot(Bot): | |||
self.api_key = conf().get("gemini_api_key") | |||
# 复用文心的token计算方式 | |||
self.sessions = SessionManager(BaiduWenxinSession, model=conf().get("model") or "gpt-3.5-turbo") | |||
self.model = conf().get("model") or "gemini-pro" | |||
if self.model == "gemini": | |||
self.model = "gemini-pro" | |||
def reply(self, query, context: Context = None) -> Reply: | |||
try: | |||
if context.type != ContextType.TEXT: | |||
@@ -35,7 +37,7 @@ class GoogleGeminiBot(Bot): | |||
session = self.sessions.session_query(query, session_id) | |||
gemini_messages = self._convert_to_gemini_messages(self.filter_messages(session.messages)) | |||
genai.configure(api_key=self.api_key) | |||
model = genai.GenerativeModel('gemini-pro') | |||
model = genai.GenerativeModel(self.model) | |||
response = model.generate_content(gemini_messages) | |||
reply_text = response.text | |||
self.sessions.session_reply(reply_text, session_id) | |||
@@ -36,7 +36,7 @@ class Bridge(object): | |||
self.btype["chat"] = const.QWEN | |||
if model_type in [const.QWEN_TURBO, const.QWEN_PLUS, const.QWEN_MAX]: | |||
self.btype["chat"] = const.QWEN_DASHSCOPE | |||
if model_type in [const.GEMINI]: | |||
if model_type and model_type.startswith("gemini"): | |||
self.btype["chat"] = const.GEMINI | |||
if model_type in [const.ZHIPU_AI]: | |||
self.btype["chat"] = const.ZHIPU_AI | |||
@@ -11,7 +11,7 @@ QWEN = "qwen" # 旧版通义模型 | |||
QWEN_DASHSCOPE = "dashscope" # 通义新版sdk和api key | |||
GEMINI = "gemini" | |||
GEMINI = "gemini" # gemini-1.0-pro | |||
ZHIPU_AI = "glm-4" | |||
MOONSHOT = "moonshot" | |||
MiniMax = "minimax" | |||
@@ -51,16 +51,19 @@ LINKAI_35 = "linkai-3.5" | |||
LINKAI_4_TURBO = "linkai-4-turbo" | |||
LINKAI_4o = "linkai-4o" | |||
GEMINI_PRO = "gemini-1.0-pro" | |||
GEMINI_15_flash = "gemini-1.5-flash" | |||
GEMINI_15_PRO = "gemini-1.5-pro" | |||
MODEL_LIST = [ | |||
GPT35, GPT35_0125, GPT35_1106, "gpt-3.5-turbo-16k", | |||
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, | |||
WEN_XIN, WEN_XIN_4, | |||
XUNFEI, GEMINI, ZHIPU_AI, MOONSHOT, | |||
XUNFEI, ZHIPU_AI, MOONSHOT, MiniMax, | |||
GEMINI, GEMINI_PRO, GEMINI_15_flash, GEMINI_15_PRO, | |||
"claude", "claude-3-haiku", "claude-3-sonnet", "claude-3-opus", "claude-3-opus-20240229", | |||
"moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k", | |||
QWEN, QWEN_TURBO, QWEN_PLUS, QWEN_MAX, | |||
MiniMax, | |||
LINKAI_35, LINKAI_4_TURBO, LINKAI_4o | |||
] | |||