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

support remained RPM/TPM as part of returned info #506

Closed
cjwang666 opened this issue May 8, 2024 · 5 comments
Closed

support remained RPM/TPM as part of returned info #506

cjwang666 opened this issue May 8, 2024 · 5 comments

Comments

@cjwang666
Copy link

Feature request

refer to https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Llroa77io
new qianfan http response added two returned params "X-Ratelimit-Remaining-Requests" and "X-Ratelimit-Remaining-Tokens".
wish sdk support this feature, provide global RPM/TPM remained info.
furthermore current java implementation seems support set rpm limit by function "setRpmLimit".
I think it's useful

  1. if existed "setRpmLimit" function can control single app which call this sdk
  2. global rpm can be queried by http response returned params.

Furthermore is it possible for baidu to support user app level rpm/tpm setting, as a supplementation of user account level?

contribution or solutions

No response

@Dobiichi-Origami
Copy link
Collaborator

  1. wish sdk support this feature, provide global RPM/TPM remained info.
    由于剩余可用的请求量以及 Token 量是跟随具体调用的模型以及当前调用量而决定的,因此目前不可能将其作为一个全局变量提供出去。但是我们会考虑将这个信息保存在 ChatCompletion, Completion 等结构体中。
  2. if existed "setRpmLimit" function can control single app which call this sdk
    我们目前提供了相关的环境变量 QIANFAN_QPS_LIMIT, QIANFAN_RPM_LIMIT, QIANFAN_TPM_LIMIT 来帮助用户在全局设置限流相关的配置,也可以通过调用 get_config 获取 GlobalConfig 对象设置。

@cjwang666
Copy link
Author

wish sdk support this feature, provide global RPM/TPM remained info.
由于剩余可用的请求量以及 Token 量是跟随具体调用的模型以及当前调用量而决定的,因此目前不可能将其作为一个全局变量提供出去。但是我们会考虑将这个信息保存在 ChatCompletion, Completion 等结构体中。

这种方法对开发者来说,也是可以的。
每次调用后,能够通过API获得目前剩余的RPM/TPM

if existed "setRpmLimit" function can control single app which call this sdk
我们目前提供了相关的环境变量 QIANFAN_QPS_LIMIT, QIANFAN_RPM_LIMIT, QIANFAN_TPM_LIMIT 来帮助用户在全局设置限流相关的配置,也可以通过调用 get_config 获取 GlobalConfig 对象设置。

遇到的问题,会在多台分布式的应用服务器上,调用百度的大模型。这个时候单台机器的设置,就没有什么作用了。
目前百度TPM/RPM限制,是账号级别的,比方说普通账号可能支持300 TPM。
但是一个账号下面可能开发者会创建多个app,共享TPM/RPM。这个时候除了账号级别的TPM/RPM限制之外;有没有可能让百度支持,app级别的TPM/RPM限制。用户可以通过网页,或者API,设置app的TPM/RPM限制

@cjwang666
Copy link
Author

将"X-Ratelimit-Remaining-Requests" ,"X-Ratelimit-Remaining-Tokens",保存在 ChatCompletion, Completion 等结构体中,
->这个新feature,有上线时间计划么。SDK java 版本大概什么时候更新呢。

@Dobiichi-Origami
Copy link
Collaborator

感谢反馈。

  1. 由于未来 APP 这个粒度将会被取消,未来统一使用账号级别进行控制,因此目前没有支持以 APP 为限流控制粒度的计划。
  2. 我们已经在评审在 Python 版本中加入分布式限流工具的需求。如果这边能够更加具体的描述自己业务在分布式场景下的需求,我们很乐意对其进行评审。
  3. Java SDK 中支持带上限流信息的 feature 我们预期在下周会支持,具体以 Release 为准。

@cjwang666
Copy link
Author

  1. 取消APP这个粒度,值得商榷。对开发者来说,同一个账号下面多个APP,比一个账号对应一个APP要友好得多。
  2. 希望支持二级限流。除了账号级别,也支持更细粒度的APP为限流控制粒度。同一账号下面可能会有多个APP。如果支持APP级别的控制,加上目前的"X-Ratelimit-Remaining-Requests" ,"X-Ratelimit-Remaining-Tokens",就可以不需要分布式限流工具了,等于是百度在服务端做了这个事情。

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

2 participants