@zenning/openai 3.0.21 → 3.0.22
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 +8 -0
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +19 -3
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +19 -3
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 3.0.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix duplicate item_reference for approval responses. Skip creating item_reference for all tool-calls when approval responses are detected in the prompt, preventing duplicate item errors with previousResponseId.
|
|
8
|
+
- Fix tool approval with previousResponseId. Skip creating item_reference for tool-calls that have approval responses, preventing duplicate item errors when continuing from a previous response.
|
|
9
|
+
- ll
|
|
10
|
+
|
|
3
11
|
## 3.0.21
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -2486,6 +2486,21 @@ async function convertToOpenAIResponsesInput({
|
|
|
2486
2486
|
const input = [];
|
|
2487
2487
|
const warnings = [];
|
|
2488
2488
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
2489
|
+
const approvalToolCallIds = /* @__PURE__ */ new Set();
|
|
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
|
+
}
|
|
2489
2504
|
if (compactionInput && compactionInput.length > 0) {
|
|
2490
2505
|
input.push(...compactionInput);
|
|
2491
2506
|
}
|
|
@@ -2580,17 +2595,18 @@ async function convertToOpenAIResponsesInput({
|
|
|
2580
2595
|
}
|
|
2581
2596
|
case "tool-call": {
|
|
2582
2597
|
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;
|
|
2598
|
+
const toolHadApproval = containsApprovalResponses && approvalToolCallIds.has(part.toolCallId);
|
|
2583
2599
|
if (part.providerExecuted) {
|
|
2584
|
-
if (store && id != null && !
|
|
2600
|
+
if (store && id != null && !toolHadApproval) {
|
|
2585
2601
|
input.push({ type: "item_reference", id });
|
|
2586
2602
|
}
|
|
2587
2603
|
break;
|
|
2588
2604
|
}
|
|
2589
|
-
if (store && id != null && !
|
|
2605
|
+
if (store && id != null && !toolHadApproval) {
|
|
2590
2606
|
input.push({ type: "item_reference", id });
|
|
2591
2607
|
break;
|
|
2592
2608
|
}
|
|
2593
|
-
if (store && id != null &&
|
|
2609
|
+
if (store && id != null && toolHadApproval) {
|
|
2594
2610
|
break;
|
|
2595
2611
|
}
|
|
2596
2612
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
@@ -5783,7 +5799,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5783
5799
|
};
|
|
5784
5800
|
|
|
5785
5801
|
// src/version.ts
|
|
5786
|
-
var VERSION = true ? "3.0.
|
|
5802
|
+
var VERSION = true ? "3.0.22" : "0.0.0-test";
|
|
5787
5803
|
|
|
5788
5804
|
// src/openai-provider.ts
|
|
5789
5805
|
function createOpenAI(options = {}) {
|