Files
mistral-go-sdk/file/file.go
vikingowl 9251672de6 feat: v1.1.0 — sync with upstream Python SDK v2.1.3
Add Connectors, Audio Speech/Voices, Audio Realtime types,
and Observability (beta). 41 new service methods, 116 total.

Breaking: ListModels and UploadFile signatures changed
(pass nil for previous behavior).
2026-03-24 09:07:03 +01:00

91 lines
2.3 KiB
Go

package file
// Purpose indicates the intended use of an uploaded file.
type Purpose string
const (
PurposeFineTune Purpose = "fine-tune"
PurposeBatch Purpose = "batch"
PurposeOCR Purpose = "ocr"
)
// SampleType categorizes file content.
type SampleType string
const (
SampleTypePretrain SampleType = "pretrain"
SampleTypeInstruct SampleType = "instruct"
SampleTypeBatchReq SampleType = "batch_request"
SampleTypeBatchResult SampleType = "batch_result"
SampleTypeBatchError SampleType = "batch_error"
)
// Source indicates how a file was created.
type Source string
const (
SourceUpload Source = "upload"
SourceRepository Source = "repository"
SourceMistral Source = "mistral"
)
// File represents an uploaded file.
type File struct {
ID string `json:"id"`
Object string `json:"object"`
Bytes int `json:"bytes"`
CreatedAt int64 `json:"created_at"`
Filename string `json:"filename"`
Purpose Purpose `json:"purpose"`
SampleType SampleType `json:"sample_type"`
NumLines *int `json:"num_lines,omitempty"`
MimeType *string `json:"mimetype,omitempty"`
Source Source `json:"source"`
Signature *string `json:"signature,omitempty"`
Deleted bool `json:"deleted,omitempty"`
}
// ListResponse is the response from listing files.
type ListResponse struct {
Data []File `json:"data"`
Object string `json:"object"`
Total *int `json:"total,omitempty"`
}
// DeleteResponse is the response from deleting a file.
type DeleteResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Deleted bool `json:"deleted"`
}
// SignedURL is the response from getting a signed file URL.
type SignedURL struct {
URL string `json:"url"`
}
// Visibility controls who can see a file.
type Visibility string
const (
VisibilitySharedGlobal Visibility = "shared_global"
VisibilitySharedOrg Visibility = "shared_org"
VisibilitySharedWorkspace Visibility = "shared_workspace"
VisibilityPrivate Visibility = "private"
)
// UploadParams holds parameters for uploading a file.
type UploadParams struct {
Purpose Purpose
Expiry *int
Visibility *Visibility
}
// ListParams holds optional parameters for listing files.
type ListParams struct {
Page *int
PageSize *int
Purpose *Purpose
Search *string
}