files

package
v1.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRequest

type CreateRequest struct {
	FileName string `json:"filename"`
	FileData any    `json:"-"` // string (filepath) or []byte (filedata) or io.Reader

	// The intended purpose of the uploaded file. One of:
	//
	// - `assistants`: Used in the Assistants API
	// - `batch`: Used in the Batch API
	// - `fine-tune`: Used for fine-tuning
	// - `vision`: Images used for vision fine-tuning
	// - `user_data`: Flexible file type for any purpose
	// - `evals`: Used for eval data sets
	//
	// Any of "assistants", "batch", "fine-tune", "vision", "user_data", "evals".
	Purpose FilePurpose `json:"purpose,omitempty"`

	// The number of seconds after the anchor time that the file will expire. Must be
	// between 3600 (1 hour) and 2592000 (30 days).
	// By default, files with `purpose=batch` expire
	// after 30 days and all other files are persisted until they are manually deleted.
	ExpiresAfter int `json:"expires_after,omitempty"`
}

func (CreateRequest) MarshalBody

func (cr CreateRequest) MarshalBody() (body io.Reader, contentType string, err error)

type FileObject

type FileObject struct {
	// The file identifier, which can be referenced in the API endpoints.
	ID string `json:"id"`

	// The name of the file.
	Filename string `json:"filename"`

	// The size of the file, in bytes.
	Bytes int64 `json:"bytes"`

	// The intended purpose of the file. Supported values are `assistants`,
	// `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`,
	// `vision`, and `user_data`.
	//
	// Any of "assistants", "assistants_output", "batch", "batch_output", "fine-tune",
	// "fine-tune-results", "vision", "user_data".
	Purpose FileObjectPurpose `json:"purpose"`

	// The Unix timestamp (in seconds) for when the file was created.
	CreatedAt int64 `json:"created_at"`

	// The Unix timestamp (in seconds) for when the file will expire.
	ExpiresAt int64 `json:"expires_at"`
}

The `File` object represents a document that has been uploaded to OpenAI.

func (*FileObject) String

func (fo *FileObject) String() string

type FileObjectPurpose

type FileObjectPurpose string

The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.

const (
	FileObjectPurposeAssistants       FileObjectPurpose = "assistants"
	FileObjectPurposeAssistantsOutput FileObjectPurpose = "assistants_output"
	FileObjectPurposeBatch            FileObjectPurpose = "batch"
	FileObjectPurposeBatchOutput      FileObjectPurpose = "batch_output"
	FileObjectPurposeFineTune         FileObjectPurpose = "fine-tune"
	FileObjectPurposeFineTuneResults  FileObjectPurpose = "fine-tune-results"
	FileObjectPurposeVision           FileObjectPurpose = "vision"
	FileObjectPurposeUserData         FileObjectPurpose = "user_data"
)

type FileObjectStatus

type FileObjectStatus string

Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.

const (
	FileObjectStatusUploaded  FileObjectStatus = "uploaded"
	FileObjectStatusProcessed FileObjectStatus = "processed"
	FileObjectStatusError     FileObjectStatus = "error"
)

type FilePurpose

type FilePurpose string

The intended purpose of the uploaded file. One of:

- `assistants`: Used in the Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`: Flexible file type for any purpose - `evals`: Used for eval data sets

const (
	FilePurposeAssistants FilePurpose = "assistants"
	FilePurposeBatch      FilePurpose = "batch"
	FilePurposeFineTune   FilePurpose = "fine-tune"
	FilePurposeVision     FilePurpose = "vision"
	FilePurposeUserData   FilePurpose = "user_data"
	FilePurposeEvals      FilePurpose = "evals"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL