Skip to content

Commit 3e71bdb

Browse files
feat(api): add new text parameters, expiration options
1 parent f5b0a0b commit 3e71bdb

File tree

16 files changed

+194
-65
lines changed

16 files changed

+194
-65
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 111
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-9cadfad609f94f20ebf74fdc06a80302f1a324dc69700a309a8056aabca82fd2.yml
3-
openapi_spec_hash: 3eb8d86c06f0bb5e1190983e5acfc9ba
4-
config_hash: 68337b532875626269c304372a669f67
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-24be531010b354303d741fc9247c1f84f75978f9f7de68aca92cb4f240a04722.yml
3+
openapi_spec_hash: 3e46f439f6a863beadc71577eb4efa15
4+
config_hash: ed87b9139ac595a04a2162d754df2fed

src/resources/batches.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,33 @@ export interface BatchCreateParams {
244244
* a maximum length of 512 characters.
245245
*/
246246
metadata?: Shared.Metadata | null;
247+
248+
/**
249+
* The expiration policy for the output and/or error file that are generated for a
250+
* batch.
251+
*/
252+
output_expires_after?: BatchCreateParams.OutputExpiresAfter;
253+
}
254+
255+
export namespace BatchCreateParams {
256+
/**
257+
* The expiration policy for the output and/or error file that are generated for a
258+
* batch.
259+
*/
260+
export interface OutputExpiresAfter {
261+
/**
262+
* Anchor timestamp after which the expiration policy applies. Supported anchors:
263+
* `created_at`. Note that the anchor is the file creation time, not the time the
264+
* batch is created.
265+
*/
266+
anchor: 'created_at';
267+
268+
/**
269+
* The number of seconds after the anchor time that the file will expire. Must be
270+
* between 3600 (1 hour) and 2592000 (30 days).
271+
*/
272+
seconds: number;
273+
}
247274
}
248275

249276
export interface BatchListParams extends CursorPageParams {}

src/resources/beta/realtime/realtime.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,8 @@ export interface ResponseAudioTranscriptDoneEvent {
15451545

15461546
/**
15471547
* Send this event to cancel an in-progress response. The server will respond with
1548-
* a `response.cancelled` event or an error if there is no response to cancel.
1548+
* a `response.done` event with a status of `response.status=cancelled`. If there
1549+
* is no response to cancel, the server will respond with an error.
15491550
*/
15501551
export interface ResponseCancelEvent {
15511552
/**
@@ -2287,7 +2288,7 @@ export namespace SessionUpdateEvent {
22872288
* set to `null` to turn off, in which case the client must manually trigger model
22882289
* response. Server VAD means that the model will detect the start and end of
22892290
* speech based on audio volume and respond at the end of user speech. Semantic VAD
2290-
* is more advanced and uses a turn detection model (in conjuction with VAD) to
2291+
* is more advanced and uses a turn detection model (in conjunction with VAD) to
22912292
* semantically estimate whether the user has finished speaking, then dynamically
22922293
* sets a timeout based on this probability. For example, if user audio trails off
22932294
* with "uhhm", the model will score a low probability of turn end and wait longer
@@ -2435,7 +2436,7 @@ export namespace SessionUpdateEvent {
24352436
* set to `null` to turn off, in which case the client must manually trigger model
24362437
* response. Server VAD means that the model will detect the start and end of
24372438
* speech based on audio volume and respond at the end of user speech. Semantic VAD
2438-
* is more advanced and uses a turn detection model (in conjuction with VAD) to
2439+
* is more advanced and uses a turn detection model (in conjunction with VAD) to
24392440
* semantically estimate whether the user has finished speaking, then dynamically
24402441
* sets a timeout based on this probability. For example, if user audio trails off
24412442
* with "uhhm", the model will score a low probability of turn end and wait longer
@@ -2583,7 +2584,7 @@ export namespace TranscriptionSessionUpdate {
25832584
* set to `null` to turn off, in which case the client must manually trigger model
25842585
* response. Server VAD means that the model will detect the start and end of
25852586
* speech based on audio volume and respond at the end of user speech. Semantic VAD
2586-
* is more advanced and uses a turn detection model (in conjuction with VAD) to
2587+
* is more advanced and uses a turn detection model (in conjunction with VAD) to
25872588
* semantically estimate whether the user has finished speaking, then dynamically
25882589
* sets a timeout based on this probability. For example, if user audio trails off
25892590
* with "uhhm", the model will score a low probability of turn end and wait longer
@@ -2673,7 +2674,7 @@ export namespace TranscriptionSessionUpdate {
26732674
* set to `null` to turn off, in which case the client must manually trigger model
26742675
* response. Server VAD means that the model will detect the start and end of
26752676
* speech based on audio volume and respond at the end of user speech. Semantic VAD
2676-
* is more advanced and uses a turn detection model (in conjuction with VAD) to
2677+
* is more advanced and uses a turn detection model (in conjunction with VAD) to
26772678
* semantically estimate whether the user has finished speaking, then dynamically
26782679
* sets a timeout based on this probability. For example, if user audio trails off
26792680
* with "uhhm", the model will score a low probability of turn end and wait longer

src/resources/beta/realtime/sessions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export interface Session {
150150
* set to `null` to turn off, in which case the client must manually trigger model
151151
* response. Server VAD means that the model will detect the start and end of
152152
* speech based on audio volume and respond at the end of user speech. Semantic VAD
153-
* is more advanced and uses a turn detection model (in conjuction with VAD) to
153+
* is more advanced and uses a turn detection model (in conjunction with VAD) to
154154
* semantically estimate whether the user has finished speaking, then dynamically
155155
* sets a timeout based on this probability. For example, if user audio trails off
156156
* with "uhhm", the model will score a low probability of turn end and wait longer
@@ -269,7 +269,7 @@ export namespace Session {
269269
* set to `null` to turn off, in which case the client must manually trigger model
270270
* response. Server VAD means that the model will detect the start and end of
271271
* speech based on audio volume and respond at the end of user speech. Semantic VAD
272-
* is more advanced and uses a turn detection model (in conjuction with VAD) to
272+
* is more advanced and uses a turn detection model (in conjunction with VAD) to
273273
* semantically estimate whether the user has finished speaking, then dynamically
274274
* sets a timeout based on this probability. For example, if user audio trails off
275275
* with "uhhm", the model will score a low probability of turn end and wait longer
@@ -325,7 +325,7 @@ export namespace Session {
325325
}
326326

327327
/**
328-
* A new Realtime session configuration, with an ephermeral key. Default TTL for
328+
* A new Realtime session configuration, with an ephemeral key. Default TTL for
329329
* keys is one minute.
330330
*/
331331
export interface SessionCreateResponse {
@@ -657,7 +657,7 @@ export interface SessionCreateParams {
657657
* set to `null` to turn off, in which case the client must manually trigger model
658658
* response. Server VAD means that the model will detect the start and end of
659659
* speech based on audio volume and respond at the end of user speech. Semantic VAD
660-
* is more advanced and uses a turn detection model (in conjuction with VAD) to
660+
* is more advanced and uses a turn detection model (in conjunction with VAD) to
661661
* semantically estimate whether the user has finished speaking, then dynamically
662662
* sets a timeout based on this probability. For example, if user audio trails off
663663
* with "uhhm", the model will score a low probability of turn end and wait longer
@@ -805,7 +805,7 @@ export namespace SessionCreateParams {
805805
* set to `null` to turn off, in which case the client must manually trigger model
806806
* response. Server VAD means that the model will detect the start and end of
807807
* speech based on audio volume and respond at the end of user speech. Semantic VAD
808-
* is more advanced and uses a turn detection model (in conjuction with VAD) to
808+
* is more advanced and uses a turn detection model (in conjunction with VAD) to
809809
* semantically estimate whether the user has finished speaking, then dynamically
810810
* sets a timeout based on this probability. For example, if user audio trails off
811811
* with "uhhm", the model will score a low probability of turn end and wait longer

src/resources/beta/realtime/transcription-sessions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export interface TranscriptionSessionCreateParams {
194194
* set to `null` to turn off, in which case the client must manually trigger model
195195
* response. Server VAD means that the model will detect the start and end of
196196
* speech based on audio volume and respond at the end of user speech. Semantic VAD
197-
* is more advanced and uses a turn detection model (in conjuction with VAD) to
197+
* is more advanced and uses a turn detection model (in conjunction with VAD) to
198198
* semantically estimate whether the user has finished speaking, then dynamically
199199
* sets a timeout based on this probability. For example, if user audio trails off
200200
* with "uhhm", the model will score a low probability of turn end and wait longer
@@ -284,7 +284,7 @@ export namespace TranscriptionSessionCreateParams {
284284
* set to `null` to turn off, in which case the client must manually trigger model
285285
* response. Server VAD means that the model will detect the start and end of
286286
* speech based on audio volume and respond at the end of user speech. Semantic VAD
287-
* is more advanced and uses a turn detection model (in conjuction with VAD) to
287+
* is more advanced and uses a turn detection model (in conjunction with VAD) to
288288
* semantically estimate whether the user has finished speaking, then dynamically
289289
* sets a timeout based on this probability. For example, if user audio trails off
290290
* with "uhhm", the model will score a low probability of turn end and wait longer

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ export interface Run {
502502

503503
/**
504504
* Controls for how a thread will be truncated prior to the run. Use this to
505-
* control the intial context window of the run.
505+
* control the initial context window of the run.
506506
*/
507507
truncation_strategy: Run.TruncationStrategy | null;
508508

@@ -581,7 +581,7 @@ export namespace Run {
581581

582582
/**
583583
* Controls for how a thread will be truncated prior to the run. Use this to
584-
* control the intial context window of the run.
584+
* control the initial context window of the run.
585585
*/
586586
export interface TruncationStrategy {
587587
/**
@@ -799,7 +799,7 @@ export interface RunCreateParamsBase {
799799

800800
/**
801801
* Body param: Controls for how a thread will be truncated prior to the run. Use
802-
* this to control the intial context window of the run.
802+
* this to control the initial context window of the run.
803803
*/
804804
truncation_strategy?: RunCreateParams.TruncationStrategy | null;
805805
}
@@ -862,7 +862,7 @@ export namespace RunCreateParams {
862862

863863
/**
864864
* Controls for how a thread will be truncated prior to the run. Use this to
865-
* control the intial context window of the run.
865+
* control the initial context window of the run.
866866
*/
867867
export interface TruncationStrategy {
868868
/**

src/resources/beta/threads/threads.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ export interface ThreadCreateAndRunParamsBase {
703703

704704
/**
705705
* Controls for how a thread will be truncated prior to the run. Use this to
706-
* control the intial context window of the run.
706+
* control the initial context window of the run.
707707
*/
708708
truncation_strategy?: ThreadCreateAndRunParams.TruncationStrategy | null;
709709
}
@@ -938,7 +938,7 @@ export namespace ThreadCreateAndRunParams {
938938

939939
/**
940940
* Controls for how a thread will be truncated prior to the run. Use this to
941-
* control the intial context window of the run.
941+
* control the initial context window of the run.
942942
*/
943943
export interface TruncationStrategy {
944944
/**

src/resources/chat/completions/completions.ts

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,8 @@ export interface ChatCompletion {
281281
* - If set to 'default', then the request will be processed with the standard
282282
* pricing and performance for the selected model.
283283
* - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
284-
* 'priority', then the request will be processed with the corresponding service
285-
* tier. [Contact sales](https://openai.com/contact-sales) to learn more about
286-
* Priority processing.
284+
* '[priority](https://openai.com/api-priority-processing/)', then the request
285+
* will be processed with the corresponding service tier.
287286
* - When not set, the default behavior is 'auto'.
288287
*
289288
* When the `service_tier` parameter is set, the response body will include the
@@ -294,7 +293,8 @@ export interface ChatCompletion {
294293
service_tier?: 'auto' | 'default' | 'flex' | 'scale' | 'priority' | null;
295294

296295
/**
297-
* This fingerprint represents the backend configuration that the model runs with.
296+
* @deprecated This fingerprint represents the backend configuration that the model
297+
* runs with.
298298
*
299299
* Can be used in conjunction with the `seed` request parameter to understand when
300300
* backend changes have been made that might impact determinism.
@@ -535,9 +535,8 @@ export interface ChatCompletionChunk {
535535
* - If set to 'default', then the request will be processed with the standard
536536
* pricing and performance for the selected model.
537537
* - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
538-
* 'priority', then the request will be processed with the corresponding service
539-
* tier. [Contact sales](https://openai.com/contact-sales) to learn more about
540-
* Priority processing.
538+
* '[priority](https://openai.com/api-priority-processing/)', then the request
539+
* will be processed with the corresponding service tier.
541540
* - When not set, the default behavior is 'auto'.
542541
*
543542
* When the `service_tier` parameter is set, the response body will include the
@@ -548,9 +547,9 @@ export interface ChatCompletionChunk {
548547
service_tier?: 'auto' | 'default' | 'flex' | 'scale' | 'priority' | null;
549548

550549
/**
551-
* This fingerprint represents the backend configuration that the model runs with.
552-
* Can be used in conjunction with the `seed` request parameter to understand when
553-
* backend changes have been made that might impact determinism.
550+
* @deprecated This fingerprint represents the backend configuration that the model
551+
* runs with. Can be used in conjunction with the `seed` request parameter to
552+
* understand when backend changes have been made that might impact determinism.
554553
*/
555554
system_fingerprint?: string;
556555

@@ -1664,11 +1663,11 @@ export interface ChatCompletionCreateParamsBase {
16641663
safety_identifier?: string;
16651664

16661665
/**
1667-
* This feature is in Beta. If specified, our system will make a best effort to
1668-
* sample deterministically, such that repeated requests with the same `seed` and
1669-
* parameters should return the same result. Determinism is not guaranteed, and you
1670-
* should refer to the `system_fingerprint` response parameter to monitor changes
1671-
* in the backend.
1666+
* @deprecated This feature is in Beta. If specified, our system will make a best
1667+
* effort to sample deterministically, such that repeated requests with the same
1668+
* `seed` and parameters should return the same result. Determinism is not
1669+
* guaranteed, and you should refer to the `system_fingerprint` response parameter
1670+
* to monitor changes in the backend.
16721671
*/
16731672
seed?: number | null;
16741673

@@ -1681,9 +1680,8 @@ export interface ChatCompletionCreateParamsBase {
16811680
* - If set to 'default', then the request will be processed with the standard
16821681
* pricing and performance for the selected model.
16831682
* - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
1684-
* 'priority', then the request will be processed with the corresponding service
1685-
* tier. [Contact sales](https://openai.com/contact-sales) to learn more about
1686-
* Priority processing.
1683+
* '[priority](https://openai.com/api-priority-processing/)', then the request
1684+
* will be processed with the corresponding service tier.
16871685
* - When not set, the default behavior is 'auto'.
16881686
*
16891687
* When the `service_tier` parameter is set, the response body will include the
@@ -1735,6 +1733,8 @@ export interface ChatCompletionCreateParamsBase {
17351733
*/
17361734
temperature?: number | null;
17371735

1736+
text?: ChatCompletionCreateParams.Text;
1737+
17381738
/**
17391739
* Controls which (if any) tool is called by the model. `none` means the model will
17401740
* not call any tool and instead generates a message. `auto` means the model can
@@ -1825,6 +1825,15 @@ export namespace ChatCompletionCreateParams {
18251825
parameters?: Shared.FunctionParameters;
18261826
}
18271827

1828+
export interface Text {
1829+
/**
1830+
* Constrains the verbosity of the model's response. Lower values will result in
1831+
* more concise responses, while higher values will result in more verbose
1832+
* responses. Currently supported values are `low`, `medium`, and `high`.
1833+
*/
1834+
verbosity?: 'low' | 'medium' | 'high' | null;
1835+
}
1836+
18281837
/**
18291838
* This tool searches the web for relevant results to use in a response. Learn more
18301839
* about the

src/resources/files.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class Files extends APIResource {
1515
/**
1616
* Upload a file that can be used across various endpoints. Individual files can be
1717
* up to 512 MB, and the size of all files uploaded by one organization can be up
18-
* to 100 GB.
18+
* to 1 TB.
1919
*
2020
* The Assistants API supports files up to 2 million tokens and of specific file
2121
* types. See the
@@ -196,6 +196,32 @@ export interface FileCreateParams {
196196
* Flexible file type for any purpose - `evals`: Used for eval data sets
197197
*/
198198
purpose: FilePurpose;
199+
200+
/**
201+
* The expiration policy for a file. By default, files with `purpose=batch` expire
202+
* after 30 days and all other files are persisted until they are manually deleted.
203+
*/
204+
expires_after?: FileCreateParams.ExpiresAfter;
205+
}
206+
207+
export namespace FileCreateParams {
208+
/**
209+
* The expiration policy for a file. By default, files with `purpose=batch` expire
210+
* after 30 days and all other files are persisted until they are manually deleted.
211+
*/
212+
export interface ExpiresAfter {
213+
/**
214+
* Anchor timestamp after which the expiration policy applies. Supported anchors:
215+
* `created_at`.
216+
*/
217+
anchor: 'created_at';
218+
219+
/**
220+
* The number of seconds after the anchor time that the file will expire. Must be
221+
* between 3600 (1 hour) and 2592000 (30 days).
222+
*/
223+
seconds: number;
224+
}
199225
}
200226

201227
export interface FileListParams extends CursorPageParams {

0 commit comments

Comments
 (0)