dify 人类中心主义-3.5节 最大令牌错误

kfgdxczn  于 1个月前  发布在  其他
关注(0)|答案(2)|浏览(34)

自检

  • 仅用于提交 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 的问题。

❌ 实际行为

  • 无响应*
uidvcgyl

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:

  • agent-thought
  • vision
  • tool-call
  • stream-tool-call
    model_properties:
    mode: chat
    context_size: 4096
    parameter_rules:
  • name: temperature
    use_template: temperature
  • name: top_p
    use_template: top_p
  • name: top_k
    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
  • name: max_tokens
    use_template: max_tokens
    required: true
    default: 4096
    min: 1
    max: 4096
  • name: response_format
    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模型。

  • 要继续与Dosu交流,请提及@dosu。*
umuewwlo

umuewwlo2#

你好,这是一个测试功能。我们在PR #6335中由@richards199999引入了这个功能。
我想我们还需要一些时间来在应用程序中使用8k个令牌。
在此期间,您可以将数字调整为4096以使事情正常运行。

相关问题