@zenning/openai 3.0.19 → 3.0.21
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 +12 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +22 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -27
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +21 -26
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +21 -26
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -461,6 +461,7 @@ declare const openaiResponsesProviderOptionsSchema: _zenning_provider_utils.Lazy
|
|
|
461
461
|
type: "compaction";
|
|
462
462
|
encrypted_content: string;
|
|
463
463
|
}[] | undefined;
|
|
464
|
+
containsApprovalResponses?: boolean | undefined;
|
|
464
465
|
}>;
|
|
465
466
|
type OpenAIResponsesProviderOptions = InferSchema<typeof openaiResponsesProviderOptionsSchema>;
|
|
466
467
|
|
package/dist/index.d.ts
CHANGED
|
@@ -461,6 +461,7 @@ declare const openaiResponsesProviderOptionsSchema: _zenning_provider_utils.Lazy
|
|
|
461
461
|
type: "compaction";
|
|
462
462
|
encrypted_content: string;
|
|
463
463
|
}[] | undefined;
|
|
464
|
+
containsApprovalResponses?: boolean | undefined;
|
|
464
465
|
}>;
|
|
465
466
|
type OpenAIResponsesProviderOptions = InferSchema<typeof openaiResponsesProviderOptionsSchema>;
|
|
466
467
|
|
package/dist/index.js
CHANGED
|
@@ -2479,7 +2479,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2479
2479
|
hasShellTool = false,
|
|
2480
2480
|
hasApplyPatchTool = false,
|
|
2481
2481
|
compactionInput,
|
|
2482
|
-
previousResponseId
|
|
2482
|
+
previousResponseId,
|
|
2483
|
+
containsApprovalResponses
|
|
2483
2484
|
}) {
|
|
2484
2485
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2485
2486
|
const input = [];
|
|
@@ -2566,13 +2567,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2566
2567
|
switch (part.type) {
|
|
2567
2568
|
case "text": {
|
|
2568
2569
|
const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a[providerOptionsName]) == null ? void 0 : _b.itemId;
|
|
2569
|
-
if (store && id != null
|
|
2570
|
+
if (store && id != null) {
|
|
2570
2571
|
input.push({ type: "item_reference", id });
|
|
2571
2572
|
break;
|
|
2572
2573
|
}
|
|
2573
|
-
if (store && id != null && previousResponseId) {
|
|
2574
|
-
break;
|
|
2575
|
-
}
|
|
2576
2574
|
input.push({
|
|
2577
2575
|
role: "assistant",
|
|
2578
2576
|
content: [{ type: "output_text", text: part.text }],
|
|
@@ -2583,16 +2581,16 @@ async function convertToOpenAIResponsesInput({
|
|
|
2583
2581
|
case "tool-call": {
|
|
2584
2582
|
const id = (_g = (_d = (_c = part.providerOptions) == null ? void 0 : _c[providerOptionsName]) == null ? void 0 : _d.itemId) != null ? _g : (_f = (_e = part.providerMetadata) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.itemId;
|
|
2585
2583
|
if (part.providerExecuted) {
|
|
2586
|
-
if (store && id != null && !
|
|
2584
|
+
if (store && id != null && !containsApprovalResponses) {
|
|
2587
2585
|
input.push({ type: "item_reference", id });
|
|
2588
2586
|
}
|
|
2589
2587
|
break;
|
|
2590
2588
|
}
|
|
2591
|
-
if (store && id != null && !
|
|
2589
|
+
if (store && id != null && !containsApprovalResponses) {
|
|
2592
2590
|
input.push({ type: "item_reference", id });
|
|
2593
2591
|
break;
|
|
2594
2592
|
}
|
|
2595
|
-
if (store && id != null &&
|
|
2593
|
+
if (store && id != null && containsApprovalResponses) {
|
|
2596
2594
|
break;
|
|
2597
2595
|
}
|
|
2598
2596
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
@@ -2650,10 +2648,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2650
2648
|
if (part.output.type === "execution-denied" || part.output.type === "json" && typeof part.output.value === "object" && part.output.value != null && "type" in part.output.value && part.output.value.type === "execution-denied") {
|
|
2651
2649
|
break;
|
|
2652
2650
|
}
|
|
2653
|
-
if (store
|
|
2651
|
+
if (store) {
|
|
2654
2652
|
const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2655
2653
|
input.push({ type: "item_reference", id: itemId });
|
|
2656
|
-
} else if (store) {
|
|
2657
2654
|
} else {
|
|
2658
2655
|
warnings.push({
|
|
2659
2656
|
type: "other",
|
|
@@ -2671,7 +2668,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2671
2668
|
const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
|
|
2672
2669
|
if (reasoningId != null) {
|
|
2673
2670
|
const reasoningMessage = reasoningMessages[reasoningId];
|
|
2674
|
-
if (store
|
|
2671
|
+
if (store) {
|
|
2675
2672
|
if (reasoningMessage === void 0) {
|
|
2676
2673
|
input.push({ type: "item_reference", id: reasoningId });
|
|
2677
2674
|
reasoningMessages[reasoningId] = {
|
|
@@ -2680,14 +2677,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2680
2677
|
summary: []
|
|
2681
2678
|
};
|
|
2682
2679
|
}
|
|
2683
|
-
} else if (store) {
|
|
2684
|
-
if (reasoningMessage === void 0) {
|
|
2685
|
-
reasoningMessages[reasoningId] = {
|
|
2686
|
-
type: "reasoning",
|
|
2687
|
-
id: reasoningId,
|
|
2688
|
-
summary: []
|
|
2689
|
-
};
|
|
2690
|
-
}
|
|
2691
2680
|
} else {
|
|
2692
2681
|
const summaryParts = [];
|
|
2693
2682
|
if (part.text.length > 0) {
|
|
@@ -3807,7 +3796,12 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils25.lazySchem
|
|
|
3807
3796
|
type: import_v420.z.literal("compaction"),
|
|
3808
3797
|
encrypted_content: import_v420.z.string()
|
|
3809
3798
|
})
|
|
3810
|
-
).optional()
|
|
3799
|
+
).optional(),
|
|
3800
|
+
/**
|
|
3801
|
+
* Whether the request contains tool approval responses.
|
|
3802
|
+
* Defaults to `false`.
|
|
3803
|
+
*/
|
|
3804
|
+
containsApprovalResponses: import_v420.z.boolean().optional()
|
|
3811
3805
|
})
|
|
3812
3806
|
)
|
|
3813
3807
|
);
|
|
@@ -4038,7 +4032,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4038
4032
|
toolChoice,
|
|
4039
4033
|
responseFormat
|
|
4040
4034
|
}) {
|
|
4041
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4035
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4042
4036
|
const warnings = [];
|
|
4043
4037
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
4044
4038
|
if (topK != null) {
|
|
@@ -4102,10 +4096,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4102
4096
|
hasShellTool: hasOpenAITool("openai.shell"),
|
|
4103
4097
|
hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
|
|
4104
4098
|
compactionInput: openaiOptions == null ? void 0 : openaiOptions.compactionInput,
|
|
4105
|
-
previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0
|
|
4099
|
+
previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0,
|
|
4100
|
+
containsApprovalResponses: (_e = openaiOptions == null ? void 0 : openaiOptions.containsApprovalResponses) != null ? _e : false
|
|
4106
4101
|
});
|
|
4107
4102
|
warnings.push(...inputWarnings);
|
|
4108
|
-
const strictJsonSchema = (
|
|
4103
|
+
const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
|
|
4109
4104
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
4110
4105
|
function addInclude(key) {
|
|
4111
4106
|
if (include == null) {
|
|
@@ -4121,9 +4116,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4121
4116
|
if (topLogprobs) {
|
|
4122
4117
|
addInclude("message.output_text.logprobs");
|
|
4123
4118
|
}
|
|
4124
|
-
const webSearchToolName = (
|
|
4119
|
+
const webSearchToolName = (_g = tools == null ? void 0 : tools.find(
|
|
4125
4120
|
(tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
4126
|
-
)) == null ? void 0 :
|
|
4121
|
+
)) == null ? void 0 : _g.name;
|
|
4127
4122
|
if (webSearchToolName) {
|
|
4128
4123
|
addInclude("web_search_call.action.sources");
|
|
4129
4124
|
}
|
|
@@ -4146,7 +4141,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4146
4141
|
format: responseFormat.schema != null ? {
|
|
4147
4142
|
type: "json_schema",
|
|
4148
4143
|
strict: strictJsonSchema,
|
|
4149
|
-
name: (
|
|
4144
|
+
name: (_h = responseFormat.name) != null ? _h : "response",
|
|
4150
4145
|
description: responseFormat.description,
|
|
4151
4146
|
schema: responseFormat.schema
|
|
4152
4147
|
} : { type: "json_object" }
|
|
@@ -5788,7 +5783,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5788
5783
|
};
|
|
5789
5784
|
|
|
5790
5785
|
// src/version.ts
|
|
5791
|
-
var VERSION = true ? "3.0.
|
|
5786
|
+
var VERSION = true ? "3.0.21" : "0.0.0-test";
|
|
5792
5787
|
|
|
5793
5788
|
// src/openai-provider.ts
|
|
5794
5789
|
function createOpenAI(options = {}) {
|