@zenning/openai 3.0.17 → 3.0.19
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.js +32 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -34
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +31 -33
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +31 -33
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -2479,14 +2479,12 @@ async function convertToOpenAIResponsesInput({
|
|
|
2479
2479
|
hasShellTool = false,
|
|
2480
2480
|
hasApplyPatchTool = false,
|
|
2481
2481
|
compactionInput,
|
|
2482
|
-
|
|
2482
|
+
previousResponseId
|
|
2483
2483
|
}) {
|
|
2484
2484
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2485
2485
|
const input = [];
|
|
2486
2486
|
const warnings = [];
|
|
2487
2487
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
2488
|
-
const skipItemReferences = (providerOptions == null ? void 0 : providerOptions.skipItemReferencesForApproval) === true;
|
|
2489
|
-
console.log("[OpenAI Provider] Skip item references flag:", skipItemReferences, "providerOptions:", providerOptions);
|
|
2490
2488
|
if (compactionInput && compactionInput.length > 0) {
|
|
2491
2489
|
input.push(...compactionInput);
|
|
2492
2490
|
}
|
|
@@ -2568,10 +2566,13 @@ async function convertToOpenAIResponsesInput({
|
|
|
2568
2566
|
switch (part.type) {
|
|
2569
2567
|
case "text": {
|
|
2570
2568
|
const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a[providerOptionsName]) == null ? void 0 : _b.itemId;
|
|
2571
|
-
if (store && id != null) {
|
|
2569
|
+
if (store && id != null && !previousResponseId) {
|
|
2572
2570
|
input.push({ type: "item_reference", id });
|
|
2573
2571
|
break;
|
|
2574
2572
|
}
|
|
2573
|
+
if (store && id != null && previousResponseId) {
|
|
2574
|
+
break;
|
|
2575
|
+
}
|
|
2575
2576
|
input.push({
|
|
2576
2577
|
role: "assistant",
|
|
2577
2578
|
content: [{ type: "output_text", text: part.text }],
|
|
@@ -2581,29 +2582,17 @@ async function convertToOpenAIResponsesInput({
|
|
|
2581
2582
|
}
|
|
2582
2583
|
case "tool-call": {
|
|
2583
2584
|
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;
|
|
2584
|
-
console.log("[OpenAI Provider] Processing tool-call:", {
|
|
2585
|
-
toolCallId: part.toolCallId,
|
|
2586
|
-
toolName: part.toolName,
|
|
2587
|
-
id,
|
|
2588
|
-
providerExecuted: part.providerExecuted,
|
|
2589
|
-
store,
|
|
2590
|
-
skipItemReferences,
|
|
2591
|
-
willCreateItemReference: store && id != null && !skipItemReferences
|
|
2592
|
-
});
|
|
2593
2585
|
if (part.providerExecuted) {
|
|
2594
|
-
if (store && id != null && !
|
|
2595
|
-
console.log("[OpenAI Provider] Creating item_reference (providerExecuted)");
|
|
2586
|
+
if (store && id != null && !previousResponseId) {
|
|
2596
2587
|
input.push({ type: "item_reference", id });
|
|
2597
2588
|
}
|
|
2598
2589
|
break;
|
|
2599
2590
|
}
|
|
2600
|
-
if (store && id != null && !
|
|
2601
|
-
console.log("[OpenAI Provider] Creating item_reference (non-providerExecuted)");
|
|
2591
|
+
if (store && id != null && !previousResponseId) {
|
|
2602
2592
|
input.push({ type: "item_reference", id });
|
|
2603
2593
|
break;
|
|
2604
2594
|
}
|
|
2605
|
-
if (
|
|
2606
|
-
console.log("[OpenAI Provider] Skipping function_call due to approval continuation flag");
|
|
2595
|
+
if (store && id != null && previousResponseId) {
|
|
2607
2596
|
break;
|
|
2608
2597
|
}
|
|
2609
2598
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
@@ -2661,9 +2650,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2661
2650
|
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") {
|
|
2662
2651
|
break;
|
|
2663
2652
|
}
|
|
2664
|
-
if (store) {
|
|
2653
|
+
if (store && !previousResponseId) {
|
|
2665
2654
|
const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2666
2655
|
input.push({ type: "item_reference", id: itemId });
|
|
2656
|
+
} else if (store) {
|
|
2667
2657
|
} else {
|
|
2668
2658
|
warnings.push({
|
|
2669
2659
|
type: "other",
|
|
@@ -2673,15 +2663,15 @@ async function convertToOpenAIResponsesInput({
|
|
|
2673
2663
|
break;
|
|
2674
2664
|
}
|
|
2675
2665
|
case "reasoning": {
|
|
2676
|
-
const
|
|
2666
|
+
const providerOptions = await (0, import_provider_utils23.parseProviderOptions)({
|
|
2677
2667
|
provider: providerOptionsName,
|
|
2678
2668
|
providerOptions: part.providerOptions,
|
|
2679
2669
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
2680
2670
|
});
|
|
2681
|
-
const reasoningId =
|
|
2671
|
+
const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
|
|
2682
2672
|
if (reasoningId != null) {
|
|
2683
2673
|
const reasoningMessage = reasoningMessages[reasoningId];
|
|
2684
|
-
if (store) {
|
|
2674
|
+
if (store && !previousResponseId) {
|
|
2685
2675
|
if (reasoningMessage === void 0) {
|
|
2686
2676
|
input.push({ type: "item_reference", id: reasoningId });
|
|
2687
2677
|
reasoningMessages[reasoningId] = {
|
|
@@ -2690,6 +2680,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2690
2680
|
summary: []
|
|
2691
2681
|
};
|
|
2692
2682
|
}
|
|
2683
|
+
} else if (store) {
|
|
2684
|
+
if (reasoningMessage === void 0) {
|
|
2685
|
+
reasoningMessages[reasoningId] = {
|
|
2686
|
+
type: "reasoning",
|
|
2687
|
+
id: reasoningId,
|
|
2688
|
+
summary: []
|
|
2689
|
+
};
|
|
2690
|
+
}
|
|
2693
2691
|
} else {
|
|
2694
2692
|
const summaryParts = [];
|
|
2695
2693
|
if (part.text.length > 0) {
|
|
@@ -2707,14 +2705,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2707
2705
|
reasoningMessages[reasoningId] = {
|
|
2708
2706
|
type: "reasoning",
|
|
2709
2707
|
id: reasoningId,
|
|
2710
|
-
encrypted_content:
|
|
2708
|
+
encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
|
|
2711
2709
|
summary: summaryParts
|
|
2712
2710
|
};
|
|
2713
2711
|
input.push(reasoningMessages[reasoningId]);
|
|
2714
2712
|
} else {
|
|
2715
2713
|
reasoningMessage.summary.push(...summaryParts);
|
|
2716
|
-
if ((
|
|
2717
|
-
reasoningMessage.encrypted_content =
|
|
2714
|
+
if ((providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent) != null) {
|
|
2715
|
+
reasoningMessage.encrypted_content = providerOptions.reasoningEncryptedContent;
|
|
2718
2716
|
}
|
|
2719
2717
|
}
|
|
2720
2718
|
}
|
|
@@ -2738,7 +2736,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2738
2736
|
continue;
|
|
2739
2737
|
}
|
|
2740
2738
|
processedApprovalIds.add(approvalResponse.approvalId);
|
|
2741
|
-
if (store) {
|
|
2739
|
+
if (store && !previousResponseId) {
|
|
2742
2740
|
input.push({
|
|
2743
2741
|
type: "item_reference",
|
|
2744
2742
|
id: approvalResponse.approvalId
|
|
@@ -4040,7 +4038,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4040
4038
|
toolChoice,
|
|
4041
4039
|
responseFormat
|
|
4042
4040
|
}) {
|
|
4043
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4041
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4044
4042
|
const warnings = [];
|
|
4045
4043
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
4046
4044
|
if (topK != null) {
|
|
@@ -4104,10 +4102,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4104
4102
|
hasShellTool: hasOpenAITool("openai.shell"),
|
|
4105
4103
|
hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
|
|
4106
4104
|
compactionInput: openaiOptions == null ? void 0 : openaiOptions.compactionInput,
|
|
4107
|
-
|
|
4105
|
+
previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0
|
|
4108
4106
|
});
|
|
4109
4107
|
warnings.push(...inputWarnings);
|
|
4110
|
-
const strictJsonSchema = (
|
|
4108
|
+
const strictJsonSchema = (_e = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _e : true;
|
|
4111
4109
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
4112
4110
|
function addInclude(key) {
|
|
4113
4111
|
if (include == null) {
|
|
@@ -4123,9 +4121,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4123
4121
|
if (topLogprobs) {
|
|
4124
4122
|
addInclude("message.output_text.logprobs");
|
|
4125
4123
|
}
|
|
4126
|
-
const webSearchToolName = (
|
|
4124
|
+
const webSearchToolName = (_f = tools == null ? void 0 : tools.find(
|
|
4127
4125
|
(tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
4128
|
-
)) == null ? void 0 :
|
|
4126
|
+
)) == null ? void 0 : _f.name;
|
|
4129
4127
|
if (webSearchToolName) {
|
|
4130
4128
|
addInclude("web_search_call.action.sources");
|
|
4131
4129
|
}
|
|
@@ -4148,7 +4146,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4148
4146
|
format: responseFormat.schema != null ? {
|
|
4149
4147
|
type: "json_schema",
|
|
4150
4148
|
strict: strictJsonSchema,
|
|
4151
|
-
name: (
|
|
4149
|
+
name: (_g = responseFormat.name) != null ? _g : "response",
|
|
4152
4150
|
description: responseFormat.description,
|
|
4153
4151
|
schema: responseFormat.schema
|
|
4154
4152
|
} : { type: "json_object" }
|
|
@@ -5790,7 +5788,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5790
5788
|
};
|
|
5791
5789
|
|
|
5792
5790
|
// src/version.ts
|
|
5793
|
-
var VERSION = true ? "3.0.
|
|
5791
|
+
var VERSION = true ? "3.0.19" : "0.0.0-test";
|
|
5794
5792
|
|
|
5795
5793
|
// src/openai-provider.ts
|
|
5796
5794
|
function createOpenAI(options = {}) {
|