Skip to content

OpenAI.File

Andrew Lambert edited this page Dec 24, 2023 · 14 revisions

OpenAI.File

Class Declaration

 Protected Class File
 Inherits OpenAI.Response

Remarks

This class represents an API file response. Refer to the OpenAI documentation on the /v1/files endpoint for further details.

Example

This example uploads a file.

 OpenAI.APIKey = "YOUR KEY HERE"
 Dim f As FolderItem = SpecialFolder.Desktop.Child("training.jsonl")
 Dim file As OpenAI.File = OpenAI.File.Create(f) ' upload

This example downloads a previously-created file.

 OpenAI.APIKey = "YOUR KEY HERE"
 Dim file As OpenAI.File = OpenAI.File.Lookup(0) ' get the first known file
 Dim content As String = file.GetResult() ' download

This example deletes a previously-created file.

 OpenAI.APIKey = "YOUR KEY HERE"
 Dim file As OpenAI.File = OpenAI.File.Lookup(0) ' get the first known file
 file.Delete()

Methods

Properties

Shared methods

Shared properties

Clone this wiki locally