Documentation
¶
Overview ¶
Package batch provides batch processing for multiple LLM requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateInput ¶
type CreateInput struct {
TenantID string `json:"tenant_id,omitempty"`
Inputs []Input `json:"inputs"`
Metadata map[string]any `json:"metadata,omitempty"`
Concurrency int `json:"concurrency,omitempty"` // max parallel requests
}
CreateInput defines a new batch job.
type Executor ¶
type Executor interface {
Execute(ctx context.Context, req *provider.CompletionRequest) (*provider.CompletionResponse, error)
}
Executor processes individual batch requests.
type Input ¶
type Input struct {
CustomID string `json:"custom_id"`
Request *provider.CompletionRequest `json:"request"`
}
Input is a single item in a batch job.
type Job ¶
type Job struct {
ID string `json:"id"`
TenantID string `json:"tenant_id,omitempty"`
Status JobStatus `json:"status"`
Inputs []Input `json:"inputs"`
Results []Result `json:"results,omitempty"`
TotalItems int `json:"total_items"`
Completed int `json:"completed"`
Failed int `json:"failed"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
Job represents a batch processing job.
type Result ¶
type Result struct {
CustomID string `json:"custom_id"`
Response *provider.CompletionResponse `json:"response,omitempty"`
Error *Error `json:"error,omitempty"`
}
Result is the outcome of a single batch item.
type Service ¶
type Service interface {
// Create creates a new batch job.
Create(ctx context.Context, input *CreateInput) (*Job, error)
// Get returns a batch job by ID.
Get(ctx context.Context, jobID string) (*Job, error)
// Cancel cancels a running batch job.
Cancel(ctx context.Context, jobID string) error
// List returns batch jobs for a tenant.
List(ctx context.Context, tenantID string) ([]*Job, error)
}
Service manages batch processing jobs.
func NewService ¶
NewService creates a new batch service.
Click to show internal directories.
Click to hide internal directories.