@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/openai",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.87",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ai-sdk/provider": "4.0.
|
|
39
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
38
|
+
"@ai-sdk/provider": "4.0.24",
|
|
39
|
+
"@ai-sdk/provider-utils": "5.0.56"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@ai-sdk/test-server": "2.0.4",
|
|
@@ -194,13 +194,13 @@ export class DecisionOpenAIModel implements DecisionModelV4 {
|
|
|
194
194
|
const answers = Object.fromEntries(
|
|
195
195
|
response.answers.map((answer): [string, DecisionModelV4Answer] => {
|
|
196
196
|
if (answer.type === 'refusal') {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
197
|
+
if (answer.name === null) {
|
|
198
|
+
throw new InvalidResponseDataError({
|
|
199
|
+
data: rawValue,
|
|
200
|
+
message: 'OpenAI Decisions refused an unnamed question.',
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
return [answer.name, { type: 'refusal' }];
|
|
204
204
|
}
|
|
205
205
|
if (answer.type === 'predicate') {
|
|
206
206
|
return [
|
|
@@ -649,6 +649,7 @@ export async function convertToOpenAIResponsesInput({
|
|
|
649
649
|
|
|
650
650
|
case 'assistant': {
|
|
651
651
|
const reasoningMessages: Record<string, OpenAIResponsesReasoning> = {};
|
|
652
|
+
const emittedTextItemIds = new Set<string>();
|
|
652
653
|
|
|
653
654
|
for (const part of content) {
|
|
654
655
|
switch (part.type) {
|
|
@@ -669,7 +670,10 @@ export async function convertToOpenAIResponsesInput({
|
|
|
669
670
|
|
|
670
671
|
// item references reduce the payload size
|
|
671
672
|
if (store && id != null) {
|
|
672
|
-
|
|
673
|
+
if (!emittedTextItemIds.has(id)) {
|
|
674
|
+
emittedTextItemIds.add(id);
|
|
675
|
+
input.push({ type: 'item_reference', id });
|
|
676
|
+
}
|
|
673
677
|
break;
|
|
674
678
|
}
|
|
675
679
|
|