Skip to content

Commit 533935e

Browse files
authored
fix: use any for n_epochs (#499)
* fix: use custom marshaler for n_epochs * chore: use any for n_epochs
1 parent 84f77a0 commit 533935e

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

fine_tuning_job.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type FineTuningJob struct {
2424
}
2525

2626
type Hyperparameters struct {
27-
Epochs int `json:"n_epochs"`
27+
Epochs any `json:"n_epochs,omitempty"`
2828
}
2929

3030
type FineTuningJobRequest struct {

fine_tuning_job_test.go

+17-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,23 @@ func TestFineTuningJob(t *testing.T) {
2121
server.RegisterHandler(
2222
"/v1/fine_tuning/jobs",
2323
func(w http.ResponseWriter, r *http.Request) {
24-
var resBytes []byte
25-
resBytes, _ = json.Marshal(FineTuningJob{})
24+
resBytes, _ := json.Marshal(FineTuningJob{
25+
Object: "fine_tuning.job",
26+
ID: testFineTuninigJobID,
27+
Model: "davinci-002",
28+
CreatedAt: 1692661014,
29+
FinishedAt: 1692661190,
30+
FineTunedModel: "ft:davinci-002:my-org:custom_suffix:7q8mpxmy",
31+
OrganizationID: "org-123",
32+
ResultFiles: []string{"file-abc123"},
33+
Status: "succeeded",
34+
ValidationFile: "",
35+
TrainingFile: "file-abc123",
36+
Hyperparameters: Hyperparameters{
37+
Epochs: "auto",
38+
},
39+
TrainedTokens: 5768,
40+
})
2641
fmt.Fprintln(w, string(resBytes))
2742
},
2843
)

0 commit comments

Comments
 (0)