autosource / scripts /check_providers.py
Shanmuk4622's picture
deploy fully live isolated AutoSource demo
481fc97 verified
Raw
History Blame Contribute Delete
785 Bytes
"""Ping configured model providers without printing secret values."""
from __future__ import annotations
from core.router import _PROVIDER_CLASSES
def main() -> int:
failures = 0
for name, provider_class in _PROVIDER_CLASSES.items():
try:
provider = provider_class()
provider.chat(
"Reply with JSON only.",
[{"role": "user", "content": 'Reply exactly {"ok": true}'}],
0.1,
True,
)
print(f"{name}: OK")
except Exception as exc: # noqa: BLE001 - diagnostic command
failures += 1
print(f"{name}: FAILED ({type(exc).__name__}: {str(exc)[:240]})")
return failures
if __name__ == "__main__":
raise SystemExit(main())