Documentation
¶
Index ¶
- Constants
- func EndpointComparer(a, b Endpoint) bool
- func ReadRequestAttribute[T any](r *InferenceRequest, key string) (T, bool)
- func ScoredEndpointComparer(a, b ScoredEndpoint) bool
- type Endpoint
- type Filter
- type InferenceRequest
- type Modality
- type MultiModalFeature
- type Picker
- type ProfileHandler
- type ProfileRunResult
- type RequestObjectives
- type SchedulerProfile
- type SchedulingResult
- type ScoredEndpoint
- type Scorer
- type ScorerCategory
- type TokenizedPrompt
Constants ¶
const ModalityImage = fwkrh.ModalityImage
Variables ¶
This section is empty.
Functions ¶
func EndpointComparer ¶
func ReadRequestAttribute ¶
func ReadRequestAttribute[T any](r *InferenceRequest, key string) (T, bool)
ReadRequestAttribute returns the value stored at key, type-asserted to T. It returns the zero value of T and false if the key is missing or the value is not of type T.
func ScoredEndpointComparer ¶
func ScoredEndpointComparer(a, b ScoredEndpoint) bool
Types ¶
type Endpoint ¶
type Endpoint interface {
GetMetadata() *fwkdl.EndpointMetadata
GetMetrics() *fwkdl.Metrics
String() string
Get(string) (fwkdl.Cloneable, bool)
Put(string, fwkdl.Cloneable)
Keys() []string
Clone() fwkdl.AttributeMap
}
func NewEndpoint ¶
func NewEndpoint(meta *fwkdl.EndpointMetadata, metrics *fwkdl.Metrics, attr fwkdl.AttributeMap) Endpoint
type Filter ¶
type Filter interface {
plugin.Plugin
Filter(ctx context.Context, request *InferenceRequest, pods []Endpoint) []Endpoint
}
Filter defines the interface for filtering a list of pods based on context.
type InferenceRequest ¶
type InferenceRequest struct {
// RequestID is the Envoy generated Id for the request being processed
RequestID string
// TargetModel is the final target model after traffic split.
TargetModel string
// Data contains the request-body fields that we parse out as user input.
Body *fwkrh.InferenceRequestBody
// Headers is a map of the request headers.
Headers map[string]string
// Request Objective
Objectives RequestObjectives
// FairnessID is the identity used by the flow control system to group requests into fairness queues.
FairnessID string
// RequestSizeBytes is the size of the raw request body in bytes when available.
RequestSizeBytes int
// SchedulingResult captures the scheduling decisions made during the cycle.
SchedulingResult *SchedulingResult
// contains filtered or unexported fields
}
InferenceRequest is a structured representation of the fields we parse out of the InferenceRequest body.
func (*InferenceRequest) AttributeKeys ¶
func (r *InferenceRequest) AttributeKeys() []string
AttributeKeys returns the keys currently present in the request's attribute store. The order is unspecified.
func (*InferenceRequest) GetAttribute ¶
func (r *InferenceRequest) GetAttribute(key string) (any, bool)
GetAttribute returns the value stored at key, or nil and false if absent. Prefer ReadRequestAttribute for type-safe access.
func (*InferenceRequest) PutAttribute ¶
func (r *InferenceRequest) PutAttribute(key string, value any)
PutAttribute stores value at key in the request's attribute store. The backing store is lazily allocated on first write. Callers must not write concurrently to the same request from multiple goroutines.
func (*InferenceRequest) String ¶
func (r *InferenceRequest) String() string
type MultiModalFeature ¶
type MultiModalFeature = fwkrh.MultiModalFeature
type Picker ¶
type Picker interface {
plugin.Plugin
Pick(ctx context.Context, scoredPods []*ScoredEndpoint) *ProfileRunResult
}
Picker picks the final pod(s) to send the request to.
type ProfileHandler ¶
type ProfileHandler interface {
plugin.Plugin
// Pick selects the SchedulingProfiles to run from a list of candidate profiles, while taking into consideration the request properties
// and the previously executed SchedluderProfile cycles along with their results.
Pick(ctx context.Context, request *InferenceRequest, profiles map[string]SchedulerProfile,
profileResults map[string]*ProfileRunResult) map[string]SchedulerProfile
// ProcessResults handles the outcome of the profile runs after all profiles ran.
// It may aggregate results, log test profile outputs, or apply custom logic. It specifies in the SchedulingResult the
// key of the primary profile that should be used to get the request selected destination.
// When a profile run fails, its result in the profileResults map is nil.
ProcessResults(ctx context.Context, request *InferenceRequest,
profileResults map[string]*ProfileRunResult) (*SchedulingResult, error)
}
ProfileHandler defines the extension points for handling multi SchedulerProfile instances. More specifically, this interface defines the 'Pick' and 'ProcessResults' extension points.
type ProfileRunResult ¶
type ProfileRunResult struct {
TargetEndpoints []Endpoint
}
ProfileRunResult captures the profile run result.
type RequestObjectives ¶
type RequestObjectives struct {
Priority int
}
RequestObjectives represents the scheduling objectives parsed from the InferenceObjectiveSpec, to be used in scheduling decisions.
type SchedulerProfile ¶
type SchedulerProfile interface {
Run(ctx context.Context, request *InferenceRequest, candidateEndpoints []Endpoint) (*ProfileRunResult, error)
}
type SchedulingResult ¶
type SchedulingResult struct {
ProfileResults map[string]*ProfileRunResult
PrimaryProfileName string
}
SchedulingResult captures the result of the scheduling cycle.
type ScoredEndpoint ¶
type Scorer ¶
type Scorer interface {
plugin.Plugin
Category() ScorerCategory
Score(ctx context.Context, request *InferenceRequest, pods []Endpoint) map[Endpoint]float64
}
Scorer defines the interface for scoring a list of pods based on context. Scorers must score pods with a value within the range of [0,1] where 1 is the highest score. If a scorer returns value greater than 1, it will be treated as score 1. If a scorer returns value lower than 0, it will be treated as score 0.
type ScorerCategory ¶
type ScorerCategory string
ScorerCategory marks the preference a scorer applies when scoring candidate endpoints.
const ( // Affinity indicates a scorer that prefers endpoints with existing locality, such as kv-cache or session-related state, // and therefore tends to give higher scores to the same endpoints. Affinity ScorerCategory = "Affinity" // Distribution indicates a scorer that prefers spreading requests evenly across all candidate endpoints to avoid // hotspots and improve overall utilization. Distribution ScorerCategory = "Distribution" // Balance indicates a scorer that its preference is balanced between Affinity and Distribution. Balance ScorerCategory = "Balance" )
type TokenizedPrompt ¶
type TokenizedPrompt = fwkrh.TokenizedPrompt