Documentation ¶
Overview ¶
Package files provides bindings for the files endpoint. Files are used to upload documents that can be used with features like Fine-tuning.
Index ¶
Constants ¶
const Endpoint = common.BaseURL + "files"
Variables ¶
This section is empty.
Functions ¶
func MakeRetrieveContentRequest ¶
func MakeRetrieveContentRequest(fileID, filepath string, overwrite bool, organizationID *string) error
Retreives "fileID" from Open AI, and writes it to disk at "filepath". If "filepath" already exists and "overwrite" is false, an error will be returned. If "filepath" already exists and "overwrite" is true, the existing file is truncated.
Types ¶
type DeleteResponse ¶
type DeleteResponse struct { ID string `json:"id"` Object string `json:"object"` Deleted bool `json:"deleted"` Error *common.ResponseError `json:"error,omitempty"` }
Response structure for the files "delete" endpoint.
func MakeDeleteRequest ¶
func MakeDeleteRequest(fileID string, organizationID *string) (*DeleteResponse, error)
Delete an uploaded file.
type ListResponse ¶
type ListResponse struct { Object string `json:"object"` Data []UploadedFile `json:"data"` Error *common.ResponseError `json:"error,omitempty"` }
Response structure for the files API "list" endpoint.
func MakeListRequest ¶
func MakeListRequest(organizationID *string) (*ListResponse, error)
Returns a list of files that belong to the user's organization.
type UploadRequest ¶
type UploadRequest struct { // The intended purpose of the uploaded documents. // Use "fine-tune" for Fine-tuning. This allows us to validate the // format of the uploaded file. Purpose string `json:"purpose"` // Name of the [JSON Lines] file to be uploaded. // // If the purpose is set to "fine-tune", each line is a JSON record with // "prompt" and "completion" fields representing your training examples. // // Note that this is not the path to the file, but just the name of the file. // // [JSON Lines]: https://jsonlines.org/ Filename string `json:"file"` // The path to the file, including the file's name and extension. Filepath string `json:"-"` }
Request structure for the files "upload" endpoint.
type UploadedFile ¶
type UploadedFile struct { ID string `json:"id"` Object string `json:"object"` Bytes uint64 `json:"bytes"` CreatedAt uint64 `json:"created_at"` Filename string `json:"filename"` Purpose string `json:"purpose"` Error *common.ResponseError `json:"error,omitempty"` }
func MakeRetrieveRequest ¶
func MakeRetrieveRequest(fileID string, organizationID *string) (*UploadedFile, error)
Returns information about a specific file.
func MakeUploadRequest ¶
func MakeUploadRequest(request *UploadRequest, organizationID *string) (*UploadedFile, error)
Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB.