@zenning/openai 3.0.18 → 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 +12 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +21 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -23
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +20 -22
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +20 -22
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.js
CHANGED
|
@@ -2470,7 +2470,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2470
2470
|
hasShellTool = false,
|
|
2471
2471
|
hasApplyPatchTool = false,
|
|
2472
2472
|
compactionInput,
|
|
2473
|
-
previousResponseId
|
|
2473
|
+
previousResponseId,
|
|
2474
|
+
containsApprovalResponses
|
|
2474
2475
|
}) {
|
|
2475
2476
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2476
2477
|
const input = [];
|
|
@@ -2557,7 +2558,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2557
2558
|
switch (part.type) {
|
|
2558
2559
|
case "text": {
|
|
2559
2560
|
const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a[providerOptionsName]) == null ? void 0 : _b.itemId;
|
|
2560
|
-
if (store && id != null
|
|
2561
|
+
if (store && id != null) {
|
|
2561
2562
|
input.push({ type: "item_reference", id });
|
|
2562
2563
|
break;
|
|
2563
2564
|
}
|
|
@@ -2571,12 +2572,12 @@ async function convertToOpenAIResponsesInput({
|
|
|
2571
2572
|
case "tool-call": {
|
|
2572
2573
|
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;
|
|
2573
2574
|
if (part.providerExecuted) {
|
|
2574
|
-
if (store && id != null
|
|
2575
|
+
if (store && id != null) {
|
|
2575
2576
|
input.push({ type: "item_reference", id });
|
|
2576
2577
|
}
|
|
2577
2578
|
break;
|
|
2578
2579
|
}
|
|
2579
|
-
if (store && id != null
|
|
2580
|
+
if (store && id != null) {
|
|
2580
2581
|
input.push({ type: "item_reference", id });
|
|
2581
2582
|
break;
|
|
2582
2583
|
}
|
|
@@ -2635,10 +2636,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2635
2636
|
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") {
|
|
2636
2637
|
break;
|
|
2637
2638
|
}
|
|
2638
|
-
if (store
|
|
2639
|
+
if (store) {
|
|
2639
2640
|
const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2640
2641
|
input.push({ type: "item_reference", id: itemId });
|
|
2641
|
-
} else if (store) {
|
|
2642
2642
|
} else {
|
|
2643
2643
|
warnings.push({
|
|
2644
2644
|
type: "other",
|
|
@@ -2656,7 +2656,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2656
2656
|
const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
|
|
2657
2657
|
if (reasoningId != null) {
|
|
2658
2658
|
const reasoningMessage = reasoningMessages[reasoningId];
|
|
2659
|
-
if (store
|
|
2659
|
+
if (store) {
|
|
2660
2660
|
if (reasoningMessage === void 0) {
|
|
2661
2661
|
input.push({ type: "item_reference", id: reasoningId });
|
|
2662
2662
|
reasoningMessages[reasoningId] = {
|
|
@@ -2665,14 +2665,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2665
2665
|
summary: []
|
|
2666
2666
|
};
|
|
2667
2667
|
}
|
|
2668
|
-
} else if (store) {
|
|
2669
|
-
if (reasoningMessage === void 0) {
|
|
2670
|
-
reasoningMessages[reasoningId] = {
|
|
2671
|
-
type: "reasoning",
|
|
2672
|
-
id: reasoningId,
|
|
2673
|
-
summary: []
|
|
2674
|
-
};
|
|
2675
|
-
}
|
|
2676
2668
|
} else {
|
|
2677
2669
|
const summaryParts = [];
|
|
2678
2670
|
if (part.text.length > 0) {
|
|
@@ -3792,7 +3784,12 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils24.lazySchem
|
|
|
3792
3784
|
type: import_v417.z.literal("compaction"),
|
|
3793
3785
|
encrypted_content: import_v417.z.string()
|
|
3794
3786
|
})
|
|
3795
|
-
).optional()
|
|
3787
|
+
).optional(),
|
|
3788
|
+
/**
|
|
3789
|
+
* Whether the request contains tool approval responses.
|
|
3790
|
+
* Defaults to `false`.
|
|
3791
|
+
*/
|
|
3792
|
+
containsApprovalResponses: import_v417.z.boolean().optional()
|
|
3796
3793
|
})
|
|
3797
3794
|
)
|
|
3798
3795
|
);
|
|
@@ -4315,7 +4312,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4315
4312
|
toolChoice,
|
|
4316
4313
|
responseFormat
|
|
4317
4314
|
}) {
|
|
4318
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4315
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4319
4316
|
const warnings = [];
|
|
4320
4317
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
4321
4318
|
if (topK != null) {
|
|
@@ -4379,10 +4376,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4379
4376
|
hasShellTool: hasOpenAITool("openai.shell"),
|
|
4380
4377
|
hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
|
|
4381
4378
|
compactionInput: openaiOptions == null ? void 0 : openaiOptions.compactionInput,
|
|
4382
|
-
previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0
|
|
4379
|
+
previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0,
|
|
4380
|
+
containsApprovalResponses: (_e = openaiOptions == null ? void 0 : openaiOptions.containsApprovalResponses) != null ? _e : false
|
|
4383
4381
|
});
|
|
4384
4382
|
warnings.push(...inputWarnings);
|
|
4385
|
-
const strictJsonSchema = (
|
|
4383
|
+
const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
|
|
4386
4384
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
4387
4385
|
function addInclude(key) {
|
|
4388
4386
|
if (include == null) {
|
|
@@ -4398,9 +4396,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4398
4396
|
if (topLogprobs) {
|
|
4399
4397
|
addInclude("message.output_text.logprobs");
|
|
4400
4398
|
}
|
|
4401
|
-
const webSearchToolName = (
|
|
4399
|
+
const webSearchToolName = (_g = tools == null ? void 0 : tools.find(
|
|
4402
4400
|
(tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
4403
|
-
)) == null ? void 0 :
|
|
4401
|
+
)) == null ? void 0 : _g.name;
|
|
4404
4402
|
if (webSearchToolName) {
|
|
4405
4403
|
addInclude("web_search_call.action.sources");
|
|
4406
4404
|
}
|
|
@@ -4423,7 +4421,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4423
4421
|
format: responseFormat.schema != null ? {
|
|
4424
4422
|
type: "json_schema",
|
|
4425
4423
|
strict: strictJsonSchema,
|
|
4426
|
-
name: (
|
|
4424
|
+
name: (_h = responseFormat.name) != null ? _h : "response",
|
|
4427
4425
|
description: responseFormat.description,
|
|
4428
4426
|
schema: responseFormat.schema
|
|
4429
4427
|
} : { type: "json_object" }
|