Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Support azure openai #177

Merged
merged 8 commits into from
Apr 6, 2023
Merged

Feat: Support azure openai #177

merged 8 commits into from
Apr 6, 2023

Conversation

Leizhenpeng
Copy link
Member

@Leizhenpeng Leizhenpeng commented Apr 6, 2023

描述

支持azure 的openai接口
参见:https://azure.microsoft.com/zh-cn/pricing/details/cognitive-services/openai-service/

增加下面环境变量

# set to true to use Azure rather than OpenAI
AZURE_ON: true 
# 2023-03-15-preview or 2022-12-01 
AZURE_API_VERSION: 2023-03-15-preview 
# you can find in endpoint url. Usually looks like https://{RESOURCE_NAME}.openai.azure.com
AZURE_RESOURCE_NAME: xxxx   
# usually looks like ...openai.azure.com/openai/deployments/{DEPLOYMENT_NAME}/chat/completions.
AZURE_DEPLOYMENT_NAME: xxxx 
# Authentication key. Use Azure Active Directory Authentication(TBD).
AZURE_OPENAI_TOKEN: xxxx  

例如docker部署

docker build -t feishu-chatgpt:latest .
docker run -d --name feishu-chatgpt -p 9000:9000 \
--env APP_ID=xxx \
--env APP_SECRET=xxx \
--env APP_ENCRYPT_KEY=xxx \
--env APP_VERIFICATION_TOKEN=xxx \
--env BOT_NAME=chatGpt \
--env AZURE_ON=true \
--env AZURE_API_VERSION=xxx \
--env AZURE_RESOURCE_NAME=xxx \
--env AZURE_DEPLOYMENT_NAME=xxx \
--env AZURE_OPENAI_TOKEN=xxx \
feishu-chatgpt:latest
  • BOT_NAME 为飞书机器人名称,例如 chatGpt
  • AZURE_ON 为是否使用azure ,请填写 true
  • AZURE_API_VERSION 为azure api版本 例如 2023-03-15-preview
  • AZURE_RESOURCE_NAME 为azure 资源名称 类似 https://{AZURE_RESOURCE_NAME}.openai.azure.com
  • AZURE_DEPLOYMENT_NAME 为azure 部署名称 类似 https://{AZURE_RESOURCE_NAME}.openai.azure.com/deployments/{AZURE_DEPLOYMENT_NAME}/chat/completions
  • AZURE_OPENAI_TOKEN 为azure openai token

注意

在azure模式下,

  • 自动关闭图片创作和语音交互功能
  • OPENAI_KEY环境变量将自动失效

相关问题

@Leizhenpeng Leizhenpeng added the enhancement New feature or request label Apr 6, 2023
@Leizhenpeng Leizhenpeng merged commit 84a9657 into master Apr 6, 2023
@Terrymurphyiber
Copy link

尝试配置了GPT-4,没有返回,报错:[GIN] 2023/04/10 - 12:45:29 | 200 | 136.181724ms | 10.92.0.25 | POST "/webhook/event"
No available API, revive one randomly
2023/04/10 12:45:29 [Error] [handle event,path:/webhook/event, error:invalid argument to Intn]
[GIN] 2023/04/10 - 12:45:29 | 500 | 142.585767ms | 10.92.0.24 | POST "/webhook/event"

@TandK8600
Copy link

TandK8600 commented Jun 7, 2023

用的azure,没有配置gpt-4报错:
[GIN] 2023/06/07 - 07:56:44 | 200 | 262.942µs | 123.58.10.238 | POST "/webhook/event"
No available API, revive one randomly
2023/06/07 07:57:02 [Error] [handle event,path:/webhook/event, error:invalid argument to Intn]
[GIN] 2023/06/07 - 07:57:02 | 500 | 275.271µs | 123.58.10.239 | POST "/webhook/event"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants