@zenning/openai 3.0.20 → 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 +14 -0
- package/dist/index.js +22 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +21 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +21 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
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
|
+
|
|
11
|
+
## 3.0.21
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- ret
|
|
16
|
+
|
|
3
17
|
## 3.0.20
|
|
4
18
|
|
|
5
19
|
### 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,16 +2595,20 @@ 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
|
}
|
|
2609
|
+
if (store && id != null && toolHadApproval) {
|
|
2610
|
+
break;
|
|
2611
|
+
}
|
|
2593
2612
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2594
2613
|
part.toolName
|
|
2595
2614
|
);
|
|
@@ -5780,7 +5799,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5780
5799
|
};
|
|
5781
5800
|
|
|
5782
5801
|
// src/version.ts
|
|
5783
|
-
var VERSION = true ? "3.0.
|
|
5802
|
+
var VERSION = true ? "3.0.22" : "0.0.0-test";
|
|
5784
5803
|
|
|
5785
5804
|
// src/openai-provider.ts
|
|
5786
5805
|
function createOpenAI(options = {}) {
|