@core-ai/openai 0.7.1 → 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.
|
@@ -67,9 +67,15 @@ var openaiCompatProviderOptionsSchema = openaiCompatGenerateProviderOptionsSchem
|
|
|
67
67
|
import OpenAI from "openai";
|
|
68
68
|
|
|
69
69
|
// src/openai-error.ts
|
|
70
|
-
import { APIError } from "openai";
|
|
71
|
-
import { ProviderError } from "@core-ai/core-ai";
|
|
70
|
+
import { APIError, APIUserAbortError } from "openai";
|
|
71
|
+
import { AbortedError, ProviderError } from "@core-ai/core-ai";
|
|
72
|
+
function isOpenAIAbortError(error) {
|
|
73
|
+
return error instanceof APIUserAbortError || error instanceof Error && error.name === "AbortError";
|
|
74
|
+
}
|
|
72
75
|
function wrapOpenAIError(error) {
|
|
76
|
+
if (isOpenAIAbortError(error)) {
|
|
77
|
+
return new AbortedError(error, "openai");
|
|
78
|
+
}
|
|
73
79
|
if (error instanceof APIError) {
|
|
74
80
|
return new ProviderError(error.message, "openai", error.status, error);
|
|
75
81
|
}
|
|
@@ -509,7 +515,7 @@ function toOpenAIReasoningEffort(effort) {
|
|
|
509
515
|
}
|
|
510
516
|
|
|
511
517
|
// src/shared/utils.ts
|
|
512
|
-
import {
|
|
518
|
+
import { ValidationError } from "@core-ai/core-ai";
|
|
513
519
|
function safeParseJsonObject(json) {
|
|
514
520
|
try {
|
|
515
521
|
const parsed = JSON.parse(json);
|
|
@@ -537,8 +543,9 @@ function validateOpenAIReasoningConfig(modelId, options) {
|
|
|
537
543
|
if (value === void 0) {
|
|
538
544
|
continue;
|
|
539
545
|
}
|
|
540
|
-
throw new
|
|
546
|
+
throw new ValidationError(
|
|
541
547
|
`OpenAI model "${modelId}" does not support ${name} when reasoning is enabled`,
|
|
548
|
+
void 0,
|
|
542
549
|
"openai"
|
|
543
550
|
);
|
|
544
551
|
}
|
package/dist/compat.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
transformStructuredOutputStream,
|
|
16
16
|
validateOpenAIReasoningConfig,
|
|
17
17
|
wrapOpenAIError
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-6CVAAVYM.js";
|
|
19
19
|
|
|
20
20
|
// src/compat/chat-model.ts
|
|
21
21
|
import { createObjectStream, createChatStream } from "@core-ai/core-ai";
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
transformStructuredOutputStream,
|
|
20
20
|
validateOpenAIReasoningConfig,
|
|
21
21
|
wrapOpenAIError
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-6CVAAVYM.js";
|
|
23
23
|
|
|
24
24
|
// src/chat-model.ts
|
|
25
25
|
import { createObjectStream, createChatStream } from "@core-ai/core-ai";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@core-ai/openai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "OpenAI provider package for @core-ai/core-ai",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Omnifact (https://omnifact.ai)",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"test:watch": "vitest"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@core-ai/core-ai": "^0.
|
|
49
|
+
"@core-ai/core-ai": "^0.8.0",
|
|
50
50
|
"openai": "^6.1.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|