#12625·haystack

当 output_type 是包含 str 的 Union 类型时,OutputAdapter 会默默地将字符串输出转换为其他类型。

作者: Anishithavaram-4242创建于 2026年9月5日更新于 2026年9月14日
标签P2

描述错误 OutputAdapter.run()output_typestr 时跳过 ast.literal_eval 转换,但在 output_type 是包含 str 的联合(例如 str | NoneOptional[str)时,则不进行转换。使用 output_type=str | None 声明的渲染值(例如 "42")将被默默地转换为整数 42,而不是保留为字符串 "42"。

内容来源: deepset-ai/haystack