Skip to content

Commit 5d9bff5

Browse files
stainless-botRobertCraigie
authored andcommitted
feat(api): update enum values, comments, and examples
chore: unknown commit message
1 parent 76959f8 commit 5d9bff5

File tree

9 files changed

+49
-66
lines changed

9 files changed

+49
-66
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 69
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b5b0e2c794b012919701c3fd43286af10fa25d33ceb8a881bec2636028f446e0.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-3904ef6b29a89c98f93a9b7da19879695f3c440564be6384db7af1b734611ede.yml

src/resources/audio/speech.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ export interface SpeechCreateParams {
3434
model: (string & {}) | SpeechModel;
3535

3636
/**
37-
* The voice to use when generating the audio. Supported voices are `alloy`,
38-
* `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are
39-
* available in the
37+
* The voice to use when generating the audio. Supported voices are `alloy`, `ash`,
38+
* `coral`, `echo`, `fable`, `onyx`, `nova`, `sage` and `shimmer`. Previews of the
39+
* voices are available in the
4040
* [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
4141
*/
42-
voice: 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer';
42+
voice: 'alloy' | 'ash' | 'coral' | 'echo' | 'fable' | 'onyx' | 'nova' | 'sage' | 'shimmer';
4343

4444
/**
4545
* The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,

src/resources/beta/realtime/realtime.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,10 @@ export interface ConversationItemCreateEvent {
173173

174174
/**
175175
* The ID of the preceding item after which the new item will be inserted. If not
176-
* set, the new item will be appended to the end of the conversation. If set, it
177-
* allows an item to be inserted mid-conversation. If the ID cannot be found, an
178-
* error will be returned and the item will not be added.
176+
* set, the new item will be appended to the end of the conversation. If set to
177+
* `root`, the new item will be added to the beginning of the conversation. If set
178+
* to an existing ID, it allows an item to be inserted mid-conversation. If the ID
179+
* cannot be found, an error will be returned and the item will not be added.
179180
*/
180181
previous_item_id?: string;
181182
}
@@ -1705,17 +1706,9 @@ export namespace SessionUpdateEvent {
17051706
*/
17061707
export interface Session {
17071708
/**
1708-
* The Realtime model used for this session.
1709-
*/
1710-
model:
1711-
| 'gpt-4o-realtime-preview'
1712-
| 'gpt-4o-realtime-preview-2024-10-01'
1713-
| 'gpt-4o-realtime-preview-2024-12-17'
1714-
| 'gpt-4o-mini-realtime-preview'
1715-
| 'gpt-4o-mini-realtime-preview-2024-12-17';
1716-
1717-
/**
1718-
* The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
1709+
* The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For
1710+
* `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel
1711+
* (mono), and little-endian byte order.
17191712
*/
17201713
input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw';
17211714

@@ -1756,8 +1749,19 @@ export namespace SessionUpdateEvent {
17561749
*/
17571750
modalities?: Array<'text' | 'audio'>;
17581751

1752+
/**
1753+
* The Realtime model used for this session.
1754+
*/
1755+
model?:
1756+
| 'gpt-4o-realtime-preview'
1757+
| 'gpt-4o-realtime-preview-2024-10-01'
1758+
| 'gpt-4o-realtime-preview-2024-12-17'
1759+
| 'gpt-4o-mini-realtime-preview'
1760+
| 'gpt-4o-mini-realtime-preview-2024-12-17';
1761+
17591762
/**
17601763
* The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
1764+
* For `pcm16`, output audio is sampled at a rate of 24kHz.
17611765
*/
17621766
output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw';
17631767

src/resources/beta/realtime/sessions.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ export interface Session {
3434
id?: string;
3535

3636
/**
37-
* The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
37+
* The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For
38+
* `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel
39+
* (mono), and little-endian byte order.
3840
*/
3941
input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw';
4042

@@ -88,6 +90,7 @@ export interface Session {
8890

8991
/**
9092
* The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
93+
* For `pcm16`, output audio is sampled at a rate of 24kHz.
9194
*/
9295
output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw';
9396

@@ -374,17 +377,9 @@ export namespace SessionCreateResponse {
374377

375378
export interface SessionCreateParams {
376379
/**
377-
* The Realtime model used for this session.
378-
*/
379-
model:
380-
| 'gpt-4o-realtime-preview'
381-
| 'gpt-4o-realtime-preview-2024-10-01'
382-
| 'gpt-4o-realtime-preview-2024-12-17'
383-
| 'gpt-4o-mini-realtime-preview'
384-
| 'gpt-4o-mini-realtime-preview-2024-12-17';
385-
386-
/**
387-
* The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
380+
* The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For
381+
* `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel
382+
* (mono), and little-endian byte order.
388383
*/
389384
input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw';
390385

@@ -425,8 +420,19 @@ export interface SessionCreateParams {
425420
*/
426421
modalities?: Array<'text' | 'audio'>;
427422

423+
/**
424+
* The Realtime model used for this session.
425+
*/
426+
model?:
427+
| 'gpt-4o-realtime-preview'
428+
| 'gpt-4o-realtime-preview-2024-10-01'
429+
| 'gpt-4o-realtime-preview-2024-12-17'
430+
| 'gpt-4o-mini-realtime-preview'
431+
| 'gpt-4o-mini-realtime-preview-2024-12-17';
432+
428433
/**
429434
* The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
435+
* For `pcm16`, output audio is sampled at a rate of 24kHz.
430436
*/
431437
output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw';
432438

src/resources/chat/completions.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ export interface ChatCompletion {
7373
object: 'chat.completion';
7474

7575
/**
76-
* The service tier used for processing the request. This field is only included if
77-
* the `service_tier` parameter is specified in the request.
76+
* The service tier used for processing the request.
7877
*/
7978
service_tier?: 'scale' | 'default' | null;
8079

@@ -297,8 +296,7 @@ export interface ChatCompletionChunk {
297296
object: 'chat.completion.chunk';
298297

299298
/**
300-
* The service tier used for processing the request. This field is only included if
301-
* the `service_tier` parameter is specified in the request.
299+
* The service tier used for processing the request.
302300
*/
303301
service_tier?: 'scale' | 'default' | null;
304302

@@ -1107,9 +1105,6 @@ export interface ChatCompletionCreateParamsBase {
11071105
* - If set to 'default', the request will be processed using the default service
11081106
* tier with a lower uptime SLA and no latency guarentee.
11091107
* - When not set, the default behavior is 'auto'.
1110-
*
1111-
* When this parameter is set, the response body will include the `service_tier`
1112-
* utilized.
11131108
*/
11141109
service_tier?: 'auto' | 'default' | null;
11151110

src/resources/embeddings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ export interface EmbeddingCreateParams {
8484
* `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048
8585
* dimensions or less.
8686
* [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken)
87-
* for counting tokens.
87+
* for counting tokens. Some models may also impose a limit on total number of
88+
* tokens summed across inputs.
8889
*/
8990
input: string | Array<string> | Array<number> | Array<Array<number>>;
9091

tests/api-resources/beta/realtime/sessions.test.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const client = new OpenAI({
88
});
99

1010
describe('resource sessions', () => {
11-
test('create: only required params', async () => {
12-
const responsePromise = client.beta.realtime.sessions.create({ model: 'gpt-4o-realtime-preview' });
11+
test('create', async () => {
12+
const responsePromise = client.beta.realtime.sessions.create({});
1313
const rawResponse = await responsePromise.asResponse();
1414
expect(rawResponse).toBeInstanceOf(Response);
1515
const response = await responsePromise;
@@ -18,27 +18,4 @@ describe('resource sessions', () => {
1818
expect(dataAndResponse.data).toBe(response);
1919
expect(dataAndResponse.response).toBe(rawResponse);
2020
});
21-
22-
test('create: required and optional params', async () => {
23-
const response = await client.beta.realtime.sessions.create({
24-
model: 'gpt-4o-realtime-preview',
25-
input_audio_format: 'pcm16',
26-
input_audio_transcription: { model: 'model' },
27-
instructions: 'instructions',
28-
max_response_output_tokens: 0,
29-
modalities: ['text'],
30-
output_audio_format: 'pcm16',
31-
temperature: 0,
32-
tool_choice: 'tool_choice',
33-
tools: [{ description: 'description', name: 'name', parameters: {}, type: 'function' }],
34-
turn_detection: {
35-
create_response: true,
36-
prefix_padding_ms: 0,
37-
silence_duration_ms: 0,
38-
threshold: 0,
39-
type: 'type',
40-
},
41-
voice: 'alloy',
42-
});
43-
});
4421
});

tests/api-resources/chat/completions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('resource completions', () => {
4242
presence_penalty: -2,
4343
reasoning_effort: 'low',
4444
response_format: { type: 'text' },
45-
seed: -9007199254740991,
45+
seed: 0,
4646
service_tier: 'auto',
4747
stop: 'string',
4848
store: true,

tests/api-resources/completions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('resource completions', () => {
3131
max_tokens: 16,
3232
n: 1,
3333
presence_penalty: -2,
34-
seed: -9007199254740991,
34+
seed: 0,
3535
stop: '\n',
3636
stream: false,
3737
stream_options: { include_usage: true },

0 commit comments

Comments
 (0)