@ai-sdk/openai 4.0.63 → 4.0.64
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 +9 -0
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +9 -0
- package/dist/internal/index.js.map +1 -1
- package/package.json +3 -3
- package/src/chat/openai-chat-language-model.ts +18 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/openai",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.64",
|
|
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.12",
|
|
39
|
+
"@ai-sdk/provider-utils": "5.0.38"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@ai-sdk/test-server": "2.0.1",
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import {
|
|
2
|
+
InvalidResponseDataError,
|
|
3
|
+
type LanguageModelV4,
|
|
4
|
+
type LanguageModelV4CallOptions,
|
|
5
|
+
type LanguageModelV4Content,
|
|
6
|
+
type LanguageModelV4FinishReason,
|
|
7
|
+
type LanguageModelV4GenerateResult,
|
|
8
|
+
type LanguageModelV4StreamPart,
|
|
9
|
+
type LanguageModelV4StreamResult,
|
|
10
|
+
type SharedV4ProviderMetadata,
|
|
11
|
+
type SharedV4Warning,
|
|
11
12
|
} from '@ai-sdk/provider';
|
|
12
13
|
import {
|
|
13
14
|
StreamingToolCallTracker,
|
|
@@ -396,6 +397,13 @@ export class OpenAIChatLanguageModel implements LanguageModelV4 {
|
|
|
396
397
|
});
|
|
397
398
|
|
|
398
399
|
const choice = response.choices[0];
|
|
400
|
+
if (choice == null) {
|
|
401
|
+
throw new InvalidResponseDataError({
|
|
402
|
+
data: rawResponse,
|
|
403
|
+
message: 'Response did not contain any choices.',
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
|
|
399
407
|
const content: Array<LanguageModelV4Content> = [];
|
|
400
408
|
|
|
401
409
|
// text content:
|