-
-
Notifications
You must be signed in to change notification settings - Fork 533
Files
Tolga Kayhan edited this page Feb 16, 2023
·
1 revision
Note: you may need to wait a bit after you upload a file. OpenAI services need to process your file.
const string fileName = "SentimentAnalysisSample.jsonl";
var sampleFile = await File.ReadAllBytesAsync($"SampleData/{fileName}");
var uploadFilesResponse = await sdk.Files.FileUpload(UploadFilePurposes.UploadFilePurpose.FineTune, sampleFile, fileName);
if (uploadFilesResponse.Successful)
{
// Congrats
}
var uploadedFiles = await sdk.Files.ListFile();
foreach (var uploadedFile in uploadedFiles.Data)
{
ConsoleExtensions.WriteLine($"File: {uploadedFile.FileName}", ConsoleColor.DarkCyan);
}
var retrieveFileResponse = await sdk.Files.RetrieveFile(uploadedFiles.Data.First().Id);
if (retrieveFileResponse.Successful)
{
// Congrats
}
var deleteResponse = await sdk.Files.DeleteFile(uploadedFiles.Data.First().Id);
if (deleteResponse.Successful)
{
// Congrats
}