feat(api): add reusable prompt IDs

This commit is contained in:
stainless-app[bot]
2025-06-16 18:28:22 +00:00
parent 33d4c92605
commit 280c698015
8 changed files with 1300 additions and 44 deletions

View File

@@ -1,4 +1,4 @@
configured_endpoints: 97
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-3ae9c18dd7ccfc3ac5206f24394665f563a19015cfa8847b2801a2694d012abc.yml
openapi_spec_hash: 48175b03b58805cd5c80793c66fd54e5
config_hash: 4caff63b74a41f71006987db702f2918
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-9e41d2d5471d2c28bff0d616f4476f5b0e6c541ef4cb51bdaaef5fdf5e13c8b2.yml
openapi_spec_hash: 86f765e18d00e32cf2ce9db7ab84d946
config_hash: fd2af1d5eff0995bb7dc02ac9a34851d

4
api.md
View File

@@ -595,6 +595,7 @@ Params Types:
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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:
Response Types:
- <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>
- <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>
- <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>
- <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>
- <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:
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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:
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>

View File

@@ -193,7 +193,7 @@ type ChatCompletion struct {
// When this parameter is set, the response body will include the `service_tier`
// utilized.
//
// Any of "auto", "default", "flex".
// Any of "auto", "default", "flex", "scale".
ServiceTier ChatCompletionServiceTier `json:"service_tier,nullable"`
// This fingerprint represents the backend configuration that the model runs with.
//
@@ -300,6 +300,7 @@ const (
ChatCompletionServiceTierAuto ChatCompletionServiceTier = "auto"
ChatCompletionServiceTierDefault ChatCompletionServiceTier = "default"
ChatCompletionServiceTierFlex ChatCompletionServiceTier = "flex"
ChatCompletionServiceTierScale ChatCompletionServiceTier = "scale"
)
// Messages sent by the model in response to user messages.
@@ -588,7 +589,7 @@ type ChatCompletionChunk struct {
// When this parameter is set, the response body will include the `service_tier`
// utilized.
//
// Any of "auto", "default", "flex".
// Any of "auto", "default", "flex", "scale".
ServiceTier ChatCompletionChunkServiceTier `json:"service_tier,nullable"`
// This fingerprint represents the backend configuration that the model runs with.
// Can be used in conjunction with the `seed` request parameter to understand when
@@ -810,6 +811,7 @@ const (
ChatCompletionChunkServiceTierAuto ChatCompletionChunkServiceTier = "auto"
ChatCompletionChunkServiceTierDefault ChatCompletionChunkServiceTier = "default"
ChatCompletionChunkServiceTierFlex ChatCompletionChunkServiceTier = "flex"
ChatCompletionChunkServiceTierScale ChatCompletionChunkServiceTier = "scale"
)
func TextContentPart(text string) ChatCompletionContentPartUnionParam {
@@ -2221,7 +2223,7 @@ type ChatCompletionNewParams struct {
// When this parameter is set, the response body will include the `service_tier`
// utilized.
//
// Any of "auto", "default", "flex".
// Any of "auto", "default", "flex", "scale".
ServiceTier ChatCompletionNewParamsServiceTier `json:"service_tier,omitzero"`
// Not supported with latest reasoning models `o3` and `o4-mini`.
//
@@ -2428,6 +2430,7 @@ const (
ChatCompletionNewParamsServiceTierAuto ChatCompletionNewParamsServiceTier = "auto"
ChatCompletionNewParamsServiceTierDefault ChatCompletionNewParamsServiceTier = "default"
ChatCompletionNewParamsServiceTierFlex ChatCompletionNewParamsServiceTier = "flex"
ChatCompletionNewParamsServiceTierScale ChatCompletionNewParamsServiceTier = "scale"
)
// Only one field can be non-zero.

View File

@@ -48,7 +48,7 @@ func NewFineTuningJobService(opts ...option.RequestOption) (r FineTuningJobServi
// Response includes details of the enqueued job including job status and the name
// of the fine-tuned models once complete.
//
// [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)
// [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization)
func (r *FineTuningJobService) New(ctx context.Context, body FineTuningJobNewParams, opts ...option.RequestOption) (res *FineTuningJob, err error) {
opts = append(r.Options[:], opts...)
path := "fine_tuning/jobs"
@@ -58,7 +58,7 @@ func (r *FineTuningJobService) New(ctx context.Context, body FineTuningJobNewPar
// Get info about a fine-tuning job.
//
// [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)
// [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization)
func (r *FineTuningJobService) Get(ctx context.Context, fineTuningJobID string, opts ...option.RequestOption) (res *FineTuningJob, err error) {
opts = append(r.Options[:], opts...)
if fineTuningJobID == "" {
@@ -590,7 +590,8 @@ type FineTuningJobNewParams struct {
// [preference](https://platform.openai.com/docs/api-reference/fine-tuning/preference-input)
// format.
//
// See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
// See the
// [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization)
// for more details.
TrainingFile string `json:"training_file,required"`
// The seed controls the reproducibility of the job. Passing in the same seed and
@@ -613,7 +614,8 @@ type FineTuningJobNewParams struct {
// Your dataset must be formatted as a JSONL file. You must upload your file with
// the purpose `fine-tune`.
//
// See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
// See the
// [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization)
// for more details.
ValidationFile param.Opt[string] `json:"validation_file,omitzero"`
// A list of integrations to enable for your fine-tuning job.

View File

@@ -249,6 +249,10 @@ type ImageEditParams struct {
Prompt string `json:"prompt,required"`
// The number of images to generate. Must be between 1 and 10.
N param.Opt[int64] `json:"n,omitzero"`
// The compression level (0-100%) for the generated images. This parameter is only
// supported for `gpt-image-1` with the `webp` or `jpeg` output formats, and
// defaults to 100.
OutputCompression param.Opt[int64] `json:"output_compression,omitzero"`
// A unique identifier representing your end-user, which can help OpenAI to monitor
// and detect abuse.
// [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
@@ -267,6 +271,12 @@ type ImageEditParams struct {
// supported. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1`
// is used.
Model ImageModel `json:"model,omitzero"`
// The format in which the generated images are returned. This parameter is only
// supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`. The
// default value is `png`.
//
// Any of "png", "jpeg", "webp".
OutputFormat ImageEditParamsOutputFormat `json:"output_format,omitzero"`
// The quality of the image that will be generated. `high`, `medium` and `low` are
// only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
// Defaults to `auto`.
@@ -352,6 +362,17 @@ const (
ImageEditParamsBackgroundAuto ImageEditParamsBackground = "auto"
)
// The format in which the generated images are returned. This parameter is only
// supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`. The
// default value is `png`.
type ImageEditParamsOutputFormat string
const (
ImageEditParamsOutputFormatPNG ImageEditParamsOutputFormat = "png"
ImageEditParamsOutputFormatJPEG ImageEditParamsOutputFormat = "jpeg"
ImageEditParamsOutputFormatWebP ImageEditParamsOutputFormat = "webp"
)
// The quality of the image that will be generated. `high`, `medium` and `low` are
// only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
// Defaults to `auto`.

View File

@@ -60,15 +60,17 @@ func TestImageEditWithOptionalParams(t *testing.T) {
Image: openai.ImageEditParamsImageUnion{
OfFile: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
},
Prompt: "A cute baby sea otter wearing a beret",
Background: openai.ImageEditParamsBackgroundTransparent,
Mask: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
Model: openai.ImageModelDallE2,
N: openai.Int(1),
Quality: openai.ImageEditParamsQualityHigh,
ResponseFormat: openai.ImageEditParamsResponseFormatURL,
Size: openai.ImageEditParamsSize1024x1024,
User: openai.String("user-1234"),
Prompt: "A cute baby sea otter wearing a beret",
Background: openai.ImageEditParamsBackgroundTransparent,
Mask: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
Model: openai.ImageModelDallE2,
N: openai.Int(1),
OutputCompression: openai.Int(100),
OutputFormat: openai.ImageEditParamsOutputFormatPNG,
Quality: openai.ImageEditParamsQualityHigh,
ResponseFormat: openai.ImageEditParamsResponseFormatURL,
Size: openai.ImageEditParamsSize1024x1024,
User: openai.String("user-1234"),
})
if err != nil {
var apierr *openai.Error

File diff suppressed because it is too large Load Diff

View File

@@ -41,6 +41,15 @@ func TestResponseNewWithOptionalParams(t *testing.T) {
},
ParallelToolCalls: openai.Bool(true),
PreviousResponseID: openai.String("previous_response_id"),
Prompt: responses.ResponsePromptParam{
ID: "id",
Variables: map[string]responses.ResponsePromptVariableUnionParam{
"foo": {
OfString: openai.String("string"),
},
},
Version: openai.String("version"),
},
Reasoning: shared.ReasoningParam{
Effort: shared.ReasoningEffortLow,
GenerateSummary: shared.ReasoningGenerateSummaryAuto,