Routing Constraints
When using a router, you need to specify a RoutingConstraint
to determine which point on the Pareto frontier to use.
To create a RoutingConstraint
, pass in a CostConstraint
or QualityConstraint
object.
To create a CostConstraint
or QualityConstraint
, pass in a ConstraintValue
object.
- class martian_apart_hack_sdk.models.RouterConstraints.RoutingConstraint(cost_constraint=None, quality_constraint=None)[source]
Routing constraint that can be either a cost or quality constraint, but not both.
- Parameters:
cost_constraint (Optional[CostConstraint], optional) – The cost constraint.
quality_constraint (Optional[QualityConstraint], optional) – The quality constraint.
- class martian_apart_hack_sdk.models.RouterConstraints.CostConstraint(value)[source]
Cost constraint for routing.
- Parameters:
value (ConstraintValue) – The maximum cost in USD, specified as a either a direct numeric value or by referencing the cost of a specific model.
- class martian_apart_hack_sdk.models.RouterConstraints.QualityConstraint(value)[source]
Quality constraint for routing.
- Parameters:
value (ConstraintValue) – The minimum quality score from 0 to 1, specified as a either a direct numeric value or by referencing the quality of a specific model.
- class martian_apart_hack_sdk.models.RouterConstraints.ConstraintValue(numeric_value=None, model_name=None)[source]
Value for a constraint that can be either numeric or a model name.
- Parameters:
numeric_value (Optional[float], optional) – A numeric value for the constraint.
model_name (Optional[str], optional) – The model name for the constraint.
- Raises:
ValueError – If both numeric_value and model_name are not set.
If the constraint value will be used as a cost constraint, the constraint value represents a maximum cost in USD. If the constraint value will be used in a quality constraint, the constraint value represents a minimum quality score from 0 to 1.
Use a numeric_value to specify the constraint value explicitly. Use a model_name to specify that the constraint mirrors the cost or quality of a specific model.
Note: You can not specify both numeric_value and model_name.