Spaces:
Sleeping
Sleeping
Download scripts/check_providers.py from Shanmuk4622/autosource: direct link, hf CLI and curl.
- Browser
- Download file 785 Bytes
-
https://huggingface.co/spaces/Shanmuk4622/autosource/resolve/main/scripts/check_providers.py
- Command line
-
hf download hf://spaces/Shanmuk4622/autosource/scripts/check_providers.py
-
curl -L -o check_providers.py https://huggingface.co/spaces/Shanmuk4622/autosource/resolve/main/scripts/check_providers.py
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()) | |