GaiZhenbiao / ChuanhuChatGPT

GUI for ChatGPT API and many LLMs. Supports agents, file-based QA, GPT finetuning and query with web search. All with a neat UI.
https://huggingface.co/spaces/JohnSmith9982/ChuanhuChatGPT
GNU General Public License v3.0
15.07k stars 2.28k forks source link

[本地部署]: Azure OpenAI调用错误,部署报错openai_api_key为空 #1111

Closed JinchaoLove closed 2 months ago

JinchaoLove commented 2 months ago

是否已存在现有反馈与解答?

是否是一个代理配置相关的疑问?

错误描述

尝试配置Azure OpenAI,如下。但运行后仍然调用的是models/OpenAI.py, 而不是models/Azure.py,导致的报错为:openai_api_key为空

{ "openai_api_type": "azure", "azure_openai_api_key": "我的Azure OpenAI密钥", "azure_openai_api_base_url": "https://openai-pgs.openai.azure.com", "azure_openai_api_version": "2024-02-01", "azure_deployment_name": "cpii_gpt-4-0613", "azure_embedding_deployment_name": "cpii_text-embedding-ada-002", "azure_embedding_model_name": "text-embedding-ada-002", }

复现操作

如上配置config.json

错误日志

No response

运行环境

- OS: macOS 14.4.1
- Browser: Chrome
- Gradio version: 4.26.0
- Python version: 3.8.18

补充说明

No response

JinchaoLove commented 2 months ago

请问如何正确配置Azure OpenAI呢?

JinchaoLove commented 2 months ago

解决了!1. "default_model"改为"Azure OpenAI", 2. "azure_openai_api_base_url"末尾要加上"/openai", 见langchain的issue