-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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
community[patch]: truncate zhipuai temperature
and top_p
parameters to [0.01, 0.99]
#20261
community[patch]: truncate zhipuai temperature
and top_p
parameters to [0.01, 0.99]
#20261
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
This PR follows up #16695 |
temperature
and top_p
parameters to [0.01, 0.99]temperature
and top_p
parameters to [0.01, 0.99]
Got the lint fixed. |
Looks like the workflows needs approval too. Thx. |
Head branch was pushed to by a user without write access
"""Truncate temperature and top_p parameters between [0.01, 0.99]. | ||
|
||
ZhipuAI only support temperature / top_p between (0, 1) open interval, | ||
so we truncate them to [0.01, 0.99]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed typo in comment truncate
or you can use any finetune model of glm series. | ||
Alternatively, you can use any fine-tuned model from the GLM series. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix some grammar in comment too.
…rs to [0.01, 0.99] (#20261) ZhipuAI API only accepts `temperature` parameter between `(0, 1)` open interval, and if `0` is passed, it responds with status code `400`. However, 0 and 1 is often accepted by other APIs, for example, OpenAI allows `[0, 2]` for temperature closed range. This PR truncates temperature parameter passed to `[0.01, 0.99]` to improve the compatibility between langchain's ecosystem's and ZhipuAI (e.g., ragas `evaluate` often generates temperature 0, which results in a lot of 400 invalid responses). The PR also truncates `top_p` parameter since it has the same restriction. Reference: [glm-4 doc](https://open.bigmodel.cn/dev/api#glm-4) (which unfortunately is in Chinese though). --------- Co-authored-by: Bagatur <[email protected]>
ZhipuAI API only accepts
temperature
parameter between(0, 1)
open interval, and if0
is passed, it responds with status code400
.However, 0 and 1 is often accepted by other APIs, for example, OpenAI allows
[0, 2]
for temperature closed range.This PR truncates temperature parameter passed to
[0.01, 0.99]
to improve the compatibility between langchain's ecosystem's and ZhipuAI (e.g., ragasevaluate
often generates temperature 0, which results in a lot of 400 invalid responses). The PR also truncatestop_p
parameter since it has the same restriction.Reference: glm-4 doc (which unfortunately is in Chinese though).