maxscore

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README

Max Score Picker

Type: max-score-picker

Selects the endpoint(s) with the highest score calculated during the scoring phase.

[!NOTE] This plugin is enabled by default if no other picker is specified. You do not need to explicitly declare it in your configuration.

What it does

  1. Receives a list of ScoredEndpoint candidates.
  2. Shuffles the list in-place to ensure random tie-breaking when multiple endpoints share the same maximum score.
  3. Sorts the candidates by score in descending order.
  4. Returns the top maxNumOfEndpoints candidates.

Behavioral Intent

This picker maximizes the adherence to scoring objectives (e.g., cache affinity, lowest load). However, it is susceptible to hot-spotting if many concurrent requests produce identical scores for the same endpoint (e.g., identical prompts targeting a specific cache hit).

Inputs consumed

  • Consumes the list of ScoredEndpoint results from the scoring phase.

Configuration

The plugin config supports:

  • maxNumOfEndpoints (default 1)
    • The maximum number of endpoints to pick and return. Must be > 0. If more candidates are available than this limit, only the top subset is returned.

[!TIP] In most production scenarios, maxNumOfEndpoints is left at its default value of 1 to select a single target endpoint for the request.

Documentation

Overview

Package maxscore implements a scheduling picker that selects the endpoint(s) with the highest score calculated during the scoring phase.

For detailed behavioral intent and configuration, see the package README.

Index

Constants

View Source
const (
	// MaxScorePickerType is the registered name of the max score picker plugin.
	MaxScorePickerType = "max-score-picker"
)

Variables

This section is empty.

Functions

func MaxScorePickerFactory

func MaxScorePickerFactory(name string, rawParameters *json.Decoder, _ fwkplugin.Handle) (fwkplugin.Plugin, error)

MaxScorePickerFactory defines the factory function for MaxScorePicker.

Types

type MaxScorePicker

type MaxScorePicker struct {
	// contains filtered or unexported fields
}

MaxScorePicker picks endpoint(s) with the highest score calculated during the scoring phase.

func NewMaxScorePicker

func NewMaxScorePicker(maxNumOfEndpoints int) *MaxScorePicker

NewMaxScorePicker initializes a new MaxScorePicker and returns its pointer.

func (*MaxScorePicker) Pick

Pick selects the endpoint(s) with the highest score calculated during the scoring phase.

func (*MaxScorePicker) TypedName

func (p *MaxScorePicker) TypedName() fwkplugin.TypedName

TypedName returns the type and name tuple of this plugin instance.

func (*MaxScorePicker) WithName

func (p *MaxScorePicker) WithName(name string) *MaxScorePicker

WithName sets the picker's name

Jump to

Keyboard shortcuts

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