@ai-sdk/openai 4.0.110 → 4.0.113
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 +28 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +106 -43
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +170 -0
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +106 -43
- package/dist/internal/index.js.map +1 -1
- package/package.json +3 -3
- package/src/chat/openai-chat-language-model.ts +19 -8
- package/src/completion/openai-completion-language-model.ts +11 -13
- package/src/image/openai-image-model-options.ts +68 -57
- package/src/redact-openai-tool-credentials.ts +64 -0
- package/src/responses/convert-to-openai-responses-input.ts +16 -4
- package/src/responses/expand-parallel-tool-call.ts +4 -3
- package/src/responses/openai-responses-language-model.ts +12 -16
- package/src/speech/openai-speech-model-options.ts +11 -6
- package/src/tool/code-interpreter.ts +2 -0
- package/src/tool/mcp.ts +2 -0
- package/src/tool/shell.ts +2 -0
- package/src/transcription/openai-transcription-model-options.ts +71 -70
|
@@ -18,91 +18,92 @@ export type OpenAITranscriptionModelId =
|
|
|
18
18
|
| (string & {});
|
|
19
19
|
|
|
20
20
|
// https://platform.openai.com/docs/api-reference/audio/createTranscription
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Shape of the OpenAI transcription model options. Exported so that routers
|
|
23
|
+
* that also call the OpenAI transcription API (e.g. Azure) can accept these
|
|
24
|
+
* options under their own providerOptions key.
|
|
25
|
+
*/
|
|
26
|
+
export const openAITranscriptionModelOptionsShape = () => ({
|
|
27
|
+
/**
|
|
28
|
+
* Additional information to include in the transcription response.
|
|
29
|
+
*/
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
include: z.array(z.string()).optional(),
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* The language of the input audio in ISO-639-1 format.
|
|
35
|
+
*/
|
|
36
|
+
language: z.string().optional(),
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Expected languages for REST transcription, e.g. with gpt-transcribe.
|
|
40
|
+
* Use this instead of language. The API validates model support.
|
|
41
|
+
*/
|
|
42
|
+
languages: z.array(z.string()).optional(),
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Vocabulary hints for REST transcription, e.g. names or technical terms.
|
|
46
|
+
* The API validates model support.
|
|
47
|
+
*/
|
|
48
|
+
keywords: z.array(z.string()).optional(),
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
/**
|
|
51
|
+
* An optional text to guide the model's style or continue a previous audio segment.
|
|
52
|
+
*/
|
|
53
|
+
prompt: z.string().optional(),
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The sampling temperature, between 0 and 1.
|
|
57
|
+
* @default 0
|
|
58
|
+
*/
|
|
59
|
+
temperature: z.number().min(0).max(1).default(0).optional(),
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
/**
|
|
62
|
+
* The timestamp granularities to populate for this transcription.
|
|
63
|
+
* Defaults to ['segment'] when the response format is verbose_json.
|
|
64
|
+
*/
|
|
65
|
+
timestampGranularities: z.array(z.enum(['word', 'segment'])).optional(),
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
/**
|
|
68
|
+
* The format of the transcription response.
|
|
69
|
+
*/
|
|
70
|
+
responseFormat: z.enum(['json', 'verbose_json', 'diarized_json']).optional(),
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Controls how the audio is split into chunks before transcription.
|
|
74
|
+
*/
|
|
75
|
+
chunkingStrategy: z
|
|
76
|
+
.union([
|
|
77
|
+
z.literal('auto'),
|
|
78
|
+
z.object({
|
|
79
|
+
type: z.literal('server_vad'),
|
|
80
|
+
threshold: z.number().min(0).max(1).optional(),
|
|
81
|
+
prefixPaddingMs: z.number().int().min(0).optional(),
|
|
82
|
+
silenceDurationMs: z.number().int().min(0).optional(),
|
|
83
|
+
}),
|
|
84
|
+
])
|
|
85
|
+
.optional(),
|
|
70
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Options for streaming transcription models such as `gpt-live-transcribe`.
|
|
89
|
+
*/
|
|
90
|
+
streaming: z
|
|
91
|
+
.object({
|
|
71
92
|
/**
|
|
72
|
-
*
|
|
93
|
+
* Latency/accuracy tradeoff for realtime transcription.
|
|
73
94
|
*/
|
|
74
|
-
|
|
75
|
-
.union([
|
|
76
|
-
z.literal('auto'),
|
|
77
|
-
z.object({
|
|
78
|
-
type: z.literal('server_vad'),
|
|
79
|
-
threshold: z.number().min(0).max(1).optional(),
|
|
80
|
-
prefixPaddingMs: z.number().int().min(0).optional(),
|
|
81
|
-
silenceDurationMs: z.number().int().min(0).optional(),
|
|
82
|
-
}),
|
|
83
|
-
])
|
|
84
|
-
.optional(),
|
|
95
|
+
delay: z.enum(['minimal', 'low', 'medium', 'high', 'xhigh']).optional(),
|
|
85
96
|
|
|
86
97
|
/**
|
|
87
|
-
*
|
|
98
|
+
* Additional fields to include in realtime transcription events.
|
|
88
99
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
*/
|
|
94
|
-
delay: z
|
|
95
|
-
.enum(['minimal', 'low', 'medium', 'high', 'xhigh'])
|
|
96
|
-
.optional(),
|
|
100
|
+
include: z.array(z.string()).optional(),
|
|
101
|
+
})
|
|
102
|
+
.optional(),
|
|
103
|
+
});
|
|
97
104
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*/
|
|
101
|
-
include: z.array(z.string()).optional(),
|
|
102
|
-
})
|
|
103
|
-
.optional(),
|
|
104
|
-
}),
|
|
105
|
-
),
|
|
105
|
+
export const openAITranscriptionModelOptions = lazySchema(() =>
|
|
106
|
+
zodSchema(z.object(openAITranscriptionModelOptionsShape())),
|
|
106
107
|
);
|
|
107
108
|
|
|
108
109
|
export type OpenAITranscriptionModelOptions = InferSchema<
|