agent text2sql功能,为什么 注释上 _, msg = message_fit_in([{"role": "system", "content": prompt}, *msg], int(chat_mdl.max_length * 0.97))就不会返回sql了 #8325
Replies: 2 comments
-
|
出现这种情况的原因是 message_fit_in 负责把 prompt 和历史消息(msg)裁剪到 chat_mdl.max_length 限制内,保证输入不会超出大模型的上下文窗口。如果你注释掉这行,传给模型的消息就不会被截断,可能导致输入过长或格式不对,从而影响 LLM 返回 SQL 的能力,甚至直接导致不返回 SQL 结果(比如超长被截断、关键信息丢失等)参考。 另外,text2sql 相关功能对 prompt 变量格式也很敏感,如果 prompt 里变量(比如 {sql_thesaurus})丢失或格式不一致,也会导致 SQL 生成异常相关讨论。 建议不要注释 message_fit_in 这行,确保输入长度和格式都符合模型要求,这样才能稳定返回 SQL。 To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
@rrrrrrtrtt Hi, thanks for raising this! To help our global community and team follow along more easily, we kindly ask that all discussions be conducted in English. We’ll temporarily close this thread for now, but feel free to reopen or submit a new one in English — we’d love to help! Thank you for your understanding! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Beta Was this translation helpful? Give feedback.
All reactions