(exc: Exception)
| 150 | |
| 151 | |
| 152 | def _looks_like_auth_error(exc: Exception) -> bool: |
| 153 | message = str(exc or "").lower() |
| 154 | return any( |
| 155 | token in message |
| 156 | for token in ( |
| 157 | "401", |
| 158 | "unauthorized", |
| 159 | "invalid api key", |
| 160 | "incorrect api key", |
| 161 | "invalid_request_error", |
| 162 | "authentication", |
| 163 | "forbidden", |
| 164 | ) |
| 165 | ) |
| 166 | |
| 167 | |
| 168 | def _resolve_hf_provider(primary_env_name: str, fallback_env_name: str = "HF_INFERENCE_PROVIDER") -> str: |