ci: add optional AuditAI RAG quality smoke suite#2
Conversation
Scaffold dataset, mock adapter, and docs for optional faithfulness / relevancy / prompt-injection checks via AuditAI.
There was a problem hiding this comment.
Code Review
This pull request introduces an AuditAI testing scaffold, including configuration files, a mock HTTP adapter, a GitHub Actions workflow example, and a dataset of 20 test cases. The review feedback highlights two key areas for improvement: first, the questions in dataset.json are systematically truncated (ending in …?), which should be restored to their full text to prevent negative impacts on LLM evaluation metrics; second, the mock_adapter.py lacks error handling when parsing the incoming JSON request body, which could lead to server crashes if invalid payloads are received.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| }, | ||
| { | ||
| "id": "q1", | ||
| "question": "Theo tài liệu dự án, nội dung sau nói gì: Hệ thống chatbot AI hỗ trợ tra cứu và tư vấn Nghị định 168/2024/NĐ-CP và Luật Đường bộ 2024, sử dụng kiến trúc RAG (Retrieval-Augmented Gene…?", |
There was a problem hiding this comment.
Các câu hỏi trong file dataset.json đang bị cắt cụt (truncated) một cách hệ thống ở cuối câu và kết thúc bằng ký tự …? (ví dụ: Gene…?, phá…?, e…?, OA…?, yam…?, Citation…?, Xóa…?, con…?). Điều này có thể do công cụ hoặc script tự động thu thập dữ liệu bị giới hạn độ dài ký tự.
Việc câu hỏi bị cắt cụt giữa chừng không chỉ làm giảm tính chuyên nghiệp của bộ dữ liệu thử nghiệm mà còn có thể ảnh hưởng tiêu cực đến kết quả đánh giá của LLM Judge (đặc biệt là chỉ số answer_relevancy và faithfulness). Bạn nên cập nhật lại các câu hỏi này thành câu hỏi đầy đủ, không bị cắt cụt.
| def do_POST(self): | ||
| n = int(self.headers.get("Content-Length", 0)) | ||
| body = json.loads(self.rfile.read(n) or b"{}") | ||
| q = str(body.get("question") or "") |
There was a problem hiding this comment.
Trong phương thức do_POST của mock_adapter.py, việc đọc và phân tích cú pháp JSON từ request body (json.loads(self.rfile.read(n) or b"{}")) chưa được bao bọc trong khối xử lý ngoại lệ. Nếu request gửi đến chứa dữ liệu JSON không hợp lệ hoặc header Content-Length không phải là số nguyên hợp lệ, mock server sẽ ném ra ngoại lệ (json.JSONDecodeError hoặc ValueError) và bị crash hoặc phản hồi lỗi không kiểm soát.
Bạn nên bao bọc đoạn mã này trong khối try-except để trả về phản hồi 400 Bad Request một cách an toàn và giúp bộ test hoạt động ổn định hơn.
def do_POST(self):
try:
n = int(self.headers.get("Content-Length", 0))
body = json.loads(self.rfile.read(n) or b"{}")
except (ValueError, json.JSONDecodeError):
self.send_response(400)
self.end_headers()
self.wfile.write(b"Invalid JSON or Content-Length")
return
q = str(body.get("question") or "")|
Chào maintainer 👋 Mình follow-up nhẹ PR này — scaffold opt-in (dataset từ docs public + mock adapter / workflow example), không bắt buộc merge. Baseline local dùng mock target yếu + LLM-as-judge (Grok): quality metrics fail trung thực (injection pass). Ý là gate chạy được; số đẹp cần API/app thật, không greenwash. Committed config: Nếu không phù hợp repo, cứ close/request changes — mình chỉnh hoặc rút PR ngay. Cảm ơn bạn đã open-source! 🙏 |
ci: thêm AuditAI — gate chống ảo giác (RAG)
Chào bạn, dự án RAG/chatbot của bạn rất thú vị!
Mình đã chạy thử AuditAI (CLI + GitHub Action mã nguồn mở) để đánh giá chống ảo giác (hallucination) và vài kiểm tra an toàn cơ bản.
Kết quả baseline (máy local)
metric_below_threshold:faithfulness· judge calls: 38tests/auditai/auditai-out/hoặc artifact CI)PR này thêm gì?
tests/auditai/auditai.yml— cấu hình gatetests/auditai/dataset.json— ~20 câu hỏi smoke.github/workflows/auditai.yml— chạy AuditAI (mặc định có thể chỉworkflow_dispatchđể tránh tốn API bất ngờ)Từ nay mỗi lần bạn (hoặc CI) chạy workflow, pipeline sẽ tự test bảo vệ chất lượng trả lời.
Cách chạy lại
Badge (tuỳ chọn — chỉ khi bạn muốn)
Mình sẵn sàng chỉnh threshold, dataset, hoặc bỏ workflow nếu bạn chỉ muốn CLI local.
Cảm ơn bạn đã open-source! 🙏