Skip to content

Commit 280c698

Browse files
feat(api): add reusable prompt IDs
1 parent 33d4c92 commit 280c698

File tree

8 files changed

+1333
-77
lines changed

8 files changed

+1333
-77
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: 97
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ Params Types:
595595
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseOutputMessageParam">ResponseOutputMessageParam</a>
596596
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseOutputRefusalParam">ResponseOutputRefusalParam</a>
597597
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseOutputTextParam">ResponseOutputTextParam</a>
598+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponsePromptParam">ResponsePromptParam</a>
598599
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseReasoningItemParam">ResponseReasoningItemParam</a>
599600
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseTextConfigParam">ResponseTextConfigParam</a>
600601
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ToolUnionParam">ToolUnionParam</a>
@@ -606,6 +607,7 @@ Params Types:
606607
Response Types:
607608

608609
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ComputerTool">ComputerTool</a>
610+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#EasyInputMessage">EasyInputMessage</a>
609611
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#FileSearchTool">FileSearchTool</a>
610612
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#FunctionTool">FunctionTool</a>
611613
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#Response">Response</a>
@@ -650,6 +652,7 @@ Response Types:
650652
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseInputContentUnion">ResponseInputContentUnion</a>
651653
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseInputFile">ResponseInputFile</a>
652654
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseInputImage">ResponseInputImage</a>
655+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseInputItemUnion">ResponseInputItemUnion</a>
653656
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseInputMessageContentList">ResponseInputMessageContentList</a>
654657
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseInputMessageItem">ResponseInputMessageItem</a>
655658
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseInputText">ResponseInputText</a>
@@ -669,6 +672,7 @@ Response Types:
669672
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseOutputRefusal">ResponseOutputRefusal</a>
670673
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseOutputText">ResponseOutputText</a>
671674
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseOutputTextAnnotationAddedEvent">ResponseOutputTextAnnotationAddedEvent</a>
675+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponsePrompt">ResponsePrompt</a>
672676
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseQueuedEvent">ResponseQueuedEvent</a>
673677
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseReasoningDeltaEvent">ResponseReasoningDeltaEvent</a>
674678
- <a href="https://pkg.go.dev/github.com/openai/openai-go/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseReasoningDoneEvent">ResponseReasoningDoneEvent</a>

chatcompletion.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ type ChatCompletion struct {
193193
// When this parameter is set, the response body will include the `service_tier`
194194
// utilized.
195195
//
196-
// Any of "auto", "default", "flex".
196+
// Any of "auto", "default", "flex", "scale".
197197
ServiceTier ChatCompletionServiceTier `json:"service_tier,nullable"`
198198
// This fingerprint represents the backend configuration that the model runs with.
199199
//
@@ -300,6 +300,7 @@ const (
300300
ChatCompletionServiceTierAuto ChatCompletionServiceTier = "auto"
301301
ChatCompletionServiceTierDefault ChatCompletionServiceTier = "default"
302302
ChatCompletionServiceTierFlex ChatCompletionServiceTier = "flex"
303+
ChatCompletionServiceTierScale ChatCompletionServiceTier = "scale"
303304
)
304305

305306
// Messages sent by the model in response to user messages.
@@ -588,7 +589,7 @@ type ChatCompletionChunk struct {
588589
// When this parameter is set, the response body will include the `service_tier`
589590
// utilized.
590591
//
591-
// Any of "auto", "default", "flex".
592+
// Any of "auto", "default", "flex", "scale".
592593
ServiceTier ChatCompletionChunkServiceTier `json:"service_tier,nullable"`
593594
// This fingerprint represents the backend configuration that the model runs with.
594595
// Can be used in conjunction with the `seed` request parameter to understand when
@@ -810,6 +811,7 @@ const (
810811
ChatCompletionChunkServiceTierAuto ChatCompletionChunkServiceTier = "auto"
811812
ChatCompletionChunkServiceTierDefault ChatCompletionChunkServiceTier = "default"
812813
ChatCompletionChunkServiceTierFlex ChatCompletionChunkServiceTier = "flex"
814+
ChatCompletionChunkServiceTierScale ChatCompletionChunkServiceTier = "scale"
813815
)
814816

815817
func TextContentPart(text string) ChatCompletionContentPartUnionParam {
@@ -2221,7 +2223,7 @@ type ChatCompletionNewParams struct {
22212223
// When this parameter is set, the response body will include the `service_tier`
22222224
// utilized.
22232225
//
2224-
// Any of "auto", "default", "flex".
2226+
// Any of "auto", "default", "flex", "scale".
22252227
ServiceTier ChatCompletionNewParamsServiceTier `json:"service_tier,omitzero"`
22262228
// Not supported with latest reasoning models `o3` and `o4-mini`.
22272229
//
@@ -2428,6 +2430,7 @@ const (
24282430
ChatCompletionNewParamsServiceTierAuto ChatCompletionNewParamsServiceTier = "auto"
24292431
ChatCompletionNewParamsServiceTierDefault ChatCompletionNewParamsServiceTier = "default"
24302432
ChatCompletionNewParamsServiceTierFlex ChatCompletionNewParamsServiceTier = "flex"
2433+
ChatCompletionNewParamsServiceTierScale ChatCompletionNewParamsServiceTier = "scale"
24312434
)
24322435

24332436
// Only one field can be non-zero.

finetuningjob.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func NewFineTuningJobService(opts ...option.RequestOption) (r FineTuningJobServi
4848
// Response includes details of the enqueued job including job status and the name
4949
// of the fine-tuned models once complete.
5050
//
51-
// [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)
51+
// [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization)
5252
func (r *FineTuningJobService) New(ctx context.Context, body FineTuningJobNewParams, opts ...option.RequestOption) (res *FineTuningJob, err error) {
5353
opts = append(r.Options[:], opts...)
5454
path := "fine_tuning/jobs"
@@ -58,7 +58,7 @@ func (r *FineTuningJobService) New(ctx context.Context, body FineTuningJobNewPar
5858

5959
// Get info about a fine-tuning job.
6060
//
61-
// [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)
61+
// [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization)
6262
func (r *FineTuningJobService) Get(ctx context.Context, fineTuningJobID string, opts ...option.RequestOption) (res *FineTuningJob, err error) {
6363
opts = append(r.Options[:], opts...)
6464
if fineTuningJobID == "" {
@@ -590,7 +590,8 @@ type FineTuningJobNewParams struct {
590590
// [preference](https://platform.openai.com/docs/api-reference/fine-tuning/preference-input)
591591
// format.
592592
//
593-
// See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
593+
// See the
594+
// [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization)
594595
// for more details.
595596
TrainingFile string `json:"training_file,required"`
596597
// The seed controls the reproducibility of the job. Passing in the same seed and
@@ -613,7 +614,8 @@ type FineTuningJobNewParams struct {
613614
// Your dataset must be formatted as a JSONL file. You must upload your file with
614615
// the purpose `fine-tune`.
615616
//
616-
// See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
617+
// See the
618+
// [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization)
617619
// for more details.
618620
ValidationFile param.Opt[string] `json:"validation_file,omitzero"`
619621
// A list of integrations to enable for your fine-tuning job.

image.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ type ImageEditParams struct {
249249
Prompt string `json:"prompt,required"`
250250
// The number of images to generate. Must be between 1 and 10.
251251
N param.Opt[int64] `json:"n,omitzero"`
252+
// The compression level (0-100%) for the generated images. This parameter is only
253+
// supported for `gpt-image-1` with the `webp` or `jpeg` output formats, and
254+
// defaults to 100.
255+
OutputCompression param.Opt[int64] `json:"output_compression,omitzero"`
252256
// A unique identifier representing your end-user, which can help OpenAI to monitor
253257
// and detect abuse.
254258
// [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
@@ -267,6 +271,12 @@ type ImageEditParams struct {
267271
// supported. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1`
268272
// is used.
269273
Model ImageModel `json:"model,omitzero"`
274+
// The format in which the generated images are returned. This parameter is only
275+
// supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`. The
276+
// default value is `png`.
277+
//
278+
// Any of "png", "jpeg", "webp".
279+
OutputFormat ImageEditParamsOutputFormat `json:"output_format,omitzero"`
270280
// The quality of the image that will be generated. `high`, `medium` and `low` are
271281
// only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
272282
// Defaults to `auto`.
@@ -352,6 +362,17 @@ const (
352362
ImageEditParamsBackgroundAuto ImageEditParamsBackground = "auto"
353363
)
354364

365+
// The format in which the generated images are returned. This parameter is only
366+
// supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`. The
367+
// default value is `png`.
368+
type ImageEditParamsOutputFormat string
369+
370+
const (
371+
ImageEditParamsOutputFormatPNG ImageEditParamsOutputFormat = "png"
372+
ImageEditParamsOutputFormatJPEG ImageEditParamsOutputFormat = "jpeg"
373+
ImageEditParamsOutputFormatWebP ImageEditParamsOutputFormat = "webp"
374+
)
375+
355376
// The quality of the image that will be generated. `high`, `medium` and `low` are
356377
// only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
357378
// Defaults to `auto`.

image_test.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,17 @@ func TestImageEditWithOptionalParams(t *testing.T) {
6060
Image: openai.ImageEditParamsImageUnion{
6161
OfFile: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
6262
},
63-
Prompt: "A cute baby sea otter wearing a beret",
64-
Background: openai.ImageEditParamsBackgroundTransparent,
65-
Mask: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
66-
Model: openai.ImageModelDallE2,
67-
N: openai.Int(1),
68-
Quality: openai.ImageEditParamsQualityHigh,
69-
ResponseFormat: openai.ImageEditParamsResponseFormatURL,
70-
Size: openai.ImageEditParamsSize1024x1024,
71-
User: openai.String("user-1234"),
63+
Prompt: "A cute baby sea otter wearing a beret",
64+
Background: openai.ImageEditParamsBackgroundTransparent,
65+
Mask: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
66+
Model: openai.ImageModelDallE2,
67+
N: openai.Int(1),
68+
OutputCompression: openai.Int(100),
69+
OutputFormat: openai.ImageEditParamsOutputFormatPNG,
70+
Quality: openai.ImageEditParamsQualityHigh,
71+
ResponseFormat: openai.ImageEditParamsResponseFormatURL,
72+
Size: openai.ImageEditParamsSize1024x1024,
73+
User: openai.String("user-1234"),
7274
})
7375
if err != nil {
7476
var apierr *openai.Error

0 commit comments

Comments
 (0)