openai 4.67.3 → 4.68.0
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 +8 -0
- package/README.md +1 -1
- package/index.d.mts +4 -0
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/index.mjs.map +1 -1
- package/lib/AbstractChatCompletionRunner.d.ts.map +1 -1
- package/lib/AbstractChatCompletionRunner.js +1 -0
- package/lib/AbstractChatCompletionRunner.js.map +1 -1
- package/lib/AbstractChatCompletionRunner.mjs +1 -0
- package/lib/AbstractChatCompletionRunner.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/assistants.d.ts +8 -0
- package/resources/beta/assistants.d.ts.map +1 -1
- package/resources/beta/assistants.js.map +1 -1
- package/resources/beta/assistants.mjs.map +1 -1
- package/resources/chat/chat.d.ts +5 -1
- package/resources/chat/chat.d.ts.map +1 -1
- package/resources/chat/chat.js.map +1 -1
- package/resources/chat/chat.mjs.map +1 -1
- package/resources/chat/completions.d.ts +129 -5
- package/resources/chat/completions.d.ts.map +1 -1
- package/resources/chat/completions.js.map +1 -1
- package/resources/chat/completions.mjs.map +1 -1
- package/resources/chat/index.d.ts +1 -1
- package/resources/chat/index.d.ts.map +1 -1
- package/resources/chat/index.js.map +1 -1
- package/resources/chat/index.mjs.map +1 -1
- package/src/index.ts +4 -0
- package/src/lib/AbstractChatCompletionRunner.ts +3 -1
- package/src/resources/beta/assistants.ts +10 -0
- package/src/resources/chat/chat.ts +7 -0
- package/src/resources/chat/completions.ts +148 -5
- package/src/resources/chat/index.ts +4 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -11,7 +11,10 @@ import { Stream } from '../../streaming';
|
|
|
11
11
|
|
|
12
12
|
export class Completions extends APIResource {
|
|
13
13
|
/**
|
|
14
|
-
* Creates a model response for the given chat conversation.
|
|
14
|
+
* Creates a model response for the given chat conversation. Learn more in the
|
|
15
|
+
* [text generation](https://platform.openai.com/docs/guides/text-generation),
|
|
16
|
+
* [vision](https://platform.openai.com/docs/guides/vision), and
|
|
17
|
+
* [audio](https://platform.openai.com/docs/guides/audio) guides.
|
|
15
18
|
*/
|
|
16
19
|
create(
|
|
17
20
|
body: ChatCompletionCreateParamsNonStreaming,
|
|
@@ -138,6 +141,12 @@ export interface ChatCompletionAssistantMessageParam {
|
|
|
138
141
|
*/
|
|
139
142
|
role: 'assistant';
|
|
140
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Data about a previous audio response from the model.
|
|
146
|
+
* [Learn more](https://platform.openai.com/docs/guides/audio).
|
|
147
|
+
*/
|
|
148
|
+
audio?: ChatCompletionAssistantMessageParam.Audio | null;
|
|
149
|
+
|
|
141
150
|
/**
|
|
142
151
|
* The contents of the assistant message. Required unless `tool_calls` or
|
|
143
152
|
* `function_call` is specified.
|
|
@@ -168,6 +177,17 @@ export interface ChatCompletionAssistantMessageParam {
|
|
|
168
177
|
}
|
|
169
178
|
|
|
170
179
|
export namespace ChatCompletionAssistantMessageParam {
|
|
180
|
+
/**
|
|
181
|
+
* Data about a previous audio response from the model.
|
|
182
|
+
* [Learn more](https://platform.openai.com/docs/guides/audio).
|
|
183
|
+
*/
|
|
184
|
+
export interface Audio {
|
|
185
|
+
/**
|
|
186
|
+
* Unique identifier for a previous audio response from the model.
|
|
187
|
+
*/
|
|
188
|
+
id: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
171
191
|
/**
|
|
172
192
|
* @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of
|
|
173
193
|
* a function that should be called, as generated by the model.
|
|
@@ -188,6 +208,54 @@ export namespace ChatCompletionAssistantMessageParam {
|
|
|
188
208
|
}
|
|
189
209
|
}
|
|
190
210
|
|
|
211
|
+
/**
|
|
212
|
+
* If the audio output modality is requested, this object contains data about the
|
|
213
|
+
* audio response from the model.
|
|
214
|
+
* [Learn more](https://platform.openai.com/docs/guides/audio).
|
|
215
|
+
*/
|
|
216
|
+
export interface ChatCompletionAudio {
|
|
217
|
+
/**
|
|
218
|
+
* Unique identifier for this audio response.
|
|
219
|
+
*/
|
|
220
|
+
id: string;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Base64 encoded audio bytes generated by the model, in the format specified in
|
|
224
|
+
* the request.
|
|
225
|
+
*/
|
|
226
|
+
data: string;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* The Unix timestamp (in seconds) for when this audio response will no longer be
|
|
230
|
+
* accessible on the server for use in multi-turn conversations.
|
|
231
|
+
*/
|
|
232
|
+
expires_at: number;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Transcript of the audio generated by the model.
|
|
236
|
+
*/
|
|
237
|
+
transcript: string;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Parameters for audio output. Required when audio output is requested with
|
|
242
|
+
* `modalities: ["audio"]`.
|
|
243
|
+
* [Learn more](https://platform.openai.com/docs/guides/audio).
|
|
244
|
+
*/
|
|
245
|
+
export interface ChatCompletionAudioParam {
|
|
246
|
+
/**
|
|
247
|
+
* Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, `opus`,
|
|
248
|
+
* or `pcm16`.
|
|
249
|
+
*/
|
|
250
|
+
format: 'wav' | 'mp3' | 'flac' | 'opus' | 'pcm16';
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Specifies the voice type. Supported voices are `alloy`, `echo`, `fable`, `onyx`,
|
|
254
|
+
* `nova`, and `shimmer`.
|
|
255
|
+
*/
|
|
256
|
+
voice: 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer';
|
|
257
|
+
}
|
|
258
|
+
|
|
191
259
|
/**
|
|
192
260
|
* Represents a streamed chunk of a chat completion response returned by model,
|
|
193
261
|
* based on the provided input.
|
|
@@ -371,8 +439,18 @@ export namespace ChatCompletionChunk {
|
|
|
371
439
|
}
|
|
372
440
|
}
|
|
373
441
|
|
|
374
|
-
|
|
442
|
+
/**
|
|
443
|
+
* Learn about
|
|
444
|
+
* [text inputs](https://platform.openai.com/docs/guides/text-generation).
|
|
445
|
+
*/
|
|
446
|
+
export type ChatCompletionContentPart =
|
|
447
|
+
| ChatCompletionContentPartText
|
|
448
|
+
| ChatCompletionContentPartImage
|
|
449
|
+
| ChatCompletionContentPartInputAudio;
|
|
375
450
|
|
|
451
|
+
/**
|
|
452
|
+
* Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
|
|
453
|
+
*/
|
|
376
454
|
export interface ChatCompletionContentPartImage {
|
|
377
455
|
image_url: ChatCompletionContentPartImage.ImageURL;
|
|
378
456
|
|
|
@@ -397,6 +475,32 @@ export namespace ChatCompletionContentPartImage {
|
|
|
397
475
|
}
|
|
398
476
|
}
|
|
399
477
|
|
|
478
|
+
/**
|
|
479
|
+
* Learn about [audio inputs](https://platform.openai.com/docs/guides/audio).
|
|
480
|
+
*/
|
|
481
|
+
export interface ChatCompletionContentPartInputAudio {
|
|
482
|
+
input_audio: ChatCompletionContentPartInputAudio.InputAudio;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* The type of the content part. Always `input_audio`.
|
|
486
|
+
*/
|
|
487
|
+
type: 'input_audio';
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export namespace ChatCompletionContentPartInputAudio {
|
|
491
|
+
export interface InputAudio {
|
|
492
|
+
/**
|
|
493
|
+
* Base64 encoded audio data.
|
|
494
|
+
*/
|
|
495
|
+
data: string;
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* The format of the encoded audio data. Currently supports "wav" and "mp3".
|
|
499
|
+
*/
|
|
500
|
+
format: 'wav' | 'mp3';
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
400
504
|
export interface ChatCompletionContentPartRefusal {
|
|
401
505
|
/**
|
|
402
506
|
* The refusal message generated by the model.
|
|
@@ -409,6 +513,10 @@ export interface ChatCompletionContentPartRefusal {
|
|
|
409
513
|
type: 'refusal';
|
|
410
514
|
}
|
|
411
515
|
|
|
516
|
+
/**
|
|
517
|
+
* Learn about
|
|
518
|
+
* [text inputs](https://platform.openai.com/docs/guides/text-generation).
|
|
519
|
+
*/
|
|
412
520
|
export interface ChatCompletionContentPartText {
|
|
413
521
|
/**
|
|
414
522
|
* The text content.
|
|
@@ -471,6 +579,13 @@ export interface ChatCompletionMessage {
|
|
|
471
579
|
*/
|
|
472
580
|
role: 'assistant';
|
|
473
581
|
|
|
582
|
+
/**
|
|
583
|
+
* If the audio output modality is requested, this object contains data about the
|
|
584
|
+
* audio response from the model.
|
|
585
|
+
* [Learn more](https://platform.openai.com/docs/guides/audio).
|
|
586
|
+
*/
|
|
587
|
+
audio?: ChatCompletionAudio | null;
|
|
588
|
+
|
|
474
589
|
/**
|
|
475
590
|
* @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of
|
|
476
591
|
* a function that should be called, as generated by the model.
|
|
@@ -548,6 +663,8 @@ export namespace ChatCompletionMessageToolCall {
|
|
|
548
663
|
}
|
|
549
664
|
}
|
|
550
665
|
|
|
666
|
+
export type ChatCompletionModality = 'text' | 'audio';
|
|
667
|
+
|
|
551
668
|
/**
|
|
552
669
|
* Specifies a tool the model should use. Use to force the model to call a specific
|
|
553
670
|
* function.
|
|
@@ -743,6 +860,13 @@ export interface ChatCompletionCreateParamsBase {
|
|
|
743
860
|
*/
|
|
744
861
|
model: (string & {}) | ChatAPI.ChatModel;
|
|
745
862
|
|
|
863
|
+
/**
|
|
864
|
+
* Parameters for audio output. Required when audio output is requested with
|
|
865
|
+
* `modalities: ["audio"]`.
|
|
866
|
+
* [Learn more](https://platform.openai.com/docs/guides/audio).
|
|
867
|
+
*/
|
|
868
|
+
audio?: ChatCompletionAudioParam | null;
|
|
869
|
+
|
|
746
870
|
/**
|
|
747
871
|
* Number between -2.0 and 2.0. Positive values penalize new tokens based on their
|
|
748
872
|
* existing frequency in the text so far, decreasing the model's likelihood to
|
|
@@ -812,10 +936,24 @@ export interface ChatCompletionCreateParamsBase {
|
|
|
812
936
|
|
|
813
937
|
/**
|
|
814
938
|
* Developer-defined tags and values used for filtering completions in the
|
|
815
|
-
* [dashboard](https://platform.openai.com/completions).
|
|
939
|
+
* [dashboard](https://platform.openai.com/chat-completions).
|
|
816
940
|
*/
|
|
817
941
|
metadata?: Record<string, string> | null;
|
|
818
942
|
|
|
943
|
+
/**
|
|
944
|
+
* Output types that you would like the model to generate for this request. Most
|
|
945
|
+
* models are capable of generating text, which is the default:
|
|
946
|
+
*
|
|
947
|
+
* `["text"]`
|
|
948
|
+
*
|
|
949
|
+
* The `gpt-4o-audio-preview` model can also be used to
|
|
950
|
+
* [generate audio](https://platform.openai.com/docs/guides/audio). To request that
|
|
951
|
+
* this model generate both text and audio responses, you can use:
|
|
952
|
+
*
|
|
953
|
+
* `["text", "audio"]`
|
|
954
|
+
*/
|
|
955
|
+
modalities?: Array<ChatCompletionModality> | null;
|
|
956
|
+
|
|
819
957
|
/**
|
|
820
958
|
* How many chat completion choices to generate for each input message. Note that
|
|
821
959
|
* you will be charged based on the number of generated tokens across all of the
|
|
@@ -900,8 +1038,9 @@ export interface ChatCompletionCreateParamsBase {
|
|
|
900
1038
|
stop?: string | null | Array<string>;
|
|
901
1039
|
|
|
902
1040
|
/**
|
|
903
|
-
* Whether or not to store the output of this completion request for
|
|
904
|
-
*
|
|
1041
|
+
* Whether or not to store the output of this chat completion request for use in
|
|
1042
|
+
* our [model distillation](https://platform.openai.com/docs/guides/distillation)
|
|
1043
|
+
* or [evals](https://platform.openai.com/docs/guides/evals) products.
|
|
905
1044
|
*/
|
|
906
1045
|
store?: boolean | null;
|
|
907
1046
|
|
|
@@ -1049,9 +1188,12 @@ export type CompletionCreateParamsStreaming = ChatCompletionCreateParamsStreamin
|
|
|
1049
1188
|
export namespace Completions {
|
|
1050
1189
|
export import ChatCompletion = ChatCompletionsAPI.ChatCompletion;
|
|
1051
1190
|
export import ChatCompletionAssistantMessageParam = ChatCompletionsAPI.ChatCompletionAssistantMessageParam;
|
|
1191
|
+
export import ChatCompletionAudio = ChatCompletionsAPI.ChatCompletionAudio;
|
|
1192
|
+
export import ChatCompletionAudioParam = ChatCompletionsAPI.ChatCompletionAudioParam;
|
|
1052
1193
|
export import ChatCompletionChunk = ChatCompletionsAPI.ChatCompletionChunk;
|
|
1053
1194
|
export import ChatCompletionContentPart = ChatCompletionsAPI.ChatCompletionContentPart;
|
|
1054
1195
|
export import ChatCompletionContentPartImage = ChatCompletionsAPI.ChatCompletionContentPartImage;
|
|
1196
|
+
export import ChatCompletionContentPartInputAudio = ChatCompletionsAPI.ChatCompletionContentPartInputAudio;
|
|
1055
1197
|
export import ChatCompletionContentPartRefusal = ChatCompletionsAPI.ChatCompletionContentPartRefusal;
|
|
1056
1198
|
export import ChatCompletionContentPartText = ChatCompletionsAPI.ChatCompletionContentPartText;
|
|
1057
1199
|
export import ChatCompletionFunctionCallOption = ChatCompletionsAPI.ChatCompletionFunctionCallOption;
|
|
@@ -1059,6 +1201,7 @@ export namespace Completions {
|
|
|
1059
1201
|
export import ChatCompletionMessage = ChatCompletionsAPI.ChatCompletionMessage;
|
|
1060
1202
|
export import ChatCompletionMessageParam = ChatCompletionsAPI.ChatCompletionMessageParam;
|
|
1061
1203
|
export import ChatCompletionMessageToolCall = ChatCompletionsAPI.ChatCompletionMessageToolCall;
|
|
1204
|
+
export import ChatCompletionModality = ChatCompletionsAPI.ChatCompletionModality;
|
|
1062
1205
|
export import ChatCompletionNamedToolChoice = ChatCompletionsAPI.ChatCompletionNamedToolChoice;
|
|
1063
1206
|
export import ChatCompletionRole = ChatCompletionsAPI.ChatCompletionRole;
|
|
1064
1207
|
export import ChatCompletionStreamOptions = ChatCompletionsAPI.ChatCompletionStreamOptions;
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
export {
|
|
4
4
|
ChatCompletion,
|
|
5
5
|
ChatCompletionAssistantMessageParam,
|
|
6
|
+
ChatCompletionAudio,
|
|
7
|
+
ChatCompletionAudioParam,
|
|
6
8
|
ChatCompletionChunk,
|
|
7
9
|
ChatCompletionContentPart,
|
|
8
10
|
ChatCompletionContentPartImage,
|
|
11
|
+
ChatCompletionContentPartInputAudio,
|
|
9
12
|
ChatCompletionContentPartRefusal,
|
|
10
13
|
ChatCompletionContentPartText,
|
|
11
14
|
ChatCompletionFunctionCallOption,
|
|
@@ -13,6 +16,7 @@ export {
|
|
|
13
16
|
ChatCompletionMessage,
|
|
14
17
|
ChatCompletionMessageParam,
|
|
15
18
|
ChatCompletionMessageToolCall,
|
|
19
|
+
ChatCompletionModality,
|
|
16
20
|
ChatCompletionNamedToolChoice,
|
|
17
21
|
ChatCompletionRole,
|
|
18
22
|
ChatCompletionStreamOptions,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.68.0'; // x-release-please-version
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.68.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.68.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|