langchain/libs
Congyu dd5139e304
community[patch]: truncate zhipuai temperature and top_p parameters 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 <22008038+baskaryan@users.noreply.github.com>
2024-04-19 01:31:30 +00:00
..
cli templates: readme langsmith not private beta (#20173) 2024-04-12 13:08:10 -07:00
community community[patch]: truncate zhipuai temperature and top_p parameters to [0.01, 0.99] (#20261) 2024-04-19 01:31:30 +00:00
core core: deprecation default to qualname (#20578) 2024-04-18 15:35:17 -07:00
experimental experimental[patch]: prompts import fix (#20534) 2024-04-18 16:09:11 -04:00
langchain experimental[patch]: prompts import fix (#20534) 2024-04-18 16:09:11 -04:00
partners mistral[patch]: Support both model and model_name (#20557) 2024-04-18 16:12:33 -04:00
standard-tests mistral, openai: allow anthropic-style messages in message histories (#20565) 2024-04-17 15:55:45 -04:00
text-splitters text-splitters[minor]: Add lua code splitting (#20421) 2024-04-13 22:42:51 +00:00