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

请问是否考虑加入Azure OpenAI ChatGPT的支持? #258

Closed
ripenedcat opened this issue Mar 30, 2023 · 6 comments
Closed

请问是否考虑加入Azure OpenAI ChatGPT的支持? #258

ripenedcat opened this issue Mar 30, 2023 · 6 comments

Comments

@ripenedcat
Copy link

ripenedcat commented Mar 30, 2023

好处则是Azure OpenAI API国内也可以访问!也可以绑定公司账单不用个人付费233..

需要涉及的一些修改目前我所知道的是URL, Model name, api version的自定义,可能还有其他,抱歉不是很专业。有一份python的sample,希望可以有所帮助。

如果有意向加入功能我可以提供测试环境。

import openai

openai.api_key = "xxx"
openai.api_base =  "https://xxx.openai.azure.com/"
openai.api_type = 'azure'
openai.api_version = '2023-03-15-preview' # this may change in the future

deployment_name='LucasGPT3' #This will correspond to the custom name you chose for your deployment when you deployed a model.


conversation=[{"role": "system", "content": "You are a helpful assistant."}]
while(True):
    user_input = input(">> ")
    conversation.append({"role": "user", "content": user_input})

    response = openai.ChatCompletion.create(
        engine=deployment_name, # The deployment name you chose when you deployed the ChatGPT or GPT-4 model.
        messages = conversation,
        temperature=0.7
    )

    conversation.append({"role": "assistant", "content": response['choices'][0]['message']['content']})
    print("\n" + response['choices'][0]['message']['content'] + "\n")
@Yidadaa
Copy link
Collaborator

Yidadaa commented Mar 31, 2023

请考虑修改 BASE_URL 环境变量达到此目的

@Yidadaa Yidadaa closed this as completed Mar 31, 2023
@edisonzf2020
Copy link

修改BASE_URL成微软的endpoint,API key修改成微软的key,不能工作。微软还需要设置其他参数

@wendayuan
Copy link

请考虑修改 BASE_URL 环境变量达到此目的

请问如何配置azure的api呢?能否举个例子,谢谢了

@Yidadaa
Copy link
Collaborator

Yidadaa commented Apr 4, 2023

@wendayuan 参考 #371

@wendayuan
Copy link

@wendayuan 参考 #371

原始链接404了

ryiann pushed a commit to ryiann/ChatGPT that referenced this issue Feb 19, 2024
* Fix [UI/UX] [Front End] [Chat] [React Warning] Debounce Function

- [+] fix(chat.tsx): include effect in useCallback dependencies
- [+] feat(chat.tsx): add cleanup function to cancel debounced call on component unmount
- [+] fix(chat.tsx): add setMsgRenderIndex to useEffect dependencies

* Fix [UI/UX] [Front End] [Chat] [React Warning] setMsgRenderIndex

- [+] refactor(chat.tsx): use useCallback for setMsgRenderIndex function
- [+] fix(chat.tsx): add type number to useState for msgRenderIndex
@goodls-cs
Copy link

重写一个API:
constructor(provider: ModelProvider = ModelProvider.GPT) {
if (provider === ModelProvider.GeminiPro) {
this.llm = new GeminiProApi();
return;
}
if (provider === ModelProvider.ChatGLM) {
this.llm = new ChatGLMApi();
return;
}
this.llm = new ChatGPTApi();
}

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

No branches or pull requests

5 participants