@ai-sdk/openai 2.1.0-beta.2 → 2.1.0-beta.3
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 +21 -0
- package/dist/index.d.mts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +3 -3
- package/dist/internal/index.d.ts +3 -3
- package/dist/internal/index.js +6 -6
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +4 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 2.1.0-beta.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2e86082: feat(provider/openai): `OpenAIChatLanguageModelOptions` type
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { openai, type OpenAIChatLanguageModelOptions } from '@ai-sdk/openai';
|
|
11
|
+
import { generateText } from 'ai';
|
|
12
|
+
|
|
13
|
+
await generateText({
|
|
14
|
+
model: openai.chat('gpt-4o'),
|
|
15
|
+
prompt: 'Invent a new holiday and describe its traditions.',
|
|
16
|
+
providerOptions: {
|
|
17
|
+
openai: {
|
|
18
|
+
user: 'user-123',
|
|
19
|
+
} satisfies OpenAIChatLanguageModelOptions,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
3
24
|
## 2.1.0-beta.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,37 @@ import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
6
6
|
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | (string & {});
|
|
7
|
+
declare const openaiChatLanguageModelOptions: z.ZodObject<{
|
|
8
|
+
logitBias: z.ZodOptional<z.ZodRecord<z.ZodCoercedNumber<string>, z.ZodNumber>>;
|
|
9
|
+
logprobs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
|
|
10
|
+
parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
user: z.ZodOptional<z.ZodString>;
|
|
12
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
minimal: "minimal";
|
|
14
|
+
low: "low";
|
|
15
|
+
medium: "medium";
|
|
16
|
+
high: "high";
|
|
17
|
+
}>>;
|
|
18
|
+
maxCompletionTokens: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
store: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
21
|
+
prediction: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
22
|
+
structuredOutputs: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
serviceTier: z.ZodOptional<z.ZodEnum<{
|
|
24
|
+
auto: "auto";
|
|
25
|
+
flex: "flex";
|
|
26
|
+
priority: "priority";
|
|
27
|
+
}>>;
|
|
28
|
+
strictJsonSchema: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
textVerbosity: z.ZodOptional<z.ZodEnum<{
|
|
30
|
+
low: "low";
|
|
31
|
+
medium: "medium";
|
|
32
|
+
high: "high";
|
|
33
|
+
}>>;
|
|
34
|
+
promptCacheKey: z.ZodOptional<z.ZodString>;
|
|
35
|
+
safetyIdentifier: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
type OpenAIChatLanguageModelOptions = z.infer<typeof openaiChatLanguageModelOptions>;
|
|
7
38
|
|
|
8
39
|
type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | (string & {});
|
|
9
40
|
|
|
@@ -338,4 +369,4 @@ type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOpti
|
|
|
338
369
|
|
|
339
370
|
declare const VERSION: string;
|
|
340
371
|
|
|
341
|
-
export { type OpenAIProvider, type OpenAIProviderSettings, type OpenAIResponsesProviderOptions, VERSION, createOpenAI, openai };
|
|
372
|
+
export { type OpenAIChatLanguageModelOptions, type OpenAIProvider, type OpenAIProviderSettings, type OpenAIResponsesProviderOptions, VERSION, createOpenAI, openai };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,37 @@ import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
6
6
|
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | (string & {});
|
|
7
|
+
declare const openaiChatLanguageModelOptions: z.ZodObject<{
|
|
8
|
+
logitBias: z.ZodOptional<z.ZodRecord<z.ZodCoercedNumber<string>, z.ZodNumber>>;
|
|
9
|
+
logprobs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
|
|
10
|
+
parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
user: z.ZodOptional<z.ZodString>;
|
|
12
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
minimal: "minimal";
|
|
14
|
+
low: "low";
|
|
15
|
+
medium: "medium";
|
|
16
|
+
high: "high";
|
|
17
|
+
}>>;
|
|
18
|
+
maxCompletionTokens: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
store: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
21
|
+
prediction: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
22
|
+
structuredOutputs: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
serviceTier: z.ZodOptional<z.ZodEnum<{
|
|
24
|
+
auto: "auto";
|
|
25
|
+
flex: "flex";
|
|
26
|
+
priority: "priority";
|
|
27
|
+
}>>;
|
|
28
|
+
strictJsonSchema: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
textVerbosity: z.ZodOptional<z.ZodEnum<{
|
|
30
|
+
low: "low";
|
|
31
|
+
medium: "medium";
|
|
32
|
+
high: "high";
|
|
33
|
+
}>>;
|
|
34
|
+
promptCacheKey: z.ZodOptional<z.ZodString>;
|
|
35
|
+
safetyIdentifier: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
type OpenAIChatLanguageModelOptions = z.infer<typeof openaiChatLanguageModelOptions>;
|
|
7
38
|
|
|
8
39
|
type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | (string & {});
|
|
9
40
|
|
|
@@ -338,4 +369,4 @@ type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOpti
|
|
|
338
369
|
|
|
339
370
|
declare const VERSION: string;
|
|
340
371
|
|
|
341
|
-
export { type OpenAIProvider, type OpenAIProviderSettings, type OpenAIResponsesProviderOptions, VERSION, createOpenAI, openai };
|
|
372
|
+
export { type OpenAIChatLanguageModelOptions, type OpenAIProvider, type OpenAIProviderSettings, type OpenAIResponsesProviderOptions, VERSION, createOpenAI, openai };
|
package/dist/index.js
CHANGED
|
@@ -263,7 +263,7 @@ function mapOpenAIFinishReason(finishReason) {
|
|
|
263
263
|
|
|
264
264
|
// src/chat/openai-chat-options.ts
|
|
265
265
|
var import_v42 = require("zod/v4");
|
|
266
|
-
var
|
|
266
|
+
var openaiChatLanguageModelOptions = import_v42.z.object({
|
|
267
267
|
/**
|
|
268
268
|
* Modify the likelihood of specified tokens appearing in the completion.
|
|
269
269
|
*
|
|
@@ -445,7 +445,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
445
445
|
const openaiOptions = (_a = await (0, import_provider_utils3.parseProviderOptions)({
|
|
446
446
|
provider: "openai",
|
|
447
447
|
providerOptions,
|
|
448
|
-
schema:
|
|
448
|
+
schema: openaiChatLanguageModelOptions
|
|
449
449
|
})) != null ? _a : {};
|
|
450
450
|
const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
|
|
451
451
|
if (topK != null) {
|
|
@@ -3870,7 +3870,7 @@ var openaiTranscriptionResponseSchema = import_v418.z.object({
|
|
|
3870
3870
|
});
|
|
3871
3871
|
|
|
3872
3872
|
// src/version.ts
|
|
3873
|
-
var VERSION = true ? "2.1.0-beta.
|
|
3873
|
+
var VERSION = true ? "2.1.0-beta.3" : "0.0.0-test";
|
|
3874
3874
|
|
|
3875
3875
|
// src/openai-provider.ts
|
|
3876
3876
|
function createOpenAI(options = {}) {
|