@zenning/openai 3.0.17 → 3.0.18
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.js +28 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -36
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +27 -35
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +27 -35
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2547,14 +2547,12 @@ async function convertToOpenAIResponsesInput({
|
|
|
2547
2547
|
hasShellTool = false,
|
|
2548
2548
|
hasApplyPatchTool = false,
|
|
2549
2549
|
compactionInput,
|
|
2550
|
-
|
|
2550
|
+
previousResponseId
|
|
2551
2551
|
}) {
|
|
2552
2552
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2553
2553
|
const input = [];
|
|
2554
2554
|
const warnings = [];
|
|
2555
2555
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
2556
|
-
const skipItemReferences = (providerOptions == null ? void 0 : providerOptions.skipItemReferencesForApproval) === true;
|
|
2557
|
-
console.log("[OpenAI Provider] Skip item references flag:", skipItemReferences, "providerOptions:", providerOptions);
|
|
2558
2556
|
if (compactionInput && compactionInput.length > 0) {
|
|
2559
2557
|
input.push(...compactionInput);
|
|
2560
2558
|
}
|
|
@@ -2636,7 +2634,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2636
2634
|
switch (part.type) {
|
|
2637
2635
|
case "text": {
|
|
2638
2636
|
const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a[providerOptionsName]) == null ? void 0 : _b.itemId;
|
|
2639
|
-
if (store && id != null) {
|
|
2637
|
+
if (store && id != null && !previousResponseId) {
|
|
2640
2638
|
input.push({ type: "item_reference", id });
|
|
2641
2639
|
break;
|
|
2642
2640
|
}
|
|
@@ -2649,31 +2647,16 @@ async function convertToOpenAIResponsesInput({
|
|
|
2649
2647
|
}
|
|
2650
2648
|
case "tool-call": {
|
|
2651
2649
|
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;
|
|
2652
|
-
console.log("[OpenAI Provider] Processing tool-call:", {
|
|
2653
|
-
toolCallId: part.toolCallId,
|
|
2654
|
-
toolName: part.toolName,
|
|
2655
|
-
id,
|
|
2656
|
-
providerExecuted: part.providerExecuted,
|
|
2657
|
-
store,
|
|
2658
|
-
skipItemReferences,
|
|
2659
|
-
willCreateItemReference: store && id != null && !skipItemReferences
|
|
2660
|
-
});
|
|
2661
2650
|
if (part.providerExecuted) {
|
|
2662
|
-
if (store && id != null && !
|
|
2663
|
-
console.log("[OpenAI Provider] Creating item_reference (providerExecuted)");
|
|
2651
|
+
if (store && id != null && !previousResponseId) {
|
|
2664
2652
|
input.push({ type: "item_reference", id });
|
|
2665
2653
|
}
|
|
2666
2654
|
break;
|
|
2667
2655
|
}
|
|
2668
|
-
if (store && id != null && !
|
|
2669
|
-
console.log("[OpenAI Provider] Creating item_reference (non-providerExecuted)");
|
|
2656
|
+
if (store && id != null && !previousResponseId) {
|
|
2670
2657
|
input.push({ type: "item_reference", id });
|
|
2671
2658
|
break;
|
|
2672
2659
|
}
|
|
2673
|
-
if (skipItemReferences) {
|
|
2674
|
-
console.log("[OpenAI Provider] Skipping function_call due to approval continuation flag");
|
|
2675
|
-
break;
|
|
2676
|
-
}
|
|
2677
2660
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2678
2661
|
part.toolName
|
|
2679
2662
|
);
|
|
@@ -2729,9 +2712,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2729
2712
|
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") {
|
|
2730
2713
|
break;
|
|
2731
2714
|
}
|
|
2732
|
-
if (store) {
|
|
2715
|
+
if (store && !previousResponseId) {
|
|
2733
2716
|
const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2734
2717
|
input.push({ type: "item_reference", id: itemId });
|
|
2718
|
+
} else if (store) {
|
|
2735
2719
|
} else {
|
|
2736
2720
|
warnings.push({
|
|
2737
2721
|
type: "other",
|
|
@@ -2741,15 +2725,15 @@ async function convertToOpenAIResponsesInput({
|
|
|
2741
2725
|
break;
|
|
2742
2726
|
}
|
|
2743
2727
|
case "reasoning": {
|
|
2744
|
-
const
|
|
2728
|
+
const providerOptions = await parseProviderOptions4({
|
|
2745
2729
|
provider: providerOptionsName,
|
|
2746
2730
|
providerOptions: part.providerOptions,
|
|
2747
2731
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
2748
2732
|
});
|
|
2749
|
-
const reasoningId =
|
|
2733
|
+
const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
|
|
2750
2734
|
if (reasoningId != null) {
|
|
2751
2735
|
const reasoningMessage = reasoningMessages[reasoningId];
|
|
2752
|
-
if (store) {
|
|
2736
|
+
if (store && !previousResponseId) {
|
|
2753
2737
|
if (reasoningMessage === void 0) {
|
|
2754
2738
|
input.push({ type: "item_reference", id: reasoningId });
|
|
2755
2739
|
reasoningMessages[reasoningId] = {
|
|
@@ -2758,6 +2742,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2758
2742
|
summary: []
|
|
2759
2743
|
};
|
|
2760
2744
|
}
|
|
2745
|
+
} else if (store) {
|
|
2746
|
+
if (reasoningMessage === void 0) {
|
|
2747
|
+
reasoningMessages[reasoningId] = {
|
|
2748
|
+
type: "reasoning",
|
|
2749
|
+
id: reasoningId,
|
|
2750
|
+
summary: []
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2761
2753
|
} else {
|
|
2762
2754
|
const summaryParts = [];
|
|
2763
2755
|
if (part.text.length > 0) {
|
|
@@ -2775,14 +2767,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2775
2767
|
reasoningMessages[reasoningId] = {
|
|
2776
2768
|
type: "reasoning",
|
|
2777
2769
|
id: reasoningId,
|
|
2778
|
-
encrypted_content:
|
|
2770
|
+
encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
|
|
2779
2771
|
summary: summaryParts
|
|
2780
2772
|
};
|
|
2781
2773
|
input.push(reasoningMessages[reasoningId]);
|
|
2782
2774
|
} else {
|
|
2783
2775
|
reasoningMessage.summary.push(...summaryParts);
|
|
2784
|
-
if ((
|
|
2785
|
-
reasoningMessage.encrypted_content =
|
|
2776
|
+
if ((providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent) != null) {
|
|
2777
|
+
reasoningMessage.encrypted_content = providerOptions.reasoningEncryptedContent;
|
|
2786
2778
|
}
|
|
2787
2779
|
}
|
|
2788
2780
|
}
|
|
@@ -2806,7 +2798,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2806
2798
|
continue;
|
|
2807
2799
|
}
|
|
2808
2800
|
processedApprovalIds.add(approvalResponse.approvalId);
|
|
2809
|
-
if (store) {
|
|
2801
|
+
if (store && !previousResponseId) {
|
|
2810
2802
|
input.push({
|
|
2811
2803
|
type: "item_reference",
|
|
2812
2804
|
id: approvalResponse.approvalId
|
|
@@ -4110,7 +4102,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4110
4102
|
toolChoice,
|
|
4111
4103
|
responseFormat
|
|
4112
4104
|
}) {
|
|
4113
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4105
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4114
4106
|
const warnings = [];
|
|
4115
4107
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
4116
4108
|
if (topK != null) {
|
|
@@ -4174,10 +4166,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4174
4166
|
hasShellTool: hasOpenAITool("openai.shell"),
|
|
4175
4167
|
hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
|
|
4176
4168
|
compactionInput: openaiOptions == null ? void 0 : openaiOptions.compactionInput,
|
|
4177
|
-
|
|
4169
|
+
previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0
|
|
4178
4170
|
});
|
|
4179
4171
|
warnings.push(...inputWarnings);
|
|
4180
|
-
const strictJsonSchema = (
|
|
4172
|
+
const strictJsonSchema = (_e = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _e : true;
|
|
4181
4173
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
4182
4174
|
function addInclude(key) {
|
|
4183
4175
|
if (include == null) {
|
|
@@ -4193,9 +4185,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4193
4185
|
if (topLogprobs) {
|
|
4194
4186
|
addInclude("message.output_text.logprobs");
|
|
4195
4187
|
}
|
|
4196
|
-
const webSearchToolName = (
|
|
4188
|
+
const webSearchToolName = (_f = tools == null ? void 0 : tools.find(
|
|
4197
4189
|
(tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
4198
|
-
)) == null ? void 0 :
|
|
4190
|
+
)) == null ? void 0 : _f.name;
|
|
4199
4191
|
if (webSearchToolName) {
|
|
4200
4192
|
addInclude("web_search_call.action.sources");
|
|
4201
4193
|
}
|
|
@@ -4218,7 +4210,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4218
4210
|
format: responseFormat.schema != null ? {
|
|
4219
4211
|
type: "json_schema",
|
|
4220
4212
|
strict: strictJsonSchema,
|
|
4221
|
-
name: (
|
|
4213
|
+
name: (_g = responseFormat.name) != null ? _g : "response",
|
|
4222
4214
|
description: responseFormat.description,
|
|
4223
4215
|
schema: responseFormat.schema
|
|
4224
4216
|
} : { type: "json_object" }
|
|
@@ -5872,7 +5864,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5872
5864
|
};
|
|
5873
5865
|
|
|
5874
5866
|
// src/version.ts
|
|
5875
|
-
var VERSION = true ? "3.0.
|
|
5867
|
+
var VERSION = true ? "3.0.17" : "0.0.0-test";
|
|
5876
5868
|
|
|
5877
5869
|
// src/openai-provider.ts
|
|
5878
5870
|
function createOpenAI(options = {}) {
|