Sfoglia il codice sorgente

update gemini model

develop
6vision 4 mesi fa
parent
commit
bb2880191a
2 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. +2
    -2
      bot/gemini/google_gemini_bot.py
  2. +1
    -1
      bridge/bridge.py

+ 2
- 2
bot/gemini/google_gemini_bot.py Vedi File

@@ -24,7 +24,7 @@ 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"
def reply(self, query, context: Context = None) -> Reply:
try:
if context.type != ContextType.TEXT:
@@ -35,7 +35,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)


+ 1
- 1
bridge/bridge.py Vedi File

@@ -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


Loading…
Annulla
Salva