File size: 447 Bytes
c964813
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import type { ModelSpec } from "@elvis/ui";

import spec from "../../../backend/src/algorithms.json";

// The optimisers, from the spec shared with the Python backend. JSON imports
// type "kind" as string, so the shape is checked by backend/tests instead.
export const ALGORITHMS = spec.algorithms as unknown as ModelSpec[];

export function algorithmById(id: string): ModelSpec {
  return ALGORITHMS.find((a) => a.id === id) ?? ALGORITHMS[0];
}