添加chatgpt 调用代理设置
This commit is contained in:
parent
d79676cad1
commit
37454db3ec
|
|
@ -75,10 +75,15 @@ llm_model_dict = {
|
|||
# urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000001FE4BDB85E0>:
|
||||
# Failed to establish a new connection: [WinError 10060]
|
||||
# 则是因为内地和香港的IP都被OPENAI封了,需要切换为日本、新加坡等地
|
||||
|
||||
# 如果出现WARNING: Retrying langchain.chat_models.openai.acompletion_with_retry.<locals>._completion_with_retry in
|
||||
# 4.0 seconds as it raised APIConnectionError: Error communicating with OpenAI.
|
||||
# 需要添加代理访问(正常开的代理软件可能会拦截不上)需要设置配置openai_proxy 或者 使用环境遍历OPENAI_PROXY 进行设置
|
||||
"gpt-3.5-turbo": {
|
||||
"local_model_path": "gpt-3.5-turbo",
|
||||
"api_base_url": "https://api.openai.com/v1",
|
||||
"api_key": os.environ.get("OPENAI_API_KEY")
|
||||
"api_key": os.environ.get("OPENAI_API_KEY"),
|
||||
"openai_proxy": os.environ.get("OPENAI_PROXY")
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ def chat(query: str = Body(..., description="用户输入", examples=["恼羞成
|
|||
callbacks=[callback],
|
||||
openai_api_key=llm_model_dict[LLM_MODEL]["api_key"],
|
||||
openai_api_base=llm_model_dict[LLM_MODEL]["api_base_url"],
|
||||
model_name=LLM_MODEL
|
||||
model_name=LLM_MODEL,
|
||||
openai_proxy=llm_model_dict[LLM_MODEL].get("openai_proxy")
|
||||
)
|
||||
|
||||
chat_prompt = ChatPromptTemplate.from_messages(
|
||||
|
|
|
|||
Loading…
Reference in New Issue