@zenning/openai 3.0.19 → 3.0.20
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 +21 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -29
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +20 -28
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +20 -28
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -2547,7 +2547,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2547
2547
|
hasShellTool = false,
|
|
2548
2548
|
hasApplyPatchTool = false,
|
|
2549
2549
|
compactionInput,
|
|
2550
|
-
previousResponseId
|
|
2550
|
+
previousResponseId,
|
|
2551
|
+
containsApprovalResponses
|
|
2551
2552
|
}) {
|
|
2552
2553
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2553
2554
|
const input = [];
|
|
@@ -2634,13 +2635,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2634
2635
|
switch (part.type) {
|
|
2635
2636
|
case "text": {
|
|
2636
2637
|
const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a[providerOptionsName]) == null ? void 0 : _b.itemId;
|
|
2637
|
-
if (store && id != null
|
|
2638
|
+
if (store && id != null) {
|
|
2638
2639
|
input.push({ type: "item_reference", id });
|
|
2639
2640
|
break;
|
|
2640
2641
|
}
|
|
2641
|
-
if (store && id != null && previousResponseId) {
|
|
2642
|
-
break;
|
|
2643
|
-
}
|
|
2644
2642
|
input.push({
|
|
2645
2643
|
role: "assistant",
|
|
2646
2644
|
content: [{ type: "output_text", text: part.text }],
|
|
@@ -2651,18 +2649,15 @@ async function convertToOpenAIResponsesInput({
|
|
|
2651
2649
|
case "tool-call": {
|
|
2652
2650
|
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;
|
|
2653
2651
|
if (part.providerExecuted) {
|
|
2654
|
-
if (store && id != null
|
|
2652
|
+
if (store && id != null) {
|
|
2655
2653
|
input.push({ type: "item_reference", id });
|
|
2656
2654
|
}
|
|
2657
2655
|
break;
|
|
2658
2656
|
}
|
|
2659
|
-
if (store && id != null
|
|
2657
|
+
if (store && id != null) {
|
|
2660
2658
|
input.push({ type: "item_reference", id });
|
|
2661
2659
|
break;
|
|
2662
2660
|
}
|
|
2663
|
-
if (store && id != null && previousResponseId) {
|
|
2664
|
-
break;
|
|
2665
|
-
}
|
|
2666
2661
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2667
2662
|
part.toolName
|
|
2668
2663
|
);
|
|
@@ -2718,10 +2713,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2718
2713
|
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") {
|
|
2719
2714
|
break;
|
|
2720
2715
|
}
|
|
2721
|
-
if (store
|
|
2716
|
+
if (store) {
|
|
2722
2717
|
const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2723
2718
|
input.push({ type: "item_reference", id: itemId });
|
|
2724
|
-
} else if (store) {
|
|
2725
2719
|
} else {
|
|
2726
2720
|
warnings.push({
|
|
2727
2721
|
type: "other",
|
|
@@ -2739,7 +2733,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2739
2733
|
const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
|
|
2740
2734
|
if (reasoningId != null) {
|
|
2741
2735
|
const reasoningMessage = reasoningMessages[reasoningId];
|
|
2742
|
-
if (store
|
|
2736
|
+
if (store) {
|
|
2743
2737
|
if (reasoningMessage === void 0) {
|
|
2744
2738
|
input.push({ type: "item_reference", id: reasoningId });
|
|
2745
2739
|
reasoningMessages[reasoningId] = {
|
|
@@ -2748,14 +2742,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2748
2742
|
summary: []
|
|
2749
2743
|
};
|
|
2750
2744
|
}
|
|
2751
|
-
} else if (store) {
|
|
2752
|
-
if (reasoningMessage === void 0) {
|
|
2753
|
-
reasoningMessages[reasoningId] = {
|
|
2754
|
-
type: "reasoning",
|
|
2755
|
-
id: reasoningId,
|
|
2756
|
-
summary: []
|
|
2757
|
-
};
|
|
2758
|
-
}
|
|
2759
2745
|
} else {
|
|
2760
2746
|
const summaryParts = [];
|
|
2761
2747
|
if (part.text.length > 0) {
|
|
@@ -3875,7 +3861,12 @@ var openaiResponsesProviderOptionsSchema = lazySchema18(
|
|
|
3875
3861
|
type: z20.literal("compaction"),
|
|
3876
3862
|
encrypted_content: z20.string()
|
|
3877
3863
|
})
|
|
3878
|
-
).optional()
|
|
3864
|
+
).optional(),
|
|
3865
|
+
/**
|
|
3866
|
+
* Whether the request contains tool approval responses.
|
|
3867
|
+
* Defaults to `false`.
|
|
3868
|
+
*/
|
|
3869
|
+
containsApprovalResponses: z20.boolean().optional()
|
|
3879
3870
|
})
|
|
3880
3871
|
)
|
|
3881
3872
|
);
|
|
@@ -4108,7 +4099,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4108
4099
|
toolChoice,
|
|
4109
4100
|
responseFormat
|
|
4110
4101
|
}) {
|
|
4111
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4102
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4112
4103
|
const warnings = [];
|
|
4113
4104
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
4114
4105
|
if (topK != null) {
|
|
@@ -4172,10 +4163,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4172
4163
|
hasShellTool: hasOpenAITool("openai.shell"),
|
|
4173
4164
|
hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
|
|
4174
4165
|
compactionInput: openaiOptions == null ? void 0 : openaiOptions.compactionInput,
|
|
4175
|
-
previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0
|
|
4166
|
+
previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0,
|
|
4167
|
+
containsApprovalResponses: (_e = openaiOptions == null ? void 0 : openaiOptions.containsApprovalResponses) != null ? _e : false
|
|
4176
4168
|
});
|
|
4177
4169
|
warnings.push(...inputWarnings);
|
|
4178
|
-
const strictJsonSchema = (
|
|
4170
|
+
const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
|
|
4179
4171
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
4180
4172
|
function addInclude(key) {
|
|
4181
4173
|
if (include == null) {
|
|
@@ -4191,9 +4183,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4191
4183
|
if (topLogprobs) {
|
|
4192
4184
|
addInclude("message.output_text.logprobs");
|
|
4193
4185
|
}
|
|
4194
|
-
const webSearchToolName = (
|
|
4186
|
+
const webSearchToolName = (_g = tools == null ? void 0 : tools.find(
|
|
4195
4187
|
(tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
4196
|
-
)) == null ? void 0 :
|
|
4188
|
+
)) == null ? void 0 : _g.name;
|
|
4197
4189
|
if (webSearchToolName) {
|
|
4198
4190
|
addInclude("web_search_call.action.sources");
|
|
4199
4191
|
}
|
|
@@ -4216,7 +4208,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4216
4208
|
format: responseFormat.schema != null ? {
|
|
4217
4209
|
type: "json_schema",
|
|
4218
4210
|
strict: strictJsonSchema,
|
|
4219
|
-
name: (
|
|
4211
|
+
name: (_h = responseFormat.name) != null ? _h : "response",
|
|
4220
4212
|
description: responseFormat.description,
|
|
4221
4213
|
schema: responseFormat.schema
|
|
4222
4214
|
} : { type: "json_object" }
|
|
@@ -5870,7 +5862,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5870
5862
|
};
|
|
5871
5863
|
|
|
5872
5864
|
// src/version.ts
|
|
5873
|
-
var VERSION = true ? "3.0.
|
|
5865
|
+
var VERSION = true ? "3.0.20" : "0.0.0-test";
|
|
5874
5866
|
|
|
5875
5867
|
// src/openai-provider.ts
|
|
5876
5868
|
function createOpenAI(options = {}) {
|