Skip to content

Commit 3f9aaf3

Browse files
feat(api): add reusable prompt IDs
1 parent 20f480e commit 3f9aaf3

File tree

8 files changed

+71
-17
lines changed

8 files changed

+71
-17
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-3ae9c18dd7ccfc3ac5206f24394665f563a19015cfa8847b2801a2694d012abc.yml
3-
openapi_spec_hash: 48175b03b58805cd5c80793c66fd54e5
4-
config_hash: 4caff63b74a41f71006987db702f2918
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-9e41d2d5471d2c28bff0d616f4476f5b0e6c541ef4cb51bdaaef5fdf5e13c8b2.yml
3+
openapi_spec_hash: 86f765e18d00e32cf2ce9db7ab84d946
4+
config_hash: fd2af1d5eff0995bb7dc02ac9a34851d

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ Types:
677677
- <code><a href="./src/resources/responses/responses.ts">ResponseOutputRefusal</a></code>
678678
- <code><a href="./src/resources/responses/responses.ts">ResponseOutputText</a></code>
679679
- <code><a href="./src/resources/responses/responses.ts">ResponseOutputTextAnnotationAddedEvent</a></code>
680+
- <code><a href="./src/resources/responses/responses.ts">ResponsePrompt</a></code>
680681
- <code><a href="./src/resources/responses/responses.ts">ResponseQueuedEvent</a></code>
681682
- <code><a href="./src/resources/responses/responses.ts">ResponseReasoningDeltaEvent</a></code>
682683
- <code><a href="./src/resources/responses/responses.ts">ResponseReasoningDoneEvent</a></code>

src/resources/chat/completions/completions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export interface ChatCompletion {
291291
* When this parameter is set, the response body will include the `service_tier`
292292
* utilized.
293293
*/
294-
service_tier?: 'auto' | 'default' | 'flex' | null;
294+
service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null;
295295

296296
/**
297297
* This fingerprint represents the backend configuration that the model runs with.
@@ -542,7 +542,7 @@ export interface ChatCompletionChunk {
542542
* When this parameter is set, the response body will include the `service_tier`
543543
* utilized.
544544
*/
545-
service_tier?: 'auto' | 'default' | 'flex' | null;
545+
service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null;
546546

547547
/**
548548
* This fingerprint represents the backend configuration that the model runs with.
@@ -1464,7 +1464,7 @@ export interface ChatCompletionCreateParamsBase {
14641464
* When this parameter is set, the response body will include the `service_tier`
14651465
* utilized.
14661466
*/
1467-
service_tier?: 'auto' | 'default' | 'flex' | null;
1467+
service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null;
14681468

14691469
/**
14701470
* Not supported with latest reasoning models `o3` and `o4-mini`.

src/resources/fine-tuning/jobs/jobs.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class Jobs extends APIResource {
2525
* Response includes details of the enqueued job including job status and the name
2626
* of the fine-tuned models once complete.
2727
*
28-
* [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)
28+
* [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization)
2929
*
3030
* @example
3131
* ```ts
@@ -42,7 +42,7 @@ export class Jobs extends APIResource {
4242
/**
4343
* Get info about a fine-tuning job.
4444
*
45-
* [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)
45+
* [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization)
4646
*
4747
* @example
4848
* ```ts
@@ -449,7 +449,8 @@ export interface JobCreateParams {
449449
* [preference](https://platform.openai.com/docs/api-reference/fine-tuning/preference-input)
450450
* format.
451451
*
452-
* See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
452+
* See the
453+
* [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization)
453454
* for more details.
454455
*/
455456
training_file: string;
@@ -508,7 +509,8 @@ export interface JobCreateParams {
508509
* Your dataset must be formatted as a JSONL file. You must upload your file with
509510
* the purpose `fine-tune`.
510511
*
511-
* See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
512+
* See the
513+
* [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization)
512514
* for more details.
513515
*/
514516
validation_file?: string | null;

src/resources/images.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,20 @@ export interface ImageEditParams {
237237
*/
238238
n?: number | null;
239239

240+
/**
241+
* The compression level (0-100%) for the generated images. This parameter is only
242+
* supported for `gpt-image-1` with the `webp` or `jpeg` output formats, and
243+
* defaults to 100.
244+
*/
245+
output_compression?: number | null;
246+
247+
/**
248+
* The format in which the generated images are returned. This parameter is only
249+
* supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`. The
250+
* default value is `png`.
251+
*/
252+
output_format?: 'png' | 'jpeg' | 'webp' | null;
253+
240254
/**
241255
* The quality of the image that will be generated. `high`, `medium` and `low` are
242256
* only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.

src/resources/responses/responses.ts

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,13 @@ export interface Response {
358358
incomplete_details: Response.IncompleteDetails | null;
359359

360360
/**
361-
* Inserts a system (or developer) message as the first item in the model's
362-
* context.
361+
* A system (or developer) message inserted into the model's context.
363362
*
364363
* When using along with `previous_response_id`, the instructions from a previous
365364
* response will not be carried over to the next response. This makes it simple to
366365
* swap out system (or developer) messages in new responses.
367366
*/
368-
instructions: string | null;
367+
instructions: string | Array<ResponseInputItem> | null;
369368

370369
/**
371370
* Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -469,6 +468,12 @@ export interface Response {
469468
*/
470469
previous_response_id?: string | null;
471470

471+
/**
472+
* Reference to a prompt template and its variables.
473+
* [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
474+
*/
475+
prompt?: ResponsePrompt | null;
476+
472477
/**
473478
* **o-series models only**
474479
*
@@ -496,7 +501,7 @@ export interface Response {
496501
* When this parameter is set, the response body will include the `service_tier`
497502
* utilized.
498503
*/
499-
service_tier?: 'auto' | 'default' | 'flex' | null;
504+
service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null;
500505

501506
/**
502507
* The status of the response generation. One of `completed`, `failed`,
@@ -3483,6 +3488,29 @@ export interface ResponseOutputTextAnnotationAddedEvent {
34833488
type: 'response.output_text_annotation.added';
34843489
}
34853490

3491+
/**
3492+
* Reference to a prompt template and its variables.
3493+
* [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
3494+
*/
3495+
export interface ResponsePrompt {
3496+
/**
3497+
* The unique identifier of the prompt template to use.
3498+
*/
3499+
id: string;
3500+
3501+
/**
3502+
* Optional map of values to substitute in for variables in your prompt. The
3503+
* substitution values can either be strings, or other Response input types like
3504+
* images or files.
3505+
*/
3506+
variables?: Record<string, string | ResponseInputText | ResponseInputImage | ResponseInputFile> | null;
3507+
3508+
/**
3509+
* Optional version of the prompt template.
3510+
*/
3511+
version?: string | null;
3512+
}
3513+
34863514
/**
34873515
* Emitted when a response is queued and waiting to be processed.
34883516
*/
@@ -4612,8 +4640,7 @@ export interface ResponseCreateParamsBase {
46124640
include?: Array<ResponseIncludable> | null;
46134641

46144642
/**
4615-
* Inserts a system (or developer) message as the first item in the model's
4616-
* context.
4643+
* A system (or developer) message inserted into the model's context.
46174644
*
46184645
* When using along with `previous_response_id`, the instructions from a previous
46194646
* response will not be carried over to the next response. This makes it simple to
@@ -4650,6 +4677,12 @@ export interface ResponseCreateParamsBase {
46504677
*/
46514678
previous_response_id?: string | null;
46524679

4680+
/**
4681+
* Reference to a prompt template and its variables.
4682+
* [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
4683+
*/
4684+
prompt?: ResponsePrompt | null;
4685+
46534686
/**
46544687
* **o-series models only**
46554688
*
@@ -4677,7 +4710,7 @@ export interface ResponseCreateParamsBase {
46774710
* When this parameter is set, the response body will include the `service_tier`
46784711
* utilized.
46794712
*/
4680-
service_tier?: 'auto' | 'default' | 'flex' | null;
4713+
service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null;
46814714

46824715
/**
46834716
* Whether to store the generated model response for later retrieval via API.
@@ -4922,6 +4955,7 @@ export declare namespace Responses {
49224955
type ResponseOutputRefusal as ResponseOutputRefusal,
49234956
type ResponseOutputText as ResponseOutputText,
49244957
type ResponseOutputTextAnnotationAddedEvent as ResponseOutputTextAnnotationAddedEvent,
4958+
type ResponsePrompt as ResponsePrompt,
49254959
type ResponseQueuedEvent as ResponseQueuedEvent,
49264960
type ResponseReasoningDeltaEvent as ResponseReasoningDeltaEvent,
49274961
type ResponseReasoningDoneEvent as ResponseReasoningDoneEvent,

tests/api-resources/images.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ describe('resource images', () => {
5454
mask: await toFile(Buffer.from('# my file contents'), 'README.md'),
5555
model: 'string',
5656
n: 1,
57+
output_compression: 100,
58+
output_format: 'png',
5759
quality: 'high',
5860
response_format: 'url',
5961
size: '1024x1024',

tests/api-resources/responses/responses.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe('resource responses', () => {
3030
metadata: { foo: 'string' },
3131
parallel_tool_calls: true,
3232
previous_response_id: 'previous_response_id',
33+
prompt: { id: 'id', variables: { foo: 'string' }, version: 'version' },
3334
reasoning: { effort: 'low', generate_summary: 'auto', summary: 'auto' },
3435
service_tier: 'auto',
3536
store: true,

0 commit comments

Comments
 (0)