50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Report PixelRAG VLM route/model readiness."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
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.pixelrag_vlm_route_readiness_service import ( # noqa: E402
|
|
build_pixelrag_vlm_route_readiness,
|
|
)
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(
|
|
description="讀回 PixelRAG VLM approved Ollama route / model readiness。"
|
|
)
|
|
parser.add_argument("--model", help="要檢查的 configured VLM model。")
|
|
parser.add_argument(
|
|
"--timeout",
|
|
type=int,
|
|
default=3,
|
|
help="/api/tags probe timeout 秒數。",
|
|
)
|
|
parser.add_argument(
|
|
"--include-models",
|
|
action="store_true",
|
|
help="輸出每個 host 的 model list。",
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
payload = build_pixelrag_vlm_route_readiness(
|
|
model=args.model,
|
|
timeout_seconds=args.timeout,
|
|
include_models=args.include_models,
|
|
)
|
|
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())
|