added delete fine tune model endpoint (#497)

This commit is contained in:
Brendan Martin
2023-09-25 04:08:45 -04:00
committed by GitHub
parent 8e4b7963a3
commit 0d5256fb82
3 changed files with 38 additions and 0 deletions

View File

@@ -14,6 +14,8 @@ import (
"testing"
)
const testFineTuneModelID = "fine-tune-model-id"
// TestListModels Tests the list models endpoint of the API using the mocked server.
func TestListModels(t *testing.T) {
client, server, teardown := setupOpenAITestServer()
@@ -78,3 +80,16 @@ func TestGetModelReturnTimeoutError(t *testing.T) {
t.Fatal("Did not return timeout error")
}
}
func TestDeleteFineTuneModel(t *testing.T) {
client, server, teardown := setupOpenAITestServer()
defer teardown()
server.RegisterHandler("/v1/models/"+testFineTuneModelID, handleDeleteFineTuneModelEndpoint)
_, err := client.DeleteFineTuneModel(context.Background(), testFineTuneModelID)
checks.NoError(t, err, "DeleteFineTuneModel error")
}
func handleDeleteFineTuneModelEndpoint(w http.ResponseWriter, _ *http.Request) {
resBytes, _ := json.Marshal(FineTuneModelDeleteResponse{})
fmt.Fprintln(w, string(resBytes))
}