feat(ai): verify RAG and Nemotron runtime canaries
Some checks are pending
CD Pipeline / deploy (push) Waiting to run
Some checks are pending
CD Pipeline / deploy (push) Waiting to run
This commit is contained in:
52
scripts/ops/run_nemotron_decision_canary.py
Normal file
52
scripts/ops/run_nemotron_decision_canary.py
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Read or execute the bounded NemoTron decision-only runtime canary."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import contextlib
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from services.nemotron_decision_canary_service import ( # noqa: E402
|
||||
run_nemotron_decision_canary,
|
||||
)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="執行 NemoTron 模型決策但不執行工具、不寫資料庫的受控 canary。"
|
||||
)
|
||||
parser.add_argument("--output-root")
|
||||
parser.add_argument("--timeout-sec", type=int)
|
||||
parser.add_argument("--execute", action="store_true")
|
||||
parser.add_argument("--write-receipt", action="store_true")
|
||||
parser.add_argument("--trace-id")
|
||||
parser.add_argument("--run-id")
|
||||
parser.add_argument(
|
||||
"--work-item-id",
|
||||
default="AI-RUNTIME-NEMOTRON-CANARY-001",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
with contextlib.redirect_stdout(sys.stderr):
|
||||
payload = run_nemotron_decision_canary(
|
||||
output_root=args.output_root,
|
||||
execute=args.execute,
|
||||
write_receipt=bool(args.execute and args.write_receipt),
|
||||
timeout_sec=args.timeout_sec,
|
||||
trace_id=args.trace_id,
|
||||
run_id=args.run_id,
|
||||
work_item_id=args.work_item_id,
|
||||
)
|
||||
print(json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True))
|
||||
return 0 if payload.get("success") else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user