Chore Deprecate legacy fine tunes API (#484)
* chore: add deprecation message * chore: use new fine tuning API in README example
This commit is contained in:
21
README.md
21
README.md
@@ -631,11 +631,16 @@ func main() {
|
||||
client := openai.NewClient("your token")
|
||||
ctx := context.Background()
|
||||
|
||||
// create a .jsonl file with your training data
|
||||
// create a .jsonl file with your training data for conversational model
|
||||
// {"prompt": "<prompt text>", "completion": "<ideal generated text>"}
|
||||
// {"prompt": "<prompt text>", "completion": "<ideal generated text>"}
|
||||
// {"prompt": "<prompt text>", "completion": "<ideal generated text>"}
|
||||
|
||||
// chat models are trained using the following file format:
|
||||
// {"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "What's the capital of France?"}, {"role": "assistant", "content": "Paris, as if everyone doesn't know that already."}]}
|
||||
// {"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "Who wrote 'Romeo and Juliet'?"}, {"role": "assistant", "content": "Oh, just some guy named William Shakespeare. Ever heard of him?"}]}
|
||||
// {"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "How far is the Moon from Earth?"}, {"role": "assistant", "content": "Around 384,400 kilometers. Give or take a few, like that really matters."}]}
|
||||
|
||||
// you can use openai cli tool to validate the data
|
||||
// For more info - https://platform.openai.com/docs/guides/fine-tuning
|
||||
|
||||
@@ -648,29 +653,29 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
// create a fine tune job
|
||||
// create a fine tuning job
|
||||
// Streams events until the job is done (this often takes minutes, but can take hours if there are many jobs in the queue or your dataset is large)
|
||||
// use below get method to know the status of your model
|
||||
tune, err := client.CreateFineTune(ctx, openai.FineTuneRequest{
|
||||
fineTuningJob, err := client.CreateFineTuningJob(ctx, openai.FineTuningJobRequest{
|
||||
TrainingFile: file.ID,
|
||||
Model: "ada", // babbage, curie, davinci, or a fine-tuned model created after 2022-04-21.
|
||||
Model: "davinci-002", // gpt-3.5-turbo-0613, babbage-002.
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Printf("Creating new fine tune model error: %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
getTune, err := client.GetFineTune(ctx, tune.ID)
|
||||
fineTuningJob, err = client.RetrieveFineTuningJob(ctx, fineTuningJob.ID)
|
||||
if err != nil {
|
||||
fmt.Printf("Getting fine tune model error: %v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Println(getTune.FineTunedModel)
|
||||
fmt.Println(fineTuningJob.FineTunedModel)
|
||||
|
||||
// once the status of getTune is `succeeded`, you can use your fine tune model in Completion Request
|
||||
// once the status of fineTuningJob is `succeeded`, you can use your fine tune model in Completion Request or Chat Completion Request
|
||||
|
||||
// resp, err := client.CreateCompletion(ctx, openai.CompletionRequest{
|
||||
// Model: getTune.FineTunedModel,
|
||||
// Model: fineTuningJob.FineTunedModel,
|
||||
// Prompt: "your prompt",
|
||||
// })
|
||||
// if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user