@ai-sdk/openai 4.0.85 → 4.0.87
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 +15 -0
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +8 -4
- package/dist/internal/index.js.map +1 -1
- package/package.json +3 -3
- package/src/openai-decision-model.ts +7 -7
- package/src/responses/convert-to-openai-responses-input.ts +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 4.0.87
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bccc1b7: fix(openai): avoid duplicate references for stored messages with multiple text parts
|
|
8
|
+
|
|
9
|
+
## 4.0.86
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- d3bcad9: feat(provider): report decision refusals as refusal answers
|
|
14
|
+
- Updated dependencies [d3bcad9]
|
|
15
|
+
- @ai-sdk/provider@4.0.24
|
|
16
|
+
- @ai-sdk/provider-utils@5.0.56
|
|
17
|
+
|
|
3
18
|
## 4.0.85
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -163,10 +163,13 @@ var DecisionOpenAIModel = class DecisionOpenAIModel {
|
|
|
163
163
|
successfulResponseHandler: createJsonResponseHandler(responseSchema)
|
|
164
164
|
});
|
|
165
165
|
const answers = Object.fromEntries(response.answers.map((answer) => {
|
|
166
|
-
if (answer.type === "refusal")
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
if (answer.type === "refusal") {
|
|
167
|
+
if (answer.name === null) throw new InvalidResponseDataError({
|
|
168
|
+
data: rawValue,
|
|
169
|
+
message: "OpenAI Decisions refused an unnamed question."
|
|
170
|
+
});
|
|
171
|
+
return [answer.name, { type: "refusal" }];
|
|
172
|
+
}
|
|
170
173
|
if (answer.type === "predicate") return [answer.name, {
|
|
171
174
|
type: "boolean",
|
|
172
175
|
probability: answer.probability
|
|
@@ -4831,6 +4834,7 @@ async function convertToOpenAIResponsesInput({ prompt, toolNameMapping, systemMe
|
|
|
4831
4834
|
break;
|
|
4832
4835
|
case "assistant": {
|
|
4833
4836
|
const reasoningMessages = {};
|
|
4837
|
+
const emittedTextItemIds = /* @__PURE__ */ new Set();
|
|
4834
4838
|
for (const part of content) switch (part.type) {
|
|
4835
4839
|
case "text": {
|
|
4836
4840
|
const providerOptions = part.providerOptions?.[providerOptionsName];
|
|
@@ -4838,10 +4842,13 @@ async function convertToOpenAIResponsesInput({ prompt, toolNameMapping, systemMe
|
|
|
4838
4842
|
const phase = providerOptions?.phase;
|
|
4839
4843
|
if (hasConversation && id != null) break;
|
|
4840
4844
|
if (store && id != null) {
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
+
if (!emittedTextItemIds.has(id)) {
|
|
4846
|
+
emittedTextItemIds.add(id);
|
|
4847
|
+
input.push({
|
|
4848
|
+
type: "item_reference",
|
|
4849
|
+
id
|
|
4850
|
+
});
|
|
4851
|
+
}
|
|
4845
4852
|
break;
|
|
4846
4853
|
}
|
|
4847
4854
|
input.push({
|
|
@@ -10035,7 +10042,7 @@ var OpenAISkills = class {
|
|
|
10035
10042
|
};
|
|
10036
10043
|
//#endregion
|
|
10037
10044
|
//#region src/version.ts
|
|
10038
|
-
const VERSION = "4.0.
|
|
10045
|
+
const VERSION = "4.0.87";
|
|
10039
10046
|
//#endregion
|
|
10040
10047
|
//#region src/openai-provider.ts
|
|
10041
10048
|
/**
|