@core-ai/mistral 0.7.0 → 0.8.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 +10 -16
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -11,7 +11,11 @@ import {
11
11
  } from "@core-ai/core-ai";
12
12
 
13
13
  // src/chat-adapter.ts
14
- import { zodSchemaToJsonSchema } from "@core-ai/core-ai";
14
+ import {
15
+ asObject,
16
+ safeParseJsonObject,
17
+ zodSchemaToJsonSchema
18
+ } from "@core-ai/core-ai";
15
19
 
16
20
  // src/provider-options.ts
17
21
  import { z } from "zod";
@@ -510,25 +514,15 @@ function toObject(value) {
510
514
  }
511
515
  return asObject(value);
512
516
  }
513
- function safeParseJsonObject(json) {
514
- try {
515
- const parsed = JSON.parse(json);
516
- return asObject(parsed);
517
- } catch {
518
- return {};
519
- }
520
- }
521
- function asObject(value) {
522
- if (value && typeof value === "object" && !Array.isArray(value)) {
523
- return value;
524
- }
525
- return {};
526
- }
527
517
 
528
518
  // src/mistral-error.ts
519
+ import { RequestAbortedError } from "@mistralai/mistralai/models/errors/httpclienterrors";
529
520
  import { MistralError } from "@mistralai/mistralai/models/errors";
530
- import { ProviderError } from "@core-ai/core-ai";
521
+ import { AbortedError, ProviderError } from "@core-ai/core-ai";
531
522
  function wrapMistralError(error) {
523
+ if (error instanceof RequestAbortedError || error instanceof Error && error.name === "AbortError") {
524
+ return new AbortedError(error, "mistral");
525
+ }
532
526
  if (error instanceof MistralError) {
533
527
  return new ProviderError(
534
528
  error.message,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@core-ai/mistral",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Mistral provider package for @core-ai/core-ai",
5
5
  "license": "MIT",
6
6
  "author": "Omnifact (https://omnifact.ai)",
@@ -41,7 +41,7 @@
41
41
  "test:watch": "vitest"
42
42
  },
43
43
  "dependencies": {
44
- "@core-ai/core-ai": "^0.7.0",
44
+ "@core-ai/core-ai": "^0.8.0",
45
45
  "@mistralai/mistralai": "^1.14.0"
46
46
  },
47
47
  "peerDependencies": {