@@ -21,6 +21,12 @@ Use your `OpenAI` instance to make API requests.
21
21
- [ Create image variation] ( #create-image-variation )
22
22
- [ Embeddings] ( #embeddings )
23
23
- [ Create embeddings] ( #create-embeddings )
24
+ - [ Fine-tuning] ( #fine-tuning )
25
+ - [ Create fine-tuning job] ( #create-fine-tuning-job )
26
+ - [ List fine-tuning jobs] ( #list-fine-tuning-jobs )
27
+ - [ Retrieve fine-tuning job] ( #retrieve-fine-tuning-job )
28
+ - [ Cancel fine-tuning] ( #cancel-fine-tuning )
29
+ - [ List fine-tuning events] ( #list-fine-tuning-events )
24
30
- [ Audio] ( #audio )
25
31
- [ Create transcription] ( #create-transcription )
26
32
- [ Create translation] ( #create-translation )
@@ -30,13 +36,6 @@ Use your `OpenAI` instance to make API requests.
30
36
- [ Delete file] ( #delete-file )
31
37
- [ Retrieve file] ( #retrieve-file )
32
38
- [ Retrieve file content] ( #retrieve-file-content )
33
- - [ Fine-tunes] ( #fine-tunes )
34
- - [ Create fine-tune] ( #create-fine-tune )
35
- - [ List fine-tunes] ( #list-fine-tunes )
36
- - [ Retrieve fine-tune] ( #retrieve-fine-tune )
37
- - [ Cancel fine-tune] ( #cancel-fine-tune )
38
- - [ List fine-tune events] ( #list-fine-tune-events )
39
- - [ Delete fine-tune model] ( #delete-fine-tune-model )
40
39
- [ Moderations] ( #moderations )
41
40
- [ Create moderation] ( #create-moderation )
42
41
@@ -45,6 +44,13 @@ Use your `OpenAI` instance to make API requests.
45
44
- [ Create completion] ( #create-completion-legacy )
46
45
47
46
#### Deprecated
47
+ - [ Fine-tunes] ( #fine-tunes )
48
+ - [ Create fine-tune] ( #create-fine-tune )
49
+ - [ List fine-tunes] ( #list-fine-tunes )
50
+ - [ Retrieve fine-tune] ( #retrieve-fine-tune )
51
+ - [ Cancel fine-tune] ( #cancel-fine-tune )
52
+ - [ List fine-tune events] ( #list-fine-tune-events )
53
+ - [ Delete fine-tune model] ( #delete-fine-tune-model )
48
54
- [ Edits] ( #edits )
49
55
- [ Create edits] ( #create-edits-deprecated )
50
56
@@ -162,6 +168,83 @@ val embeddings = openAI.embeddings(
162
168
)
163
169
````
164
170
171
+ ## Fine-tuning
172
+
173
+ Manage fine-tuning jobs to tailor a model to your specific training data.
174
+
175
+ ### Create fine-tuning job
176
+
177
+ Creates a job that fine-tunes a specified model from a given dataset.
178
+
179
+ Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.
180
+
181
+ #### No Hyperparameters
182
+
183
+ ``` kotlin
184
+ val request = FineTuningRequest (
185
+ trainingFile = FileId (" file-abc123" ),
186
+ model = ModelId (" gpt-3.5-turbo" ),
187
+ )
188
+ val fineTuningJob = client.fineTuningJob(request)
189
+ ```
190
+
191
+ #### Hyperparameters
192
+
193
+ ``` kotlin
194
+ val request = FineTuningRequest (
195
+ trainingFile = FileId (" file-abc123" ),
196
+ model = ModelId (" gpt-3.5-turbo" ),
197
+ hyperparameters = Hyperparameters (nEpochs = 2 ),
198
+ )
199
+ val fineTuningJob = client.fineTuningJob(request)
200
+ ```
201
+
202
+ #### Validation File
203
+
204
+ ``` kotlin
205
+ val request = FineTuningRequest (
206
+ trainingFile = FileId (" file-abc123" ),
207
+ validation_file = FileId (" file-def345" ),
208
+ model = ModelId (" gpt-3.5-turbo" ),
209
+ )
210
+ val fineTuningJob = client.fineTuningJob(request)
211
+ ```
212
+
213
+ ### List fine-tuning jobs
214
+
215
+ List your organization's fine-tuning jobs
216
+
217
+ ``` kotlin
218
+ val fineTuningJobs = client.fineTuningJobs(limit = 2 )
219
+ ```
220
+
221
+ ### Retrieve fine-tuning job
222
+
223
+ Get info about a fine-tuning job.
224
+
225
+ ``` kotlin
226
+ val id = FineTuningId (" ft-AF1WoRqd3aJAHsqc9NY7iL8F" )
227
+ val fineTuningJob = client.fineTuningJob(id)
228
+ ```
229
+
230
+ ### Cancel fine-tuning
231
+
232
+ Immediately cancel a fine-tune job.
233
+
234
+ ``` kotlin
235
+ val id = FineTuningId (" ftjob-abc12" )
236
+ client.cancel(id)
237
+ ```
238
+
239
+ ### List fine-tuning events
240
+
241
+ Get status updates for a fine-tuning job.
242
+
243
+ ``` kotlin
244
+ val id = FineTuningId (" ftjob-abc12" )
245
+ val fineTuningEvents = client.fineTuningEvents(id)
246
+ ```
247
+
165
248
## Audio
166
249
167
250
Learn how to turn audio into text.
@@ -240,6 +323,45 @@ Returns the contents of the specified file
240
323
val bytes = openAI.download(fileId)
241
324
````
242
325
326
+ ## Moderations
327
+
328
+ Given an input text, outputs if the model classifies it as violating OpenAI's content policy.
329
+
330
+ ### Create moderation
331
+
332
+ Classifies if text violates OpenAI's Content Policy
333
+
334
+ ```` kotlin
335
+ val moderation = openAI.moderations(
336
+ request = ModerationRequest (
337
+ input = " I want to kill them."
338
+ )
339
+ )
340
+ ````
341
+
342
+ ---
343
+
344
+ ## Completions
345
+
346
+ Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
347
+
348
+ ### Create Completion ` legacy `
349
+
350
+ Creates a completion for the provided prompt and parameters
351
+
352
+ ``` kotlin
353
+ val completionRequest = CompletionRequest (
354
+ model = ModelId (" text-ada-001" ),
355
+ prompt = " Somebody once told me the world is gonna roll me" ,
356
+ echo = true
357
+ )
358
+ val completion: TextCompletion = openAI.completion(completionRequest)
359
+ // or, as flow
360
+ val completions: Flow <TextCompletion > = openAI.completions(completionRequest)
361
+ ```
362
+
363
+ ---
364
+
243
365
## Fine-tunes
244
366
245
367
Manage fine-tuning jobs to tailor a model to your specific training data.
@@ -301,45 +423,6 @@ Delete a fine-tuned model. You must have the Owner role in your organization.
301
423
openAI.delete(fileId)
302
424
```
303
425
304
- ## Moderations
305
-
306
- Given an input text, outputs if the model classifies it as violating OpenAI's content policy.
307
-
308
- ### Create moderation
309
-
310
- Classifies if text violates OpenAI's Content Policy
311
-
312
- ```` kotlin
313
- val moderation = openAI.moderations(
314
- request = ModerationRequest (
315
- input = " I want to kill them."
316
- )
317
- )
318
- ````
319
-
320
- ---
321
-
322
- ## Completions
323
-
324
- Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
325
-
326
- ### Create Completion ` legacy `
327
-
328
- Creates a completion for the provided prompt and parameters
329
-
330
- ``` kotlin
331
- val completionRequest = CompletionRequest (
332
- model = ModelId (" text-ada-001" ),
333
- prompt = " Somebody once told me the world is gonna roll me" ,
334
- echo = true
335
- )
336
- val completion: TextCompletion = openAI.completion(completionRequest)
337
- // or, as flow
338
- val completions: Flow <TextCompletion > = openAI.completions(completionRequest)
339
- ```
340
-
341
- ---
342
-
343
426
## Edits
344
427
345
428
Given a prompt and an instruction, the model will return an edited version of the prompt.
0 commit comments