Skip to content

Commit

Permalink
Merge pull request #1241 from Skyzayre/master
Browse files Browse the repository at this point in the history
新加入1106两个模型的适配
  • Loading branch information
binary-husky authored Nov 10, 2023
2 parents 795de49 + a1a91c2 commit b49b272
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ git clone --depth=1 https://github.com/OpenLMLab/MOSS.git request_llms/moss #
参考wiki:https://github.com/binary-husky/gpt_academic/wiki/%E9%80%82%E9%85%8DRWKV-Runner

# 【可选步骤IV】确保config.py配置文件的AVAIL_LLM_MODELS包含了期望的模型,目前支持的全部模型如下(jittorllms系列目前仅支持docker方案):
AVAIL_LLM_MODELS = ["gpt-3.5-turbo", "api2d-gpt-3.5-turbo", "gpt-4", "api2d-gpt-4", "chatglm", "newbing", "moss"] # + ["jittorllms_rwkv", "jittorllms_pangualpha", "jittorllms_llama"]
AVAIL_LLM_MODELS = ["gpt-3.5-turbo", "api2d-gpt-3.5-turbo", "gpt-4", "api2d-gpt-4", "chatglm", "moss"] # + ["jittorllms_rwkv", "jittorllms_pangualpha", "jittorllms_llama"]
```

</p>
Expand Down
17 changes: 14 additions & 3 deletions crazy_functions/多智能体.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
from crazy_functions.agent_fns.auto_agent import AutoGenMath
import time

def remove_model_prefix(llm):
if llm.startswith('api2d-'): llm = llm.replace('api2d-', '')
if llm.startswith('azure-'): llm = llm.replace('azure-', '')
return llm


@CatchException
def 多智能体终端(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port):
Expand All @@ -32,10 +37,16 @@ def 多智能体终端(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_
web_port 当前软件运行的端口号
"""
# 检查当前的模型是否符合要求
supported_llms = ['gpt-3.5-turbo-16k', 'gpt-4', 'gpt-4-32k',
'api2d-gpt-3.5-turbo-16k', 'api2d-gpt-4']
supported_llms = [
'gpt-3.5-16k',
'gpt-3.5-turbo-16k',
'gpt-3.5-turbo-1106',
'gpt-4',
'gpt-4-32k',
'gpt-4-1106-preview',
]
llm_kwargs['api_key'] = select_api_key(llm_kwargs['api_key'], llm_kwargs['llm_model'])
if llm_kwargs['llm_model'] not in supported_llms:
if remove_model_prefix(llm_kwargs['llm_model']) not in supported_llms:
chatbot.append([f"处理任务: {txt}", f"当前插件只支持{str(supported_llms)}, 当前模型{llm_kwargs['llm_model']}."])
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
return
Expand Down
1 change: 1 addition & 0 deletions request_llms/bridge_chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def generate_payload(inputs, llm_kwargs, history, system_prompt, stream):
model = random.choice([
"gpt-3.5-turbo",
"gpt-3.5-turbo-16k",
"gpt-3.5-turbo-1106",
"gpt-3.5-turbo-0613",
"gpt-3.5-turbo-16k-0613",
"gpt-3.5-turbo-0301",
Expand Down

0 comments on commit b49b272

Please sign in to comment.