Skip to content

Commit 3f93dd3

Browse files
committed
[FineTuning] Support fetch job events
1 parent c0f93ad commit 3f93dd3

5 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/main/java/org/devlive/sdk/openai/DefaultApi.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,11 @@ Single<FileEntity> fetchUploadFile(@Url String url,
211211
@POST
212212
Single<FineTuningResponse> fetchCreateFineTuningJob(@Url String url,
213213
@Body FineTuningEntity configure);
214+
215+
/**
216+
* Get status updates for a fine-tuning job.
217+
* 获取微调作业的状态更新。
218+
*/
219+
@GET
220+
Single<FineTuningResponse> fetchFineTuningJobEvents(@Url String url);
214221
}

src/main/java/org/devlive/sdk/openai/DefaultClient.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,13 @@ public FineTuningResponse createFineTuningJob(FineTuningEntity configure)
226226
.blockingGet();
227227
}
228228

229+
public FineTuningResponse fineTuningJobEvents(String jobId)
230+
{
231+
String url = String.format(ProviderUtils.getUrl(provider, UrlModel.FETCH_FINE_TUNING_JOBS_EVENTS), jobId);
232+
return this.api.fetchFineTuningJobEvents(url)
233+
.blockingGet();
234+
}
235+
229236
private ObjectMapper createObjectMapper()
230237
{
231238
ObjectMapper objectMapper = new ObjectMapper();

src/main/java/org/devlive/sdk/openai/model/UrlModel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ public enum UrlModel
1717
FETCH_EDITS,
1818
FETCH_FILES,
1919
FETCH_FINE_TUNING_JOBS,
20+
FETCH_FINE_TUNING_JOBS_EVENTS
2021
}

src/main/java/org/devlive/sdk/openai/utils/ProviderUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class ProviderUtils
2828
DEFAULT_PROVIDER.put(UrlModel.FETCH_EDITS, "v1/edits");
2929
DEFAULT_PROVIDER.put(UrlModel.FETCH_FILES, "v1/files");
3030
DEFAULT_PROVIDER.put(UrlModel.FETCH_FINE_TUNING_JOBS, "v1/fine_tuning/jobs");
31+
DEFAULT_PROVIDER.put(UrlModel.FETCH_FINE_TUNING_JOBS_EVENTS, "v1/fine_tuning/jobs/%s/events");
3132

3233
AZURE_PROVIDER.put(UrlModel.FETCH_COMPLETIONS, "completions");
3334
AZURE_PROVIDER.put(UrlModel.FETCH_CHAT_COMPLETIONS, "chat/completions");

src/test/java/org/devlive/sdk/openai/FineTuningTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,10 @@ public void testCreateFineTuningJob()
3232
.build();
3333
Assert.assertThrows(RequestException.class, () -> client.createFineTuningJob(entity));
3434
}
35+
36+
@Test
37+
public void testFineTuningJobEvents()
38+
{
39+
Assert.assertThrows(RequestException.class, () -> client.fineTuningJobEvents("ftjob-abc123"));
40+
}
3541
}

0 commit comments

Comments
 (0)