Skip to content

Commit a47089e

Browse files
fix(api): add missing file rank enum + more metadata (#248)
1 parent 4262295 commit a47089e

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 73
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-5d30684c3118d049682ea30cdb4dbef39b97d51667da484689193dc40162af32.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b524aed1c2c5c928aa4e2c546f5dbb364e7b4d5027daf05e42e210b05a97c3c6.yml

betathreadrunstep.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,8 @@ func (r fileSearchToolCallFileSearchJSON) RawJSON() string {
702702

703703
// The ranking options for the file search.
704704
type FileSearchToolCallFileSearchRankingOptions struct {
705-
// The ranker used for the file search.
705+
// The ranker to use for the file search. If not specified will use the `auto`
706+
// ranker.
706707
Ranker FileSearchToolCallFileSearchRankingOptionsRanker `json:"ranker,required"`
707708
// The score threshold for the file search. All values must be a floating point
708709
// number between 0 and 1.
@@ -727,16 +728,18 @@ func (r fileSearchToolCallFileSearchRankingOptionsJSON) RawJSON() string {
727728
return r.raw
728729
}
729730

730-
// The ranker used for the file search.
731+
// The ranker to use for the file search. If not specified will use the `auto`
732+
// ranker.
731733
type FileSearchToolCallFileSearchRankingOptionsRanker string
732734

733735
const (
736+
FileSearchToolCallFileSearchRankingOptionsRankerAuto FileSearchToolCallFileSearchRankingOptionsRanker = "auto"
734737
FileSearchToolCallFileSearchRankingOptionsRankerDefault2024_08_21 FileSearchToolCallFileSearchRankingOptionsRanker = "default_2024_08_21"
735738
)
736739

737740
func (r FileSearchToolCallFileSearchRankingOptionsRanker) IsKnown() bool {
738741
switch r {
739-
case FileSearchToolCallFileSearchRankingOptionsRankerDefault2024_08_21:
742+
case FileSearchToolCallFileSearchRankingOptionsRankerAuto, FileSearchToolCallFileSearchRankingOptionsRankerDefault2024_08_21:
740743
return true
741744
}
742745
return false

finetuningjob.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ type FineTuningJob struct {
180180
EstimatedFinish int64 `json:"estimated_finish,nullable"`
181181
// A list of integrations to enable for this fine-tuning job.
182182
Integrations []FineTuningJobWandbIntegrationObject `json:"integrations,nullable"`
183+
// Set of 16 key-value pairs that can be attached to an object. This can be useful
184+
// for storing additional information about the object in a structured format, and
185+
// querying for objects via API or the dashboard.
186+
//
187+
// Keys are strings with a maximum length of 64 characters. Values are strings with
188+
// a maximum length of 512 characters.
189+
Metadata shared.Metadata `json:"metadata,nullable"`
183190
// The method used for fine-tuning.
184191
Method FineTuningJobMethod `json:"method"`
185192
JSON fineTuningJobJSON `json:"-"`
@@ -204,6 +211,7 @@ type fineTuningJobJSON struct {
204211
ValidationFile apijson.Field
205212
EstimatedFinish apijson.Field
206213
Integrations apijson.Field
214+
Metadata apijson.Field
207215
Method apijson.Field
208216
raw string
209217
ExtraFields map[string]apijson.Field
@@ -1087,6 +1095,13 @@ type FineTuningJobNewParams struct {
10871095
Hyperparameters param.Field[FineTuningJobNewParamsHyperparameters] `json:"hyperparameters"`
10881096
// A list of integrations to enable for your fine-tuning job.
10891097
Integrations param.Field[[]FineTuningJobNewParamsIntegration] `json:"integrations"`
1098+
// Set of 16 key-value pairs that can be attached to an object. This can be useful
1099+
// for storing additional information about the object in a structured format, and
1100+
// querying for objects via API or the dashboard.
1101+
//
1102+
// Keys are strings with a maximum length of 64 characters. Values are strings with
1103+
// a maximum length of 512 characters.
1104+
Metadata param.Field[shared.MetadataParam] `json:"metadata"`
10901105
// The method used for fine-tuning.
10911106
Method param.Field[FineTuningJobNewParamsMethod] `json:"method"`
10921107
// The seed controls the reproducibility of the job. Passing in the same seed and
@@ -1567,6 +1582,9 @@ type FineTuningJobListParams struct {
15671582
After param.Field[string] `query:"after"`
15681583
// Number of fine-tuning jobs to retrieve.
15691584
Limit param.Field[int64] `query:"limit"`
1585+
// Optional metadata filter. To filter, use the syntax `metadata[k]=v`.
1586+
// Alternatively, set `metadata=null` to indicate no metadata.
1587+
Metadata param.Field[map[string]string] `query:"metadata"`
15701588
}
15711589

15721590
// URLQuery serializes [FineTuningJobListParams]'s query parameters as

finetuningjob_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/openai/openai-go"
1212
"github.com/openai/openai-go/internal/testutil"
1313
"github.com/openai/openai-go/option"
14+
"github.com/openai/openai-go/shared"
1415
)
1516

1617
func TestFineTuningJobNewWithOptionalParams(t *testing.T) {
@@ -42,6 +43,9 @@ func TestFineTuningJobNewWithOptionalParams(t *testing.T) {
4243
Tags: openai.F([]string{"custom-tag"}),
4344
}),
4445
}}),
46+
Metadata: openai.F(shared.MetadataParam{
47+
"foo": "string",
48+
}),
4549
Method: openai.F(openai.FineTuningJobNewParamsMethod{
4650
Dpo: openai.F(openai.FineTuningJobNewParamsMethodDpo{
4751
Hyperparameters: openai.F(openai.FineTuningJobNewParamsMethodDpoHyperparameters{
@@ -110,6 +114,9 @@ func TestFineTuningJobListWithOptionalParams(t *testing.T) {
110114
_, err := client.FineTuning.Jobs.List(context.TODO(), openai.FineTuningJobListParams{
111115
After: openai.F("after"),
112116
Limit: openai.F(int64(0)),
117+
Metadata: openai.F(map[string]string{
118+
"foo": "string",
119+
}),
113120
})
114121
if err != nil {
115122
var apierr *openai.Error

0 commit comments

Comments
 (0)