Skip to content

Commit 7e244c7

Browse files
fix(api): Fix evals and code interpreter interfaces
1 parent 48f41c2 commit 7e244c7

13 files changed

+244
-168
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-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml
3-
openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615
4-
config_hash: e618aa8ff61aea826540916336de65a6
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-2bcc845d8635bf93ddcf9ee723af4d7928248412a417bee5fc10d863a1e13867.yml
3+
openapi_spec_hash: 865230cb3abeb01bd85de05891af23c4
4+
config_hash: ed1e6b3c5f93d12b80d31167f55c557c

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ Methods:
701701
- <code title="post /responses">client.Responses.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseService.New">New</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <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#ResponseNewParams">ResponseNewParams</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>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
702702
- <code title="get /responses/{response_id}">client.Responses.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, responseID <a href="https://pkg.go.dev/builtin#string">string</a>, query <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#ResponseGetParams">ResponseGetParams</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>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
703703
- <code title="delete /responses/{response_id}">client.Responses.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, responseID <a href="https://pkg.go.dev/builtin#string">string</a>) <a href="https://pkg.go.dev/builtin#error">error</a></code>
704-
- <code title="post /responses/{response_id}/cancel">client.Responses.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseService.Cancel">Cancel</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, responseID <a href="https://pkg.go.dev/builtin#string">string</a>) <a href="https://pkg.go.dev/builtin#error">error</a></code>
704+
- <code title="post /responses/{response_id}/cancel">client.Responses.<a href="https://pkg.go.dev/github.com/openai/openai-go/responses#ResponseService.Cancel">Cancel</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, responseID <a href="https://pkg.go.dev/builtin#string">string</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>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
705705

706706
## InputItems
707707

audiotranscription.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ type TranscriptionTextDeltaEventLogprob struct {
246246
// The token that was used to generate the log probability.
247247
Token string `json:"token"`
248248
// The bytes that were used to generate the log probability.
249-
Bytes []any `json:"bytes"`
249+
Bytes []int64 `json:"bytes"`
250250
// The log probability of the token.
251251
Logprob float64 `json:"logprob"`
252252
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -299,7 +299,7 @@ type TranscriptionTextDoneEventLogprob struct {
299299
// The token that was used to generate the log probability.
300300
Token string `json:"token"`
301301
// The bytes that were used to generate the log probability.
302-
Bytes []any `json:"bytes"`
302+
Bytes []int64 `json:"bytes"`
303303
// The log probability of the token.
304304
Logprob float64 `json:"logprob"`
305305
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].

chatcompletion.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ type ChatCompletion struct {
181181
// utilize scale tier credits until they are exhausted.
182182
// - If set to 'auto', and the Project is not Scale tier enabled, the request will
183183
// be processed using the default service tier with a lower uptime SLA and no
184-
// latency guarentee.
184+
// latency guarantee.
185185
// - If set to 'default', the request will be processed using the default service
186-
// tier with a lower uptime SLA and no latency guarentee.
186+
// tier with a lower uptime SLA and no latency guarantee.
187187
// - If set to 'flex', the request will be processed with the Flex Processing
188188
// service tier.
189189
// [Learn more](https://platform.openai.com/docs/guides/flex-processing).
@@ -283,9 +283,9 @@ func (r *ChatCompletionChoiceLogprobs) UnmarshalJSON(data []byte) error {
283283
// utilize scale tier credits until they are exhausted.
284284
// - If set to 'auto', and the Project is not Scale tier enabled, the request will
285285
// be processed using the default service tier with a lower uptime SLA and no
286-
// latency guarentee.
286+
// latency guarantee.
287287
// - If set to 'default', the request will be processed using the default service
288-
// tier with a lower uptime SLA and no latency guarentee.
288+
// tier with a lower uptime SLA and no latency guarantee.
289289
// - If set to 'flex', the request will be processed with the Flex Processing
290290
// service tier.
291291
// [Learn more](https://platform.openai.com/docs/guides/flex-processing).
@@ -576,9 +576,9 @@ type ChatCompletionChunk struct {
576576
// utilize scale tier credits until they are exhausted.
577577
// - If set to 'auto', and the Project is not Scale tier enabled, the request will
578578
// be processed using the default service tier with a lower uptime SLA and no
579-
// latency guarentee.
579+
// latency guarantee.
580580
// - If set to 'default', the request will be processed using the default service
581-
// tier with a lower uptime SLA and no latency guarentee.
581+
// tier with a lower uptime SLA and no latency guarantee.
582582
// - If set to 'flex', the request will be processed with the Flex Processing
583583
// service tier.
584584
// [Learn more](https://platform.openai.com/docs/guides/flex-processing).
@@ -793,9 +793,9 @@ func (r *ChatCompletionChunkChoiceLogprobs) UnmarshalJSON(data []byte) error {
793793
// utilize scale tier credits until they are exhausted.
794794
// - If set to 'auto', and the Project is not Scale tier enabled, the request will
795795
// be processed using the default service tier with a lower uptime SLA and no
796-
// latency guarentee.
796+
// latency guarantee.
797797
// - If set to 'default', the request will be processed using the default service
798-
// tier with a lower uptime SLA and no latency guarentee.
798+
// tier with a lower uptime SLA and no latency guarantee.
799799
// - If set to 'flex', the request will be processed with the Flex Processing
800800
// service tier.
801801
// [Learn more](https://platform.openai.com/docs/guides/flex-processing).
@@ -2209,9 +2209,9 @@ type ChatCompletionNewParams struct {
22092209
// utilize scale tier credits until they are exhausted.
22102210
// - If set to 'auto', and the Project is not Scale tier enabled, the request will
22112211
// be processed using the default service tier with a lower uptime SLA and no
2212-
// latency guarentee.
2212+
// latency guarantee.
22132213
// - If set to 'default', the request will be processed using the default service
2214-
// tier with a lower uptime SLA and no latency guarentee.
2214+
// tier with a lower uptime SLA and no latency guarantee.
22152215
// - If set to 'flex', the request will be processed with the Flex Processing
22162216
// service tier.
22172217
// [Learn more](https://platform.openai.com/docs/guides/flex-processing).
@@ -2411,9 +2411,9 @@ func (u ChatCompletionNewParamsResponseFormatUnion) GetType() *string {
24112411
// utilize scale tier credits until they are exhausted.
24122412
// - If set to 'auto', and the Project is not Scale tier enabled, the request will
24132413
// be processed using the default service tier with a lower uptime SLA and no
2414-
// latency guarentee.
2414+
// latency guarantee.
24152415
// - If set to 'default', the request will be processed using the default service
2416-
// tier with a lower uptime SLA and no latency guarentee.
2416+
// tier with a lower uptime SLA and no latency guarantee.
24172417
// - If set to 'flex', the request will be processed with the Flex Processing
24182418
// service tier.
24192419
// [Learn more](https://platform.openai.com/docs/guides/flex-processing).

finetuningalphagrader.go

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ type FineTuningAlphaGraderValidateResponseGraderUnion struct {
186186
// This field is from variant [MultiGrader].
187187
CalculateOutput string `json:"calculate_output"`
188188
// This field is from variant [MultiGrader].
189-
Graders map[string]MultiGraderGraderUnion `json:"graders"`
189+
Graders MultiGraderGradersUnion `json:"graders"`
190190
JSON struct {
191191
Input respjson.Field
192192
Name respjson.Field
@@ -267,10 +267,16 @@ func (r *FineTuningAlphaGraderValidateResponseGraderUnionInput) UnmarshalJSON(da
267267
type FineTuningAlphaGraderRunParams struct {
268268
// The grader used for the fine-tuning job.
269269
Grader FineTuningAlphaGraderRunParamsGraderUnion `json:"grader,omitzero,required"`
270-
// The model sample to be evaluated.
270+
// The model sample to be evaluated. This value will be used to populate the
271+
// `sample` namespace. See
272+
// [the guide](https://platform.openai.com/docs/guides/graders) for more details.
273+
// The `output_json` variable will be populated if the model sample is a valid JSON
274+
// string.
271275
ModelSample string `json:"model_sample,required"`
272-
// The reference answer for the evaluation.
273-
ReferenceAnswer FineTuningAlphaGraderRunParamsReferenceAnswerUnion `json:"reference_answer,omitzero,required"`
276+
// The dataset item provided to the grader. This will be used to populate the
277+
// `item` namespace. See
278+
// [the guide](https://platform.openai.com/docs/guides/graders) for more details.
279+
Item any `json:"item,omitzero"`
274280
paramObj
275281
}
276282

@@ -385,9 +391,9 @@ func (u FineTuningAlphaGraderRunParamsGraderUnion) GetCalculateOutput() *string
385391
}
386392

387393
// Returns a pointer to the underlying variant's property, if present.
388-
func (u FineTuningAlphaGraderRunParamsGraderUnion) GetGraders() map[string]MultiGraderGraderUnionParam {
394+
func (u FineTuningAlphaGraderRunParamsGraderUnion) GetGraders() *MultiGraderGradersUnionParam {
389395
if vt := u.OfMulti; vt != nil {
390-
return vt.Graders
396+
return &vt.Graders
391397
}
392398
return nil
393399
}
@@ -472,34 +478,6 @@ func init() {
472478
)
473479
}
474480

475-
// Only one field can be non-zero.
476-
//
477-
// Use [param.IsOmitted] to confirm if a field is set.
478-
type FineTuningAlphaGraderRunParamsReferenceAnswerUnion struct {
479-
OfString param.Opt[string] `json:",omitzero,inline"`
480-
OfAnyArray []any `json:",omitzero,inline"`
481-
OfFloat param.Opt[float64] `json:",omitzero,inline"`
482-
paramUnion
483-
}
484-
485-
func (u FineTuningAlphaGraderRunParamsReferenceAnswerUnion) MarshalJSON() ([]byte, error) {
486-
return param.MarshalUnion[FineTuningAlphaGraderRunParamsReferenceAnswerUnion](u.OfString, u.OfAnyArray, u.OfFloat)
487-
}
488-
func (u *FineTuningAlphaGraderRunParamsReferenceAnswerUnion) UnmarshalJSON(data []byte) error {
489-
return apijson.UnmarshalRoot(data, u)
490-
}
491-
492-
func (u *FineTuningAlphaGraderRunParamsReferenceAnswerUnion) asAny() any {
493-
if !param.IsOmitted(u.OfString) {
494-
return &u.OfString.Value
495-
} else if !param.IsOmitted(u.OfAnyArray) {
496-
return &u.OfAnyArray
497-
} else if !param.IsOmitted(u.OfFloat) {
498-
return &u.OfFloat.Value
499-
}
500-
return nil
501-
}
502-
503481
type FineTuningAlphaGraderValidateParams struct {
504482
// The grader used for the fine-tuning job.
505483
Grader FineTuningAlphaGraderValidateParamsGraderUnion `json:"grader,omitzero,required"`
@@ -617,9 +595,9 @@ func (u FineTuningAlphaGraderValidateParamsGraderUnion) GetCalculateOutput() *st
617595
}
618596

619597
// Returns a pointer to the underlying variant's property, if present.
620-
func (u FineTuningAlphaGraderValidateParamsGraderUnion) GetGraders() map[string]MultiGraderGraderUnionParam {
598+
func (u FineTuningAlphaGraderValidateParamsGraderUnion) GetGraders() *MultiGraderGradersUnionParam {
621599
if vt := u.OfMultiGrader; vt != nil {
622-
return vt.Graders
600+
return &vt.Graders
623601
}
624602
return nil
625603
}

finetuningalphagrader_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ func TestFineTuningAlphaGraderRunWithOptionalParams(t *testing.T) {
3535
},
3636
},
3737
ModelSample: "model_sample",
38-
ReferenceAnswer: openai.FineTuningAlphaGraderRunParamsReferenceAnswerUnion{
39-
OfString: openai.String("string"),
40-
},
38+
Item: map[string]interface{}{},
4139
})
4240
if err != nil {
4341
var apierr *openai.Error

finetuningjob.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,21 +309,21 @@ func (r *FineTuningJobHyperparameters) UnmarshalJSON(data []byte) error {
309309
// Use the methods beginning with 'As' to cast the union to one of its variants.
310310
//
311311
// If the underlying value is not a json object, one of the following properties
312-
// will be valid: OfManual OfInt]
312+
// will be valid: OfAuto OfInt]
313313
type FineTuningJobHyperparametersBatchSizeUnion struct {
314314
// This field will be present if the value is a [constant.Auto] instead of an
315315
// object.
316-
OfManual constant.Auto `json:",inline"`
316+
OfAuto constant.Auto `json:",inline"`
317317
// This field will be present if the value is a [int64] instead of an object.
318318
OfInt int64 `json:",inline"`
319319
JSON struct {
320-
OfManual respjson.Field
321-
OfInt respjson.Field
322-
raw string
320+
OfAuto respjson.Field
321+
OfInt respjson.Field
322+
raw string
323323
} `json:"-"`
324324
}
325325

326-
func (u FineTuningJobHyperparametersBatchSizeUnion) AsManual() (v constant.Auto) {
326+
func (u FineTuningJobHyperparametersBatchSizeUnion) AsAuto() (v constant.Auto) {
327327
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
328328
return
329329
}

finetuningmethod.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ type ReinforcementMethodGraderUnion struct {
921921
// This field is from variant [MultiGrader].
922922
CalculateOutput string `json:"calculate_output"`
923923
// This field is from variant [MultiGrader].
924-
Graders map[string]MultiGraderGraderUnion `json:"graders"`
924+
Graders MultiGraderGradersUnion `json:"graders"`
925925
JSON struct {
926926
Input respjson.Field
927927
Name respjson.Field
@@ -1120,9 +1120,9 @@ func (u ReinforcementMethodGraderUnionParam) GetCalculateOutput() *string {
11201120
}
11211121

11221122
// Returns a pointer to the underlying variant's property, if present.
1123-
func (u ReinforcementMethodGraderUnionParam) GetGraders() map[string]MultiGraderGraderUnionParam {
1123+
func (u ReinforcementMethodGraderUnionParam) GetGraders() *MultiGraderGradersUnionParam {
11241124
if vt := u.OfMultiGrader; vt != nil {
1125-
return vt.Graders
1125+
return &vt.Graders
11261126
}
11271127
return nil
11281128
}

0 commit comments

Comments
 (0)