@core-ai/mistral 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +5 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -671,6 +671,7 @@ import {
671
671
  ContextLengthExceededError,
672
672
  ModelOverloadedError,
673
673
  ProviderError,
674
+ ProviderQuotaExceededError,
674
675
  RateLimitError,
675
676
  ServiceUnavailableError,
676
677
  asRecord,
@@ -703,6 +704,9 @@ function wrapMistralError(error) {
703
704
  ...contextLength
704
705
  });
705
706
  }
707
+ if (statusCode === 402) {
708
+ return new ProviderQuotaExceededError(message, "mistral", options);
709
+ }
706
710
  if (indicatesMistralOverload(message, statusCode)) {
707
711
  return new ModelOverloadedError(message, "mistral", options);
708
712
  }
@@ -730,7 +734,7 @@ function indicatesMistralOverload(text, statusCode) {
730
734
  if (statusCode !== void 0 && !OVERLOAD_MESSAGE_ELIGIBLE_STATUS_CODES.has(statusCode)) {
731
735
  return false;
732
736
  }
733
- return /\boverloaded\b/i.test(text);
737
+ return /\boverloaded\b/i.test(text) || /service tier capacity exceeded/i.test(text);
734
738
  }
735
739
  function getContextLengthDetails(body, message) {
736
740
  const errorMessage = resolveMistralMessageText(body?.message ?? message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@core-ai/mistral",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "Mistral provider package for @core-ai/core-ai",
5
5
  "license": "MIT",
6
6
  "author": "Omnifact (https://omnifact.ai)",
@@ -43,7 +43,7 @@
43
43
  "test:watch": "vitest"
44
44
  },
45
45
  "dependencies": {
46
- "@core-ai/core-ai": "^0.23.0",
46
+ "@core-ai/core-ai": "^0.24.0",
47
47
  "@mistralai/mistralai": "^2.4.1"
48
48
  },
49
49
  "peerDependencies": {