@ai-sdk/openai 3.0.0-beta.74 → 3.0.0-beta.75
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.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +8 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -24
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +0 -1
- package/dist/internal/index.d.ts +0 -1
- package/dist/internal/index.js +7 -23
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +7 -23
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,6 @@ declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<
|
|
|
13
13
|
store?: boolean | undefined;
|
|
14
14
|
metadata?: Record<string, string> | undefined;
|
|
15
15
|
prediction?: Record<string, any> | undefined;
|
|
16
|
-
structuredOutputs?: boolean | undefined;
|
|
17
16
|
serviceTier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
18
17
|
strictJsonSchema?: boolean | undefined;
|
|
19
18
|
textVerbosity?: "low" | "medium" | "high" | undefined;
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<
|
|
|
13
13
|
store?: boolean | undefined;
|
|
14
14
|
metadata?: Record<string, string> | undefined;
|
|
15
15
|
prediction?: Record<string, any> | undefined;
|
|
16
|
-
structuredOutputs?: boolean | undefined;
|
|
17
16
|
serviceTier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
18
17
|
strictJsonSchema?: boolean | undefined;
|
|
19
18
|
textVerbosity?: "low" | "medium" | "high" | undefined;
|
package/dist/internal/index.js
CHANGED
|
@@ -490,12 +490,6 @@ var openaiChatLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
490
490
|
* Parameters for prediction mode.
|
|
491
491
|
*/
|
|
492
492
|
prediction: import_v43.z.record(import_v43.z.string(), import_v43.z.any()).optional(),
|
|
493
|
-
/**
|
|
494
|
-
* Whether to use structured outputs.
|
|
495
|
-
*
|
|
496
|
-
* @default true
|
|
497
|
-
*/
|
|
498
|
-
structuredOutputs: import_v43.z.boolean().optional(),
|
|
499
493
|
/**
|
|
500
494
|
* Service tier for the request.
|
|
501
495
|
* - 'auto': Default service tier. The request will be processed with the service tier configured in the
|
|
@@ -510,7 +504,7 @@ var openaiChatLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
510
504
|
/**
|
|
511
505
|
* Whether to use strict JSON schema validation.
|
|
512
506
|
*
|
|
513
|
-
* @default
|
|
507
|
+
* @default true
|
|
514
508
|
*/
|
|
515
509
|
strictJsonSchema: import_v43.z.boolean().optional(),
|
|
516
510
|
/**
|
|
@@ -549,7 +543,6 @@ var import_provider2 = require("@ai-sdk/provider");
|
|
|
549
543
|
function prepareChatTools({
|
|
550
544
|
tools,
|
|
551
545
|
toolChoice,
|
|
552
|
-
structuredOutputs,
|
|
553
546
|
strictJsonSchema
|
|
554
547
|
}) {
|
|
555
548
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -567,7 +560,7 @@ function prepareChatTools({
|
|
|
567
560
|
name: tool.name,
|
|
568
561
|
description: tool.description,
|
|
569
562
|
parameters: tool.inputSchema,
|
|
570
|
-
strict:
|
|
563
|
+
strict: strictJsonSchema
|
|
571
564
|
}
|
|
572
565
|
});
|
|
573
566
|
break;
|
|
@@ -636,24 +629,16 @@ var OpenAIChatLanguageModel = class {
|
|
|
636
629
|
toolChoice,
|
|
637
630
|
providerOptions
|
|
638
631
|
}) {
|
|
639
|
-
var _a, _b, _c
|
|
632
|
+
var _a, _b, _c;
|
|
640
633
|
const warnings = [];
|
|
641
634
|
const openaiOptions = (_a = await (0, import_provider_utils5.parseProviderOptions)({
|
|
642
635
|
provider: "openai",
|
|
643
636
|
providerOptions,
|
|
644
637
|
schema: openaiChatLanguageModelOptions
|
|
645
638
|
})) != null ? _a : {};
|
|
646
|
-
const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
|
|
647
639
|
if (topK != null) {
|
|
648
640
|
warnings.push({ type: "unsupported", feature: "topK" });
|
|
649
641
|
}
|
|
650
|
-
if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !structuredOutputs) {
|
|
651
|
-
warnings.push({
|
|
652
|
-
type: "unsupported",
|
|
653
|
-
feature: "responseFormat",
|
|
654
|
-
details: "JSON response format schema is only supported with structuredOutputs"
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
642
|
const { messages, warnings: messageWarnings } = convertToOpenAIChatMessages(
|
|
658
643
|
{
|
|
659
644
|
prompt,
|
|
@@ -661,7 +646,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
661
646
|
}
|
|
662
647
|
);
|
|
663
648
|
warnings.push(...messageWarnings);
|
|
664
|
-
const strictJsonSchema = (
|
|
649
|
+
const strictJsonSchema = (_b = openaiOptions.strictJsonSchema) != null ? _b : true;
|
|
665
650
|
const baseArgs = {
|
|
666
651
|
// model id:
|
|
667
652
|
model: this.modelId,
|
|
@@ -677,12 +662,12 @@ var OpenAIChatLanguageModel = class {
|
|
|
677
662
|
top_p: topP,
|
|
678
663
|
frequency_penalty: frequencyPenalty,
|
|
679
664
|
presence_penalty: presencePenalty,
|
|
680
|
-
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ?
|
|
665
|
+
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? responseFormat.schema != null ? {
|
|
681
666
|
type: "json_schema",
|
|
682
667
|
json_schema: {
|
|
683
668
|
schema: responseFormat.schema,
|
|
684
669
|
strict: strictJsonSchema,
|
|
685
|
-
name: (
|
|
670
|
+
name: (_c = responseFormat.name) != null ? _c : "response",
|
|
686
671
|
description: responseFormat.description
|
|
687
672
|
}
|
|
688
673
|
} : { type: "json_object" } : void 0,
|
|
@@ -796,7 +781,6 @@ var OpenAIChatLanguageModel = class {
|
|
|
796
781
|
} = prepareChatTools({
|
|
797
782
|
tools,
|
|
798
783
|
toolChoice,
|
|
799
|
-
structuredOutputs,
|
|
800
784
|
strictJsonSchema
|
|
801
785
|
});
|
|
802
786
|
return {
|
|
@@ -3881,7 +3865,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3881
3865
|
hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
|
|
3882
3866
|
});
|
|
3883
3867
|
warnings.push(...inputWarnings);
|
|
3884
|
-
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b :
|
|
3868
|
+
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : true;
|
|
3885
3869
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
3886
3870
|
function addInclude(key) {
|
|
3887
3871
|
if (include == null) {
|