Record an error category hit for a model.
(modelId: string, category: ErrorCategory)
| 477 | |
| 478 | /** Record an error category hit for a model. */ |
| 479 | function recordProviderError(modelId: string, category: ErrorCategory): void { |
| 480 | if (!perProviderErrors.has(modelId)) { |
| 481 | perProviderErrors.set(modelId, { |
| 482 | auth_failure: 0, |
| 483 | quota_exceeded: 0, |
| 484 | rate_limited: 0, |
| 485 | overloaded: 0, |
| 486 | server_error: 0, |
| 487 | payment_error: 0, |
| 488 | config_error: 0, |
| 489 | }); |
| 490 | } |
| 491 | perProviderErrors.get(modelId)![category]++; |
| 492 | } |
| 493 | |
| 494 | /** |
| 495 | * Check if a model is currently rate-limited (in cooldown period). |
no test coverage detected