Skip to content

Commit 948965c

Browse files
feat: extract out ImageModel, AudioModel, SpeechModel (#964)
1 parent a945b23 commit 948965c

File tree

13 files changed

+53
-85
lines changed

13 files changed

+53
-85
lines changed

api.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Methods:
8787
Types:
8888

8989
- <code><a href="./src/resources/images.ts">Image</a></code>
90+
- <code><a href="./src/resources/images.ts">ImageModel</a></code>
9091
- <code><a href="./src/resources/images.ts">ImagesResponse</a></code>
9192

9293
Methods:
@@ -97,6 +98,10 @@ Methods:
9798

9899
# Audio
99100

101+
Types:
102+
103+
- <code><a href="./src/resources/audio/audio.ts">AudioModel</a></code>
104+
100105
## Transcriptions
101106

102107
Types:
@@ -119,6 +124,10 @@ Methods:
119124

120125
## Speech
121126

127+
Types:
128+
129+
- <code><a href="./src/resources/audio/speech.ts">SpeechModel</a></code>
130+
122131
Methods:
123132

124133
- <code title="post /audio/speech">client.audio.speech.<a href="./src/resources/audio/speech.ts">create</a>({ ...params }) -> Response</code>
@@ -128,6 +137,7 @@ Methods:
128137
Types:
129138

130139
- <code><a href="./src/resources/moderations.ts">Moderation</a></code>
140+
- <code><a href="./src/resources/moderations.ts">ModerationModel</a></code>
131141
- <code><a href="./src/resources/moderations.ts">ModerationCreateResponse</a></code>
132142

133143
Methods:

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,18 @@ export namespace OpenAI {
282282

283283
export import Images = API.Images;
284284
export import Image = API.Image;
285+
export import ImageModel = API.ImageModel;
285286
export import ImagesResponse = API.ImagesResponse;
286287
export import ImageCreateVariationParams = API.ImageCreateVariationParams;
287288
export import ImageEditParams = API.ImageEditParams;
288289
export import ImageGenerateParams = API.ImageGenerateParams;
289290

290291
export import Audio = API.Audio;
292+
export import AudioModel = API.AudioModel;
291293

292294
export import Moderations = API.Moderations;
293295
export import Moderation = API.Moderation;
296+
export import ModerationModel = API.ModerationModel;
294297
export import ModerationCreateResponse = API.ModerationCreateResponse;
295298
export import ModerationCreateParams = API.ModerationCreateParams;
296299

src/resources/audio/audio.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
import { APIResource } from '../../resource';
4+
import * as AudioAPI from './audio';
45
import * as SpeechAPI from './speech';
56
import * as TranscriptionsAPI from './transcriptions';
67
import * as TranslationsAPI from './translations';
@@ -11,13 +12,17 @@ export class Audio extends APIResource {
1112
speech: SpeechAPI.Speech = new SpeechAPI.Speech(this._client);
1213
}
1314

15+
export type AudioModel = 'whisper-1';
16+
1417
export namespace Audio {
18+
export import AudioModel = AudioAPI.AudioModel;
1519
export import Transcriptions = TranscriptionsAPI.Transcriptions;
1620
export import Transcription = TranscriptionsAPI.Transcription;
1721
export import TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams;
1822
export import Translations = TranslationsAPI.Translations;
1923
export import Translation = TranslationsAPI.Translation;
2024
export import TranslationCreateParams = TranslationsAPI.TranslationCreateParams;
2125
export import Speech = SpeechAPI.Speech;
26+
export import SpeechModel = SpeechAPI.SpeechModel;
2227
export import SpeechCreateParams = SpeechAPI.SpeechCreateParams;
2328
}

src/resources/audio/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
export { Audio } from './audio';
4-
export { SpeechCreateParams, Speech } from './speech';
3+
export { AudioModel, Audio } from './audio';
4+
export { SpeechModel, SpeechCreateParams, Speech } from './speech';
55
export { Transcription, TranscriptionCreateParams, Transcriptions } from './transcriptions';
66
export { Translation, TranslationCreateParams, Translations } from './translations';

src/resources/audio/speech.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export class Speech extends APIResource {
1414
}
1515
}
1616

17+
export type SpeechModel = 'tts-1' | 'tts-1-hd';
18+
1719
export interface SpeechCreateParams {
1820
/**
1921
* The text to generate audio for. The maximum length is 4096 characters.
@@ -24,7 +26,7 @@ export interface SpeechCreateParams {
2426
* One of the available [TTS models](https://platform.openai.com/docs/models/tts):
2527
* `tts-1` or `tts-1-hd`
2628
*/
27-
model: (string & {}) | 'tts-1' | 'tts-1-hd';
29+
model: (string & {}) | SpeechModel;
2830

2931
/**
3032
* The voice to use when generating the audio. Supported voices are `alloy`,
@@ -48,5 +50,6 @@ export interface SpeechCreateParams {
4850
}
4951

5052
export namespace Speech {
53+
export import SpeechModel = SpeechAPI.SpeechModel;
5154
export import SpeechCreateParams = SpeechAPI.SpeechCreateParams;
5255
}

src/resources/audio/transcriptions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { APIResource } from '../../resource';
44
import * as Core from '../../core';
55
import * as TranscriptionsAPI from './transcriptions';
6+
import * as AudioAPI from './audio';
67

78
export class Transcriptions extends APIResource {
89
/**
@@ -35,7 +36,7 @@ export interface TranscriptionCreateParams {
3536
* ID of the model to use. Only `whisper-1` (which is powered by our open source
3637
* Whisper V2 model) is currently available.
3738
*/
38-
model: (string & {}) | 'whisper-1';
39+
model: (string & {}) | AudioAPI.AudioModel;
3940

4041
/**
4142
* The language of the input audio. Supplying the input language in

src/resources/audio/translations.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { APIResource } from '../../resource';
44
import * as Core from '../../core';
55
import * as TranslationsAPI from './translations';
6+
import * as AudioAPI from './audio';
67

78
export class Translations extends APIResource {
89
/**
@@ -28,7 +29,7 @@ export interface TranslationCreateParams {
2829
* ID of the model to use. Only `whisper-1` (which is powered by our open source
2930
* Whisper V2 model) is currently available.
3031
*/
31-
model: (string & {}) | 'whisper-1';
32+
model: (string & {}) | AudioAPI.AudioModel;
3233

3334
/**
3435
* An optional text to guide the model's style or continue a previous audio

src/resources/beta/assistants.ts

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { isRequestOptions } from '../../core';
55
import * as Core from '../../core';
66
import * as AssistantsAPI from './assistants';
77
import * as Shared from '../shared';
8+
import * as ChatAPI from '../chat/chat';
89
import * as MessagesAPI from './threads/messages';
910
import * as ThreadsAPI from './threads/threads';
1011
import * as RunsAPI from './threads/runs/runs';
@@ -1053,30 +1054,7 @@ export interface AssistantCreateParams {
10531054
* [Model overview](https://platform.openai.com/docs/models/overview) for
10541055
* descriptions of them.
10551056
*/
1056-
model:
1057-
| (string & {})
1058-
| 'gpt-4o'
1059-
| 'gpt-4o-2024-05-13'
1060-
| 'gpt-4o-mini'
1061-
| 'gpt-4o-mini-2024-07-18'
1062-
| 'gpt-4-turbo'
1063-
| 'gpt-4-turbo-2024-04-09'
1064-
| 'gpt-4-0125-preview'
1065-
| 'gpt-4-turbo-preview'
1066-
| 'gpt-4-1106-preview'
1067-
| 'gpt-4-vision-preview'
1068-
| 'gpt-4'
1069-
| 'gpt-4-0314'
1070-
| 'gpt-4-0613'
1071-
| 'gpt-4-32k'
1072-
| 'gpt-4-32k-0314'
1073-
| 'gpt-4-32k-0613'
1074-
| 'gpt-3.5-turbo'
1075-
| 'gpt-3.5-turbo-16k'
1076-
| 'gpt-3.5-turbo-0613'
1077-
| 'gpt-3.5-turbo-1106'
1078-
| 'gpt-3.5-turbo-0125'
1079-
| 'gpt-3.5-turbo-16k-0613';
1057+
model: (string & {}) | ChatAPI.ChatModel;
10801058

10811059
/**
10821060
* The description of the assistant. The maximum length is 512 characters.

src/resources/beta/threads/runs/runs.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { APIPromise } from '../../../../core';
66
import * as Core from '../../../../core';
77
import * as RunsAPI from './runs';
88
import * as AssistantsAPI from '../../assistants';
9+
import * as ChatAPI from '../../../chat/chat';
910
import * as MessagesAPI from '../messages';
1011
import * as ThreadsAPI from '../threads';
1112
import * as StepsAPI from './steps';
@@ -542,31 +543,7 @@ export interface RunCreateParamsBase {
542543
* model associated with the assistant. If not, the model associated with the
543544
* assistant will be used.
544545
*/
545-
model?:
546-
| (string & {})
547-
| 'gpt-4o'
548-
| 'gpt-4o-2024-05-13'
549-
| 'gpt-4o-mini'
550-
| 'gpt-4o-mini-2024-07-18'
551-
| 'gpt-4-turbo'
552-
| 'gpt-4-turbo-2024-04-09'
553-
| 'gpt-4-0125-preview'
554-
| 'gpt-4-turbo-preview'
555-
| 'gpt-4-1106-preview'
556-
| 'gpt-4-vision-preview'
557-
| 'gpt-4'
558-
| 'gpt-4-0314'
559-
| 'gpt-4-0613'
560-
| 'gpt-4-32k'
561-
| 'gpt-4-32k-0314'
562-
| 'gpt-4-32k-0613'
563-
| 'gpt-3.5-turbo'
564-
| 'gpt-3.5-turbo-16k'
565-
| 'gpt-3.5-turbo-0613'
566-
| 'gpt-3.5-turbo-1106'
567-
| 'gpt-3.5-turbo-0125'
568-
| 'gpt-3.5-turbo-16k-0613'
569-
| null;
546+
model?: (string & {}) | ChatAPI.ChatModel | null;
570547

571548
/**
572549
* Whether to enable

src/resources/beta/threads/threads.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { APIPromise } from '../../../core';
66
import * as Core from '../../../core';
77
import * as ThreadsAPI from './threads';
88
import * as AssistantsAPI from '../assistants';
9+
import * as ChatAPI from '../../chat/chat';
910
import * as MessagesAPI from './messages';
1011
import * as RunsAPI from './runs/runs';
1112
import { Stream } from '../../../streaming';
@@ -521,31 +522,7 @@ export interface ThreadCreateAndRunParamsBase {
521522
* model associated with the assistant. If not, the model associated with the
522523
* assistant will be used.
523524
*/
524-
model?:
525-
| (string & {})
526-
| 'gpt-4o'
527-
| 'gpt-4o-2024-05-13'
528-
| 'gpt-4o-mini'
529-
| 'gpt-4o-mini-2024-07-18'
530-
| 'gpt-4-turbo'
531-
| 'gpt-4-turbo-2024-04-09'
532-
| 'gpt-4-0125-preview'
533-
| 'gpt-4-turbo-preview'
534-
| 'gpt-4-1106-preview'
535-
| 'gpt-4-vision-preview'
536-
| 'gpt-4'
537-
| 'gpt-4-0314'
538-
| 'gpt-4-0613'
539-
| 'gpt-4-32k'
540-
| 'gpt-4-32k-0314'
541-
| 'gpt-4-32k-0613'
542-
| 'gpt-3.5-turbo'
543-
| 'gpt-3.5-turbo-16k'
544-
| 'gpt-3.5-turbo-0613'
545-
| 'gpt-3.5-turbo-1106'
546-
| 'gpt-3.5-turbo-0125'
547-
| 'gpt-3.5-turbo-16k-0613'
548-
| null;
525+
model?: (string & {}) | ChatAPI.ChatModel | null;
549526

550527
/**
551528
* Whether to enable

0 commit comments

Comments
 (0)