@@ -151,6 +151,7 @@ class AzureChatGPTBot(ChatGPTBot): | |||
def compose_args(self): | |||
args = super().compose_args() | |||
args["engine"] = args["model"] | |||
del(args["model"]) | |||
return args | |||
args["deployment_id"] = conf().get("azure_deployment_id") | |||
#args["engine"] = args["model"] | |||
#del(args["model"]) | |||
return args |
@@ -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") | |||
@@ -76,4 +76,4 @@ def num_tokens_from_messages(messages, model): | |||
if key == "name": | |||
num_tokens += tokens_per_name | |||
num_tokens += 3 # every reply is primed with <|start|>assistant<|message|> | |||
return num_tokens | |||
return num_tokens |
@@ -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"], | |||
@@ -14,4 +15,4 @@ | |||
"conversation_max_tokens": 1000, | |||
"expires_in_seconds": 3600, | |||
"character_desc": "你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。" | |||
} | |||
} |
@@ -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"], # 私聊时文本需要包含该前缀才能触发机器人回复 | |||