feat(ai): automate agent integration truth and RAG canary
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
This commit is contained in:
39
scripts/ops/report_ai_agent_product_integration.py
Normal file
39
scripts/ops/report_ai_agent_product_integration.py
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Report source/runtime/product integration truth for all four AI agents."""
|
||||
|
||||
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.ai_agent_product_integration_service import ( # noqa: E402
|
||||
build_ai_agent_product_integration_readback,
|
||||
)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="輸出四個 AI Agent 的 source、runtime 與產品閉環整合實證。"
|
||||
)
|
||||
parser.add_argument("--window-hours", type=int, default=168)
|
||||
args = parser.parse_args()
|
||||
# Some legacy DB modules still print startup diagnostics. Keep stdout as a
|
||||
# strict JSON channel for automation and forward diagnostics to stderr.
|
||||
with contextlib.redirect_stdout(sys.stderr):
|
||||
payload = build_ai_agent_product_integration_readback(
|
||||
window_hours=args.window_hours,
|
||||
)
|
||||
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())
|
||||
51
scripts/ops/run_internal_rag_candidate_canary.py
Normal file
51
scripts/ops/run_internal_rag_candidate_canary.py
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Dry-run or execute the bounded internal RAG candidate 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.internal_rag_candidate_canary_service import ( # noqa: E402
|
||||
run_internal_rag_candidate_canary,
|
||||
)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="執行 PixelRAG candidate 到內部 pgvector RAG 的受控 canary。"
|
||||
)
|
||||
parser.add_argument("--candidate-knowledge-receipt-root")
|
||||
parser.add_argument("--output-root")
|
||||
parser.add_argument("--platform", action="append", dest="platforms")
|
||||
parser.add_argument("--max-age-hours", type=int, default=168)
|
||||
parser.add_argument("--limit", type=int, default=1)
|
||||
parser.add_argument("--similarity-threshold", type=float, default=0.70)
|
||||
parser.add_argument("--execute", action="store_true")
|
||||
parser.add_argument("--write-receipt", action="store_true")
|
||||
args = parser.parse_args()
|
||||
with contextlib.redirect_stdout(sys.stderr):
|
||||
payload = run_internal_rag_candidate_canary(
|
||||
candidate_knowledge_receipt_root=args.candidate_knowledge_receipt_root,
|
||||
output_root=args.output_root,
|
||||
platform=tuple(args.platforms or ()),
|
||||
max_age_hours=args.max_age_hours,
|
||||
limit=args.limit,
|
||||
similarity_threshold=args.similarity_threshold,
|
||||
execute=args.execute,
|
||||
write_receipt=bool(args.execute and args.write_receipt),
|
||||
)
|
||||
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