自检
- 仅用于提交 bug 报告,如果您想提问,请前往 Discussions 。
- 我已在 search for existing issues 中搜索了现有问题,包括已关闭的问题。
- 我确认我使用英文提交此报告(我已阅读并同意 Language Policy )。
- 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- 请不要修改此模板 :) 并填写所有必需的字段。
Dify 版本
0.6.15
云服务或自托管服务
云服务,自托管服务(Docker)
重现步骤
eewest 版本 Dify 和云版本 0.6.15 存在一个 bug,即在使用 anthropic-sonnet3.5 模型时会报告 "[anthropic]Bad Request Error,Error code:400-[type' invalid request error [ message : max tokens 8192> 4096,which is the maximum allowed number of output tokens for claude-3-5-sonnet-20240620)]",我发现 0.6.15 版本中的文件 claude-3-5-sonnet-20240620.yaml 中的 max token 设置错误,而之前的版本 0.6.14 是正确的,请修复它。
✔️ 预期行为
修复可以在云中使用 claude3.5 sonata 的问题。
❌ 实际行为
- 无响应*
2条答案
按热度按时间uidvcgyl1#
你好!我在这里协助你解决bug、回答问题并成为贡献者。让我们一起解决你遇到的任何问题。
要修复
claude-3-5-sonnet-20240620.yaml
文件中不正确的max_tokens
设置,你需要将model_properties
下的context_size
调整为一个更合适的值。当前的200000
设置可能不正确。根据max_tokens
参数,一个更合理的context_size
应该是4096
。这是修正后的YAML配置:
model: claude-3-5-sonnet-20240620
label:
en_US: claude-3-5-sonnet-20240620
model_type: llm
features:
model_properties:
mode: chat
context_size: 4096
parameter_rules:
use_template: temperature
use_template: top_p
label:
zh_Hans: 取样数量
en_US: Top k
type: int
help:
zh_Hans: 仅从每个后续标记的前 K 个选项中采样。
en_US: Only sample from the top K options for each subsequent token.
required: false
use_template: max_tokens
required: true
default: 4096
min: 1
max: 4096
use_template: response_format
pricing:
input: '3.00'
output: '15.00'
unit: '0.000001'
currency: USD
这应该解决问题,并允许在云1(https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/vertex_ai/llm/anthropic.claude-3.5-sonnet.yaml)2(https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/anthropic/llm/claude-3-5-sonnet-20240620.yaml)中正确使用
claude3.5 sonnet
模型。umuewwlo2#
你好,这是一个测试功能。我们在PR #6335中由@richards199999引入了这个功能。
我想我们还需要一些时间来在应用程序中使用8k个令牌。
在此期间,您可以将数字调整为4096以使事情正常运行。