From 74a253f52192183b0ef485e4e83f9038b2eb5df5 Mon Sep 17 00:00:00 2001 From: "zyqcn@live.com" Date: Mon, 24 Jul 2023 15:44:03 +0800 Subject: [PATCH] azure api add api-version:https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference --- README.md | 1 + bot/chatgpt/chat_gpt_bot.py | 2 +- config.py | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 341c7344b..1be25695c 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ pip3 install azure-cognitiveservices-speech "group_speech_recognition": false, # 是否开启群组语音识别 "use_azure_chatgpt": false, # 是否使用Azure ChatGPT service代替openai ChatGPT service. 当设置为true时需要设置 open_ai_api_base,如 https://xxx.openai.azure.com/ "azure_deployment_id": "", # 采用Azure ChatGPT时,模型部署名称 + "azure_api_version": "", # 采用Azure ChatGPT时,API版本 "character_desc": "你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。", # 人格描述 # 订阅消息,公众号和企业微信channel中请填写,当被订阅时会自动回复,可使用特殊占位符。目前支持的占位符有{trigger_prefix},在程序中它会自动替换成bot的触发词。 "subscribe_msg": "感谢您的关注!\n这里是ChatGPT,可以自由对话。\n支持语音对话。\n支持图片输出,画字开头的消息将按要求创作图片。\n支持角色扮演和文字冒险等丰富插件。\n输入{trigger_prefix}#help 查看详细指令。" diff --git a/bot/chatgpt/chat_gpt_bot.py b/bot/chatgpt/chat_gpt_bot.py index ba357c00b..8c9a2504a 100644 --- a/bot/chatgpt/chat_gpt_bot.py +++ b/bot/chatgpt/chat_gpt_bot.py @@ -166,7 +166,7 @@ class AzureChatGPTBot(ChatGPTBot): def __init__(self): super().__init__() openai.api_type = "azure" - openai.api_version = "2023-03-15-preview" + openai.api_version = conf().get("azure_api_version", "2023-06-01-preview") self.args["deployment_id"] = conf().get("azure_deployment_id") def create_img(self, query, retry_count=0, api_key=None): diff --git a/config.py b/config.py index 85c543647..6bcde0928 100644 --- a/config.py +++ b/config.py @@ -19,6 +19,7 @@ "model": "gpt-3.5-turbo", "use_azure_chatgpt": False, # 是否使用azure的chatgpt "azure_deployment_id": "", # azure 模型部署名称 + "azure_api_version": "", # azure api版本 # Bot触发配置 "single_chat_prefix": ["bot", "@bot"], # 私聊时文本需要包含该前缀才能触发机器人回复 "single_chat_reply_prefix": "[bot] ", # 私聊时自动回复的前缀,用于区分真人