Heuristic: does the upstream error body indicate a model-level problem?
(content: bytes)
| 1901 | |
| 1902 | |
| 1903 | def _is_model_error(content: bytes) -> bool: |
| 1904 | """Heuristic: does the upstream error body indicate a model-level problem?""" |
| 1905 | try: |
| 1906 | text = content.decode("utf-8", errors="replace").lower() |
| 1907 | return any(p in text for p in _MODEL_ERROR_PATTERNS) |
| 1908 | except Exception: # noqa: BLE001 |
| 1909 | return False |
| 1910 | |
| 1911 | |
| 1912 | def _truncate_diagnostic_text(text: str, limit: int = 240) -> str: |
no outgoing calls