LLM sometimes generates incorrect Markdown strings, need to improve parse_args logic
まだ誰も着手していません。
評価
調査の方向性
示されている extract_codeblock のロジックから始め、exec_shell の前にバッククォートが2つしかない不正な Markdown 応答を再現します。この応答に必要なパーサーの動作を特定し、その後、有効なコードブロックが引き続き機能し、不正なコマンドが "No API call found" エラーを生成しなくなることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
LLM(I am using GPT-4-mini with Openrouter) sometimes generates commands like this:
8 │ │ {
1 │ │ │ "role": "assistant",
2 │ │ │ "content": "``exec_shell(\"kubectl get pods -n test-social-network\")```"
3 │ │ },
4 │ │ {
5 │ │ │ "role": "env",
6 │ │ │ "content": "Error parsing response: No API call found!"
7 │ │ },
Notice that there are only 2 ticks before the exec_shell. It repeats the same mistake for the entire run.
The logic for extracting code block:
def extract_codeblock(self, response: str) -> str:
"""Extract a markdown code block from a string.
Args:
response (str): The response string.
Returns:
str: The extracted code block.
"""
outputlines = response.split("\n")
indexlines = [i for i, line in enumerate(outputlines) if "```" in line]
if len(indexlines) < 2:
return ""
return "\n".join(outputlines[indexlines[0] + 1 : indexlines[1]])
The function will return an empty string from the above command, thus "No API call" error.
It does not always happen.
Instead of additional prompting, it is more robust to address this issue on the parser side.
- 主要言語
- Python
- スター
- 989
- フォーク
- 176
- 平均マージ
- 7日 15時間
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/AIOpsLab のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
microsoft/AIOpsLab の issue をすべて見る
似ている issue
-
area: harness bug status: needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Human-Agent-Society/reef#625 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
learningequality/kolibri#15351 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Name consistency オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
eellak/triplestore#65 · コメント 1 件 ·