iamgreggarcia / codesherpa

A code interpreter and ChatGPT plugin.
MIT License
253 stars 34 forks source link

Support Azure OpenAI API #34

Open wangxing7714436 opened 1 year ago

wangxing7714436 commented 1 year ago

Hi, any chance you guys make a support to use azure api?

iamgreggarcia commented 1 year ago

Hi @wangxing7714436 , this is a good idea. I'll look into it.

wangxing7714436 commented 1 year ago

The api use azure from some other project is like:

https://github.com/iuiaoin/wechat-gptbot/blob/main/bot/bot.py

and its config file:

{ "openai_api_key": "YOUR API SECRET KEY", "model": "gpt-3.5-turbo", "use_azure_chatgpt": true, "azure_deployment_id": "YOUR_DEPLOY_ID", "role_desc": "You are a helpful assistant.", "session_expired_duration": 3600, "max_tokens": 1000, "temperature": 0.9, "proxy": "", "openai_api_base": "https://YOUR_DEPLOY_NAME.openai.azure.com/", "create_image_size": "256x256", "create_image_prefix": ["draw", "paint", "imagine"], "clear_current_session_command": "#clear session", "clear_all_sessions_command": "#clear all sessions", "chat_group_session_independent": false, "single_chat_prefix": ["bot", "@bot"], "query_key_command": "#query key", "recent_days": 5, "plugins": [{ "name": "tiktok", "command": "#tiktok" }] }

I'm not a professional coder, I can only read a little, so I can't do that myself. I bold the parameters that set the azure api endpoint. My endpoint is like this https://YOUR_DEPLOY_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOY_ID/chat/completions?api-version=2023-03-15-preview