matrix

package
v0.5.24 Latest Latest
Warning

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

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

Documentation

Overview

Package matrix provides dynamic capability matrix building for the intelligence system. It auto-assigns optimal models to capability slots based on discovered model capabilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder builds dynamic capability matrices from discovered models.

func NewBuilder

func NewBuilder(preferLocal, costOptimization bool, overrides map[string]string) *Builder

NewBuilder creates a new DynamicMatrixBuilder instance.

Parameters:

  • preferLocal: Whether to prefer local models for the secure slot
  • costOptimization: Whether to optimize for cost
  • overrides: Manual overrides for specific slots

Returns:

  • *Builder: A new matrix builder instance

func (*Builder) Build

func (b *Builder) Build(models []*ModelWithCapability) *DynamicMatrix

Build generates a dynamic matrix from the provided models with capabilities. It scores and ranks models for each capability slot and assigns primary models with fallback chains.

Parameters:

  • models: List of models with their analyzed capabilities

Returns:

  • *DynamicMatrix: The generated capability matrix

func (*Builder) GetCurrentMatrix

func (b *Builder) GetCurrentMatrix() *DynamicMatrix

GetCurrentMatrix returns the most recently built matrix. Returns nil if no matrix has been built yet.

Returns:

  • *DynamicMatrix: The current matrix, or nil

func (*Builder) GetCurrentMatrixAsMap

func (b *Builder) GetCurrentMatrixAsMap() map[string]interface{}

GetCurrentMatrixAsMap returns the current matrix as a map for Lua interop.

Returns:

  • map[string]interface{}: The matrix as a map, or nil

func (*Builder) SetCostOptimization

func (b *Builder) SetCostOptimization(costOptimization bool)

SetCostOptimization updates the cost optimization setting.

Parameters:

  • costOptimization: Whether to optimize for cost

func (*Builder) SetOverrides

func (b *Builder) SetOverrides(overrides map[string]string)

SetOverrides updates the manual overrides.

Parameters:

  • overrides: New override mappings

func (*Builder) SetPreferLocal

func (b *Builder) SetPreferLocal(preferLocal bool)

SetPreferLocal updates the prefer local setting.

Parameters:

  • preferLocal: Whether to prefer local models

type CapabilitySlot

type CapabilitySlot string

CapabilitySlot represents a capability slot in the routing matrix.

const (
	SlotCoding    CapabilitySlot = "coding"
	SlotReasoning CapabilitySlot = "reasoning"
	SlotCreative  CapabilitySlot = "creative"
	SlotFast      CapabilitySlot = "fast"
	SlotSecure    CapabilitySlot = "secure"
	SlotVision    CapabilitySlot = "vision"
)

func AllSlots

func AllSlots() []CapabilitySlot

AllSlots returns all capability slots.

type DynamicMatrix

type DynamicMatrix struct {
	Assignments map[CapabilitySlot]*MatrixAssignment `json:"assignments"`
	GeneratedAt time.Time                            `json:"generated_at"`
}

DynamicMatrix represents the complete capability-to-model mapping.

type MatrixAssignment

type MatrixAssignment struct {
	Primary   string   `json:"primary"`
	Fallbacks []string `json:"fallbacks"`
	Score     float64  `json:"score"`
	Reason    string   `json:"reason"`
}

MatrixAssignment represents a model assignment for a capability slot.

type ModelWithCapability

type ModelWithCapability struct {
	ID           string
	Provider     string
	DisplayName  string
	Capabilities *capability.ModelCapability
}

ModelWithCapability combines a model ID with its analyzed capabilities.

Jump to

Keyboard shortcuts

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