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

[Request] 根据 Azure OpenAI 实际的Deployment情况在聊天窗口列出/支持对应的 Model #1056

Closed
linjungz opened this issue Jan 15, 2024 · 8 comments · Fixed by #1916
Labels
Inactive No response in 30 days | 超过 30 天未活跃 Model Provider 模型服务商 released

Comments

@linjungz
Copy link

🥰 需求描述

目前使用 Azure OpenAI 的 API,要求 Azure 上 Deployment 的命名与模型名称一致,但某些情况下Deployment可能命名无法与模型名称一致(可能是正在被使用,无法删除等)

另外在聊天窗口中,切换模型时,所有的LobeChat支持的模型都会被列出来,但在Azure上管理员并不一定会创建对应的 deployment,因此在聊天时,有可能会选中Azure上并未部署的模型,而导致API调用出错

🧐 解决方案

希望根据在Azure OpenAI 实际的Deployment情况,在聊天窗口列出/支持对应的 Model
是否可以考虑在配置API KEY/ENDPOINT时,增加一个Model与Deployment 的映射关系,举例如下:

//Model-Name=Deployment
gpt-4-1106-preview=gpt-4-1106-preview-deployment-name
gpt-4-vision-preview=gpt-4-vision-preview-deployment-name

这个映射关系里没有列出的模型,在聊天窗口中就不进行显示,以免用户选择后调用API会报 Deployment 不存在的错误

📝 补充信息

LobeChat是非常优秀的项目,我这边一直在寻找比较合适的多模态的聊天框架来做为Azure OpenAI的应用程序,因此非常希望能够参与到项目中,完善对Azure OpenAI的支持。 但我对前端/Next.js不熟悉,如果可以的话可以给我一些提示,我这边会尝试来做修改,看看是否能够完善这些功能

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


🥰 Description of requirements

Currently using the API of Azure OpenAI, it is required that the name of the Deployment on Azure is consistent with the model name. However, in some cases, the Deployment name may not be consistent with the model name (it may be in use, cannot be deleted, etc.)

In addition, in the chat window, when switching models, all models supported by LobeChat will be listed. However, the administrator will not necessarily create the corresponding deployment on Azure, so when chatting, it may be selected and not deployed on Azure. model, causing API call errors

🧐 Solution

It is hoped that based on the actual deployment situation in Azure OpenAI, the corresponding Model will be listed/supported in the chat window
Is it possible to consider adding a mapping relationship between Model and Deployment when configuring API KEY/ENDPOINT, for example:

//Model-Name=Deployment
gpt-4-1106-preview=gpt-4-1106-preview-deployment-name
gpt-4-vision-preview=gpt-4-vision-preview-deployment-name

Models that are not listed in this mapping relationship will not be displayed in the chat window to prevent the user from calling the API after selecting and reporting an error that Deployment does not exist.

📝 Supplementary information

LobeChat is a very excellent project. I have been looking for a more suitable multi-modal chat framework as an application for Azure OpenAI, so I very much hope to participate in the project and improve support for Azure OpenAI. But I am not familiar with front-end/Next.js. If you can, you can give me some tips. I will try to make modifications to see if these functions can be improved.

@lobehubbot
Copy link
Member

👀 @linjungz

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@arvinxx
Copy link
Contributor

arvinxx commented Jan 15, 2024

目前使用 Azure OpenAI 的 API,要求 Azure 上 Deployment 的命名与模型名称一致,但某些情况下Deployment可能命名无法与模型名称一致(可能是正在被使用,无法删除等)

想必这么做的原因你应该已经看过了,我们会在 #737 里完全解决这个问题。


另外在聊天窗口中,切换模型时,所有的LobeChat支持的模型都会被列出来,但在Azure上管理员并不一定会创建对应的 deployment,因此在聊天时,有可能会选中Azure上并未部署的模型,而导致API调用出错

这个复杂度很高,我之前调研过 (#178 ):

同时 @azure/openai 目前并不支持 模型查询,如果要接入模型 list,需要再接入 Azure 认知服务 的另外一个SDK。


是否可以考虑在配置API KEY/ENDPOINT时,增加一个Model与Deployment 的映射关系

你说的这个方案,目前应该是支持的,可以看看文档是否满足你的需求:https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN#custom_models

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Currently, the API of Azure OpenAI requires that the Deployment name on Azure be consistent with the model name. However, in some cases, the Deployment name may not be consistent with the model name (it may be in use, cannot be deleted, etc.)

You must have seen the reason for this, and we will fully solve this problem in #737.

In addition, in the chat window, when switching models, all models supported by LobeChat will be listed. However, the administrator will not necessarily create the corresponding deployment on Azure. Therefore, when chatting, there may be selected models that are not supported on Azure. Deployed model, resulting in API call error

This is very complex. I have investigated it before.

At the same time, @azure/openai currently does not support Model Query. If you want to access the model list, you need to access [Azure Recognition] Another SDK of cognitive services](https://learn.microsoft.com/zh-cn/rest/api/cognitiveservices/accountmanagement/accounts/list-models?tabs=HTTP).

Is it possible to consider adding a mapping relationship between Model and Deployment when configuring API KEY/ENDPOINT?

The solution you mentioned should be supported currently. You can check whether the document meets your needs: https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN#custom_models

@arvinxx arvinxx added the Model Provider 模型服务商 label Jan 23, 2024
@xubing613
Copy link

image
image
这里缺少了deployment_name的变量. 希望能加上

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


image
image
The deployment_name variable is missing here. I hope it can be added

@lobehubbot lobehubbot added the Inactive No response in 30 days | 超过 30 天未活跃 label Feb 26, 2024
@lobehubbot
Copy link
Member

@linjungz

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

@lobehubbot
Copy link
Member

🎉 This issue has been resolved in version 0.147.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Inactive No response in 30 days | 超过 30 天未活跃 Model Provider 模型服务商 released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants