MCPcopy Create free account
hub / github.com/cel-expr/cel-go / CostModel

Function CostModel

cel/options.go:882–890  ·  view source on GitHub ↗

CostModel configures overload cost estimators and cost trackers from a set of cost.OverloadModel definitions. Models are validated here because neither the estimator nor the tracker compiled from a model can report a problem once evaluation has begun. See cost.OverloadModel.Validate.

(models ...cost.OverloadModel)

Source from the content-addressed store, hash-verified

880// Models are validated here because neither the estimator nor the tracker compiled from a model
881// can report a problem once evaluation has begun. See cost.OverloadModel.Validate.
882func CostModel(models ...cost.OverloadModel) EnvOption {
883 return func(e *Env) (*Env, error) {
884 if err := cost.ValidateOverloadModels(models...); err != nil {
885 return nil, err
886 }
887 e.costConfig.models = append(e.costConfig.models, models...)
888 return e, nil
889 }
890}
891
892// CostSizingStrategy configures a SizingStrategy for both cost estimation and runtime cost tracking.
893func CostSizingStrategy(strategy cost.SizingStrategy) EnvOption {

Callers 15

CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
TestCostModelFunction · 0.85
TestCostModelValidationFunction · 0.85
TestCostModelVersionFunction · 0.85

Calls 1

ValidateOverloadModelsFunction · 0.92

Tested by 11

TestCostModelFunction · 0.68
TestCostModelValidationFunction · 0.68
TestCostModelVersionFunction · 0.68
TestCostModelExtendEnvFunction · 0.68
CompileOptionsMethod · 0.68