@zenning/openai 3.0.22 → 3.0.23
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +20 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -26
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +19 -25
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +19 -25
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -462,6 +462,7 @@ declare const openaiResponsesProviderOptionsSchema: _zenning_provider_utils.Lazy
|
|
|
462
462
|
encrypted_content: string;
|
|
463
463
|
}[] | undefined;
|
|
464
464
|
containsApprovalResponses?: boolean | undefined;
|
|
465
|
+
approvalToolCallIds?: string[] | undefined;
|
|
465
466
|
}>;
|
|
466
467
|
type OpenAIResponsesProviderOptions = InferSchema<typeof openaiResponsesProviderOptionsSchema>;
|
|
467
468
|
|
package/dist/index.d.ts
CHANGED
|
@@ -462,6 +462,7 @@ declare const openaiResponsesProviderOptionsSchema: _zenning_provider_utils.Lazy
|
|
|
462
462
|
encrypted_content: string;
|
|
463
463
|
}[] | undefined;
|
|
464
464
|
containsApprovalResponses?: boolean | undefined;
|
|
465
|
+
approvalToolCallIds?: string[] | undefined;
|
|
465
466
|
}>;
|
|
466
467
|
type OpenAIResponsesProviderOptions = InferSchema<typeof openaiResponsesProviderOptionsSchema>;
|
|
467
468
|
|
package/dist/index.js
CHANGED
|
@@ -2480,27 +2480,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2480
2480
|
hasApplyPatchTool = false,
|
|
2481
2481
|
compactionInput,
|
|
2482
2482
|
previousResponseId,
|
|
2483
|
-
containsApprovalResponses
|
|
2483
|
+
containsApprovalResponses,
|
|
2484
|
+
approvalToolCallIds: approvalToolCallIdsArray
|
|
2484
2485
|
}) {
|
|
2485
2486
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2486
2487
|
const input = [];
|
|
2487
2488
|
const warnings = [];
|
|
2488
2489
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
2489
|
-
const approvalToolCallIds =
|
|
2490
|
-
if (containsApprovalResponses) {
|
|
2491
|
-
for (const message of prompt) {
|
|
2492
|
-
if (message.role !== "assistant") continue;
|
|
2493
|
-
if (typeof message.content === "string") continue;
|
|
2494
|
-
for (const part of message.content) {
|
|
2495
|
-
if (part.type === "tool-call") {
|
|
2496
|
-
const approval = part.approval;
|
|
2497
|
-
if ((approval == null ? void 0 : approval.approved) != null) {
|
|
2498
|
-
approvalToolCallIds.add(part.toolCallId);
|
|
2499
|
-
}
|
|
2500
|
-
}
|
|
2501
|
-
}
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2490
|
+
const approvalToolCallIds = new Set(approvalToolCallIdsArray || []);
|
|
2504
2491
|
if (compactionInput && compactionInput.length > 0) {
|
|
2505
2492
|
input.push(...compactionInput);
|
|
2506
2493
|
}
|
|
@@ -2664,10 +2651,11 @@ async function convertToOpenAIResponsesInput({
|
|
|
2664
2651
|
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") {
|
|
2665
2652
|
break;
|
|
2666
2653
|
}
|
|
2667
|
-
|
|
2654
|
+
const toolResultHadApproval = containsApprovalResponses && approvalToolCallIds.has(part.toolCallId);
|
|
2655
|
+
if (store && !toolResultHadApproval) {
|
|
2668
2656
|
const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2669
2657
|
input.push({ type: "item_reference", id: itemId });
|
|
2670
|
-
} else {
|
|
2658
|
+
} else if (!store) {
|
|
2671
2659
|
warnings.push({
|
|
2672
2660
|
type: "other",
|
|
2673
2661
|
message: `Results for OpenAI tool ${part.toolName} are not sent to the API when store is false`
|
|
@@ -3817,7 +3805,12 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils25.lazySchem
|
|
|
3817
3805
|
* Whether the request contains tool approval responses.
|
|
3818
3806
|
* Defaults to `false`.
|
|
3819
3807
|
*/
|
|
3820
|
-
containsApprovalResponses: import_v420.z.boolean().optional()
|
|
3808
|
+
containsApprovalResponses: import_v420.z.boolean().optional(),
|
|
3809
|
+
/**
|
|
3810
|
+
* Array of tool call IDs that have approval responses (approved or denied).
|
|
3811
|
+
* Used to skip item_reference for tools that had user approval flow.
|
|
3812
|
+
*/
|
|
3813
|
+
approvalToolCallIds: import_v420.z.array(import_v420.z.string()).optional()
|
|
3821
3814
|
})
|
|
3822
3815
|
)
|
|
3823
3816
|
);
|
|
@@ -4048,7 +4041,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4048
4041
|
toolChoice,
|
|
4049
4042
|
responseFormat
|
|
4050
4043
|
}) {
|
|
4051
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4044
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4052
4045
|
const warnings = [];
|
|
4053
4046
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
4054
4047
|
if (topK != null) {
|
|
@@ -4113,10 +4106,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4113
4106
|
hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
|
|
4114
4107
|
compactionInput: openaiOptions == null ? void 0 : openaiOptions.compactionInput,
|
|
4115
4108
|
previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0,
|
|
4116
|
-
containsApprovalResponses: (_e = openaiOptions == null ? void 0 : openaiOptions.containsApprovalResponses) != null ? _e : false
|
|
4109
|
+
containsApprovalResponses: (_e = openaiOptions == null ? void 0 : openaiOptions.containsApprovalResponses) != null ? _e : false,
|
|
4110
|
+
approvalToolCallIds: (_f = openaiOptions == null ? void 0 : openaiOptions.approvalToolCallIds) != null ? _f : void 0
|
|
4117
4111
|
});
|
|
4118
4112
|
warnings.push(...inputWarnings);
|
|
4119
|
-
const strictJsonSchema = (
|
|
4113
|
+
const strictJsonSchema = (_g = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _g : true;
|
|
4120
4114
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
4121
4115
|
function addInclude(key) {
|
|
4122
4116
|
if (include == null) {
|
|
@@ -4132,9 +4126,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4132
4126
|
if (topLogprobs) {
|
|
4133
4127
|
addInclude("message.output_text.logprobs");
|
|
4134
4128
|
}
|
|
4135
|
-
const webSearchToolName = (
|
|
4129
|
+
const webSearchToolName = (_h = tools == null ? void 0 : tools.find(
|
|
4136
4130
|
(tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
4137
|
-
)) == null ? void 0 :
|
|
4131
|
+
)) == null ? void 0 : _h.name;
|
|
4138
4132
|
if (webSearchToolName) {
|
|
4139
4133
|
addInclude("web_search_call.action.sources");
|
|
4140
4134
|
}
|
|
@@ -4157,7 +4151,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4157
4151
|
format: responseFormat.schema != null ? {
|
|
4158
4152
|
type: "json_schema",
|
|
4159
4153
|
strict: strictJsonSchema,
|
|
4160
|
-
name: (
|
|
4154
|
+
name: (_i = responseFormat.name) != null ? _i : "response",
|
|
4161
4155
|
description: responseFormat.description,
|
|
4162
4156
|
schema: responseFormat.schema
|
|
4163
4157
|
} : { type: "json_object" }
|
|
@@ -5799,7 +5793,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5799
5793
|
};
|
|
5800
5794
|
|
|
5801
5795
|
// src/version.ts
|
|
5802
|
-
var VERSION = true ? "3.0.
|
|
5796
|
+
var VERSION = true ? "3.0.23" : "0.0.0-test";
|
|
5803
5797
|
|
|
5804
5798
|
// src/openai-provider.ts
|
|
5805
5799
|
function createOpenAI(options = {}) {
|