@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
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -14,7 +14,6 @@ declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<
|
|
|
14
14
|
store?: boolean | undefined;
|
|
15
15
|
metadata?: Record<string, string> | undefined;
|
|
16
16
|
prediction?: Record<string, any> | undefined;
|
|
17
|
-
structuredOutputs?: boolean | undefined;
|
|
18
17
|
serviceTier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
19
18
|
strictJsonSchema?: boolean | undefined;
|
|
20
19
|
textVerbosity?: "low" | "medium" | "high" | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<
|
|
|
14
14
|
store?: boolean | undefined;
|
|
15
15
|
metadata?: Record<string, string> | undefined;
|
|
16
16
|
prediction?: Record<string, any> | undefined;
|
|
17
|
-
structuredOutputs?: boolean | undefined;
|
|
18
17
|
serviceTier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
19
18
|
strictJsonSchema?: boolean | undefined;
|
|
20
19
|
textVerbosity?: "low" | "medium" | "high" | undefined;
|
package/dist/index.js
CHANGED
|
@@ -463,12 +463,6 @@ var openaiChatLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
463
463
|
* Parameters for prediction mode.
|
|
464
464
|
*/
|
|
465
465
|
prediction: import_v43.z.record(import_v43.z.string(), import_v43.z.any()).optional(),
|
|
466
|
-
/**
|
|
467
|
-
* Whether to use structured outputs.
|
|
468
|
-
*
|
|
469
|
-
* @default true
|
|
470
|
-
*/
|
|
471
|
-
structuredOutputs: import_v43.z.boolean().optional(),
|
|
472
466
|
/**
|
|
473
467
|
* Service tier for the request.
|
|
474
468
|
* - 'auto': Default service tier. The request will be processed with the service tier configured in the
|
|
@@ -483,7 +477,7 @@ var openaiChatLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
483
477
|
/**
|
|
484
478
|
* Whether to use strict JSON schema validation.
|
|
485
479
|
*
|
|
486
|
-
* @default
|
|
480
|
+
* @default true
|
|
487
481
|
*/
|
|
488
482
|
strictJsonSchema: import_v43.z.boolean().optional(),
|
|
489
483
|
/**
|
|
@@ -522,7 +516,6 @@ var import_provider2 = require("@ai-sdk/provider");
|
|
|
522
516
|
function prepareChatTools({
|
|
523
517
|
tools,
|
|
524
518
|
toolChoice,
|
|
525
|
-
structuredOutputs,
|
|
526
519
|
strictJsonSchema
|
|
527
520
|
}) {
|
|
528
521
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -540,7 +533,7 @@ function prepareChatTools({
|
|
|
540
533
|
name: tool.name,
|
|
541
534
|
description: tool.description,
|
|
542
535
|
parameters: tool.inputSchema,
|
|
543
|
-
strict:
|
|
536
|
+
strict: strictJsonSchema
|
|
544
537
|
}
|
|
545
538
|
});
|
|
546
539
|
break;
|
|
@@ -609,24 +602,16 @@ var OpenAIChatLanguageModel = class {
|
|
|
609
602
|
toolChoice,
|
|
610
603
|
providerOptions
|
|
611
604
|
}) {
|
|
612
|
-
var _a, _b, _c
|
|
605
|
+
var _a, _b, _c;
|
|
613
606
|
const warnings = [];
|
|
614
607
|
const openaiOptions = (_a = await (0, import_provider_utils5.parseProviderOptions)({
|
|
615
608
|
provider: "openai",
|
|
616
609
|
providerOptions,
|
|
617
610
|
schema: openaiChatLanguageModelOptions
|
|
618
611
|
})) != null ? _a : {};
|
|
619
|
-
const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
|
|
620
612
|
if (topK != null) {
|
|
621
613
|
warnings.push({ type: "unsupported", feature: "topK" });
|
|
622
614
|
}
|
|
623
|
-
if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !structuredOutputs) {
|
|
624
|
-
warnings.push({
|
|
625
|
-
type: "unsupported",
|
|
626
|
-
feature: "responseFormat",
|
|
627
|
-
details: "JSON response format schema is only supported with structuredOutputs"
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
615
|
const { messages, warnings: messageWarnings } = convertToOpenAIChatMessages(
|
|
631
616
|
{
|
|
632
617
|
prompt,
|
|
@@ -634,7 +619,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
634
619
|
}
|
|
635
620
|
);
|
|
636
621
|
warnings.push(...messageWarnings);
|
|
637
|
-
const strictJsonSchema = (
|
|
622
|
+
const strictJsonSchema = (_b = openaiOptions.strictJsonSchema) != null ? _b : true;
|
|
638
623
|
const baseArgs = {
|
|
639
624
|
// model id:
|
|
640
625
|
model: this.modelId,
|
|
@@ -650,12 +635,12 @@ var OpenAIChatLanguageModel = class {
|
|
|
650
635
|
top_p: topP,
|
|
651
636
|
frequency_penalty: frequencyPenalty,
|
|
652
637
|
presence_penalty: presencePenalty,
|
|
653
|
-
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ?
|
|
638
|
+
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? responseFormat.schema != null ? {
|
|
654
639
|
type: "json_schema",
|
|
655
640
|
json_schema: {
|
|
656
641
|
schema: responseFormat.schema,
|
|
657
642
|
strict: strictJsonSchema,
|
|
658
|
-
name: (
|
|
643
|
+
name: (_c = responseFormat.name) != null ? _c : "response",
|
|
659
644
|
description: responseFormat.description
|
|
660
645
|
}
|
|
661
646
|
} : { type: "json_object" } : void 0,
|
|
@@ -769,7 +754,6 @@ var OpenAIChatLanguageModel = class {
|
|
|
769
754
|
} = prepareChatTools({
|
|
770
755
|
tools,
|
|
771
756
|
toolChoice,
|
|
772
|
-
structuredOutputs,
|
|
773
757
|
strictJsonSchema
|
|
774
758
|
});
|
|
775
759
|
return {
|
|
@@ -3586,7 +3570,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3586
3570
|
hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
|
|
3587
3571
|
});
|
|
3588
3572
|
warnings.push(...inputWarnings);
|
|
3589
|
-
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b :
|
|
3573
|
+
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : true;
|
|
3590
3574
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
3591
3575
|
function addInclude(key) {
|
|
3592
3576
|
if (include == null) {
|
|
@@ -5185,7 +5169,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5185
5169
|
};
|
|
5186
5170
|
|
|
5187
5171
|
// src/version.ts
|
|
5188
|
-
var VERSION = true ? "3.0.0-beta.
|
|
5172
|
+
var VERSION = true ? "3.0.0-beta.75" : "0.0.0-test";
|
|
5189
5173
|
|
|
5190
5174
|
// src/openai-provider.ts
|
|
5191
5175
|
function createOpenAI(options = {}) {
|