Skip to content

是否有计划支持模型的智能(动态)路由? #1996

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

Open
zukadong opened this issue Apr 1, 2025 · 2 comments
Open

是否有计划支持模型的智能(动态)路由? #1996

zukadong opened this issue Apr 1, 2025 · 2 comments
Assignees

Comments

@zukadong
Copy link

zukadong commented Apr 1, 2025

Why do you need it?

Is your feature request related to a problem? Please describe in details

客户端请求的时候,model字段是"auto",或者其他自定义的值。

插件解析配置(随机,延迟,价格,吞吐,等)策略,去选择合适的模型

How could it be?

A clear and concise description of what you want to happen. You can explain more about input of the feature, and output of it.

Other related information

Add any other context or screenshots about the feature request here.

@johnlanni
Copy link
Collaborator

有计划的

cc @rinfx

@zzzzaaa-000
Copy link

你的问题描述是:

客户端请求时,model字段为"auto"或自定义值
插件需要解析配置(比如随机、延迟、价格、吞吐等策略),选择合适的模型
你想知道**怎么实现这种“自动模型选择”**的功能
下面是详细的问题分析和解决思路:

  1. 为什么需要这个功能?(Why do you need it?)
    用户体验简化:客户端只需填写"auto"或自定义值,无需了解所有模型细节。
    资源优化:根据不同策略选择最合适的模型,提升效率、控制成本。
    灵活扩展:后端可以根据负载、价格、响应延迟等灵活切换模型。

  2. 需求描述(Is your feature request related to a problem?)
    问题点
    当前客户端传来的model字段可能是"auto",也可能是自定义的,比如"fastest"、"cheapest"等。后端需要根据实际策略(比如负载、价格、响应速度等)自动选择最终要用的模型。

  3. 解决方案思路(How could it be?)
    输入
    客户端传递的model字段可能是:“auto”、“fastest”、“cheapest”、"best_quality"等,或者某个真实模型名。
    处理流程
    判断model字段内容

如果是具体模型名,直接使用。
如果是"auto"或自定义别名,进入模型选择逻辑。
模型选择逻辑(核心)

预先定义好各种策略配置,比如:
auto:随机或负载均衡方式选一个模型
fastest:选择延迟最低的模型
cheapest:选择价格最低的模型
best_quality:选择质量最高的模型
策略可以通过配置文件或数据库管理,方便动态调整。
需要有一个模型能力与特征的注册表,比如每个模型的价格、预估延迟、吞吐量等。
输出

返回最终选择的模型名,供实际请求使用。
具体回复在我的AI https://code.mayoubang.cn/conversion/share/86085461612

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

4 participants