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): ConstraintModels without a family field always pass and are not counted against any group. Default: 1 per family.
| Parameter | Type | Default | Description |
|---|---|---|---|
max | number | 1 | Maximum 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.