From 533935e4fc31f2542ef77d3e545a527c756b641c Mon Sep 17 00:00:00 2001 From: Simone Vellei Date: Fri, 6 Oct 2023 11:32:21 +0200 Subject: [PATCH] fix: use any for n_epochs (#499) * fix: use custom marshaler for n_epochs * chore: use any for n_epochs --- fine_tuning_job.go | 2 +- fine_tuning_job_test.go | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/fine_tuning_job.go b/fine_tuning_job.go index a840b7e..07b0c33 100644 --- a/fine_tuning_job.go +++ b/fine_tuning_job.go @@ -24,7 +24,7 @@ type FineTuningJob struct { } type Hyperparameters struct { - Epochs int `json:"n_epochs"` + Epochs any `json:"n_epochs,omitempty"` } type FineTuningJobRequest struct { diff --git a/fine_tuning_job_test.go b/fine_tuning_job_test.go index 519c6cd..f6d41c3 100644 --- a/fine_tuning_job_test.go +++ b/fine_tuning_job_test.go @@ -21,8 +21,23 @@ func TestFineTuningJob(t *testing.T) { server.RegisterHandler( "/v1/fine_tuning/jobs", func(w http.ResponseWriter, r *http.Request) { - var resBytes []byte - resBytes, _ = json.Marshal(FineTuningJob{}) + resBytes, _ := json.Marshal(FineTuningJob{ + Object: "fine_tuning.job", + ID: testFineTuninigJobID, + Model: "davinci-002", + CreatedAt: 1692661014, + FinishedAt: 1692661190, + FineTunedModel: "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + OrganizationID: "org-123", + ResultFiles: []string{"file-abc123"}, + Status: "succeeded", + ValidationFile: "", + TrainingFile: "file-abc123", + Hyperparameters: Hyperparameters{ + Epochs: "auto", + }, + TrainedTokens: 5768, + }) fmt.Fprintln(w, string(resBytes)) }, )