bugfix for azure chatgpt adapting

This commit is contained in:
yubai
2023-04-09 15:36:03 +08:00
parent bf4ae9a051
commit 89e8f385b4
4 changed files with 9 additions and 6 deletions

View File

@@ -151,6 +151,7 @@ class AzureChatGPTBot(ChatGPTBot):
def compose_args(self):
args = super().compose_args()
args["engine"] = args["model"]
del(args["model"])
args["deployment_id"] = conf().get("azure_deployment_id")
#args["engine"] = args["model"]
#del(args["model"])
return args

View File

@@ -55,7 +55,7 @@ def num_tokens_from_messages(messages, model):
except KeyError:
logger.debug("Warning: model not found. Using cl100k_base encoding.")
encoding = tiktoken.get_encoding("cl100k_base")
if model == "gpt-3.5-turbo":
if model == "gpt-3.5-turbo" or model == "gpt-35-turbo":
return num_tokens_from_messages(messages, model="gpt-3.5-turbo-0301")
elif model == "gpt-4":
return num_tokens_from_messages(messages, model="gpt-4-0314")

View File

@@ -1,5 +1,6 @@
{
"open_ai_api_key": "YOUR API KEY",
"open_ai_api_base": "",
"model": "gpt-3.5-turbo",
"proxy": "",
"single_chat_prefix": ["bot", "@bot"],

View File

@@ -16,6 +16,7 @@ available_setting = {
# chatgpt模型 当use_azure_chatgpt为true时其名称为Azure上model deployment名称
"model": "gpt-3.5-turbo",
"use_azure_chatgpt": False, # 是否使用azure的chatgpt
"azure_deployment_id": "", #azure 模型部署名称
# Bot触发配置
"single_chat_prefix": ["bot", "@bot"], # 私聊时文本需要包含该前缀才能触发机器人回复