Skip to content

Commit

Permalink
feat: de-inlining Batch errors, int64 timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
tucnak committed Nov 29, 2024
1 parent df33c7e commit f180ab5
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,36 +73,40 @@ func (r BatchEmbeddingRequest) MarshalBatchLineItem() []byte {
}

type Batch struct {
ID string `json:"id"`
Object string `json:"object"`
Endpoint BatchEndpoint `json:"endpoint"`
Errors *struct {
Object string `json:"object,omitempty"`
Data []struct {
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
Param *string `json:"param,omitempty"`
Line *int `json:"line,omitempty"`
} `json:"data"`
} `json:"errors"`
ID string `json:"id"`
Object string `json:"object"`
InputFileID string `json:"input_file_id"`
CompletionWindow string `json:"completion_window"`
Endpoint BatchEndpoint `json:"endpoint"`
Status BatchStatus `json:"status"`
OutputFileID *string `json:"output_file_id"`
ErrorFileID *string `json:"error_file_id"`
CreatedAt int `json:"created_at"`
InProgressAt *int `json:"in_progress_at"`
ExpiresAt *int `json:"expires_at"`
FinalizingAt *int `json:"finalizing_at"`
CompletedAt *int `json:"completed_at"`
FailedAt *int `json:"failed_at"`
ExpiredAt *int `json:"expired_at"`
CancellingAt *int `json:"cancelling_at"`
CancelledAt *int `json:"cancelled_at"`
RequestCounts BatchRequestCounts `json:"request_counts"`
Errors *BatchErrors `json:"errors,omitempty"`
OutputFileID string `json:"output_file_id,omitempty"`
ErrorFileID string `json:"error_file_id,omitempty"`
CreatedAt int64 `json:"created_at"`
InProgressAt int64 `json:"in_progress_at,omitempty"`
ExpiresAt int64 `json:"expires_at,omitempty"`
FinalizingAt int64 `json:"finalizing_at,omitempty"`
CompletedAt int64 `json:"completed_at,omitempty"`
FailedAt int64 `json:"failed_at,omitempty"`
ExpiredAt int64 `json:"expired_at,omitempty"`
CancellingAt int64 `json:"cancelling_at,omitempty"`
CancelledAt int64 `json:"cancelled_at,omitempty"`
RequestCounts BatchRequestCounts `json:"request_counts,omitempty"`
Metadata map[string]any `json:"metadata"`
}

type BatchErrors struct {
Object string `json:"object,omitempty"`
Data []BatchError `json:"data"`
}

type BatchError struct {
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
Param string `json:"param,omitempty"`
Line int `json:"line,omitempty"`
}

type BatchRequestCounts struct {
Total int `json:"total"`
Completed int `json:"completed"`
Expand Down

0 comments on commit f180ab5

Please sign in to comment.