Piping certain cmd outputs to shell sage causes LiteLLM `This model does not support assistant message prefill. The conversation must end with a user message.`
还没有人认领这个 Issue。
评估
调研方向
从 ipyai/core.py 开始,检查 _shell_re 和 IPyAIExtension 的 completion 路径,然后将报告中的命令输出通过管道传给 ShellSage,以重现该故障。将请求构造和缓存行为与最小复现进行比较;当相同的管道输出能够在不出现 LiteLLM assistant-prefill 错误的情况下完成时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
diff --git a/ipyai/core.py b/ipyai/core.py
index c2e7e9e..7db83c1 100644
--- a/ipyai/core.py
+++ b/ipyai/core.py
@@ -102,7 +102,7 @@ prompt_from_lines astream_to_stdout transform_dots unload_ipython_extension""".s
_prompt_template = """{context}<user-request>{prompt}</user-request>"""
_tool_re = re.compile(r"&`(\w+)`")
_var_re = re.compile(r"\$`(\w+)`")
-_shell_re = re.compile(r"!`([^`]+)`")
+_shell_re = re.compile(r"(?<![\w`])!`([^`]+)`")
_tool_block_re = re.compile(
r"<details class='tool-usage-details'>\s*<summary>([^\n]*?)</summary>\s*```json\s*(.*?)\s*```\s*</details>", flags=re.DOTALL)
_status_attrs = "model completion_model think search code_theme log_exact".split()
@@ -788,7 +788,7 @@ class IPyAIExtension:
parts.append("</current-input>")
parts.append("\nReturn ONLY the completion text to insert immediately after the prefix."
" Do not repeat the prefix or include any explanation.")
- chat = AsyncChat(model=self.completion_model, sp=_COMPLETION_SP)
+ chat = AsyncChat(model=self.completion_model, sp=_COMPLETION_SP, cache=True)
res = await chat("\n".join(parts))
return (contents(res).content or "").strip()
Minimal repro. Piping this into shell sage leads to:
litellm.exceptions.BadRequestError: litellm.BadRequestError: AnthropicException - b'{"type":"error","error":{"type":"invalid_request_error","message":"This model does not support assistant message prefill. The conversation must end with a user message."},"request_id":"req_011CZSMPZ3QszFE6X6fwGrSC"}'
Might be a lisette issue.
- 主要语言
- Jupyter Notebook
- 星标
- 409
- 派生
- 44
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AnswerDotAI/shell_sage 的其他 Issue
-
Sassy `mode` from config file is ignored (only CLI `--mode` works)可能已有人在做 @galopyz 于 71 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
AnswerDotAI/shell_sage#97 ·
-
难度 4/5 3-5 天 新手友好度 35/100
AnswerDotAI/shell_sage#103 ·
-
难度 3/5 1-2 天 新手友好度 48/100
AnswerDotAI/shell_sage#98 ·
-
Add terminal history capture for Ghostty可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 55/100
AnswerDotAI/shell_sage#94 ·
-
难度 3/5 1-2 天 新手友好度 35/100
AnswerDotAI/shell_sage#77 · 1 条评论 ·
查看 AnswerDotAI/shell_sage 的全部 Issue
相似的 Issue
-
bug cli p3
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 3 天内回复
-
REPL and --show-tokens abort with "Token conversion not implemented yet" on .xor., byte and in out未关闭bug low priority tokenizer
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
[Bug]: Revit selector reads process ids 2000-2099 as years (flaky AgentClientTests.AYearOrAProcessIdSelectsTheHost)可能已有人在做 @Wurschdhaud 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 83/100
pyrevitlabs/pyRevit#3817 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 72/100
facebookresearch/autoform-bot#448 ·
维护者通常 1 天内回复