jack482653 / openai-slack-bot

a OpenAI Slack bot
BSD 3-Clause "New" or "Revised" License
44 stars 16 forks source link

Azure OpenAI API supported #14

Closed tookdes closed 11 months ago

tookdes commented 1 year ago

Azure completions URL is like:

https://XXXXXX.openai.azure.com/openai/deployments/XXXsthlikeGPT35T/chat/completions?api-version=2023-03-15-preview

ref: https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/chatgpt?pivots=programming-language-chat-completions

jack482653 commented 1 year ago

Sorry I am busy this week. I may start to do the azure integration this weekend.

jack482653 commented 1 year ago

It seems that change base path is enough. You can try this PR https://github.com/jack482653/openai-slack-bot/pull/15 or use docker image v1.8.0-beta.0 However, I don't have permission of accessing Azure OpenAI service, so I haven't test yet.

jack482653 commented 1 year ago

I added new env Azure OpenAI needed in new PR https://github.com/jack482653/openai-slack-bot/pull/16 and test image 1.9.0-beta.0 I have not updated README.md yet. You have to add environment variables in .env If you want to use Azure OpenAI:

OPENAI_PROVIDER=azure
OPENAI_AZURE_AUTH_API_BASE=https://XXX.openai.azure.com
OPENAI_AZURE_AUTH_DEPLOYMENT_NAME=XXX
OPENAI_AZURE_AUTH_API_VERSION=2023-05-15
OPENAI_AZURE_AUTH_API_KEY=XXX

OPENAI_PROVIDER is required to identify which provider (azure or openai) you want to use OPENAI_AZURE_AUTH_API_BASE is Azure OpenAI Service endpoint OPENAI_AZURE_AUTH_DEPLOYMENT_NAME is your deployment name on the Azure OpenAI Service