Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

LLM sometimes generates incorrect Markdown strings, need to improve parse_args logic

Đang mở
#81 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu với logic extract_codeblock được hiển thị và tái hiện phản hồi Markdown không hợp lệ chỉ chứa hai backtick trước exec_shell. Xác định hành vi của parser cần thiết cho phản hồi này, sau đó xác minh rằng các khối mã hợp lệ vẫn hoạt động và lệnh không hợp lệ không còn tạo ra lỗi "No API call found".

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
989
Fork
176
Merge trung bình
7 ngày 15 giờ
Pull request đã merge (30 ngày)
3

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/AIOpsLab

Tất cả issue của microsoft/AIOpsLab

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.