Skip to content

perFamily

Without constraints, recommend() might return multiple models from the same model.family (e.g., three grok models or two claude-sonnet versions). perFamily() creates a constraint that limits how many models sharing the same family value appear in results.

function perFamily(max?: number): Constraint

Models without a family field always pass and are not counted against any group. Default: 1 per family.

ParameterTypeDefaultDescription
maxnumber1Maximum models per family.
import { recommend, Purpose, perFamily } from "pickai";
const results = recommend(models, Purpose.Balanced, {
constraints: [perFamily(1)],
limit: 5,
});

See Constraints for the two-pass algorithm and custom constraint examples.