Skip to content
Source
Sign inSign up

model.ts

33 lines1.1 KB

1import type { EnvironmentSpeechModel } from "@t3tools/contracts";
2import catalog from "./catalog.json" with { type: "json" };
3​
4export type SpeechModel = {
5 readonly id: string;
6 readonly revision: string;
7 readonly name: string;
8 readonly description: string;
9 readonly filename: string;
10 readonly size: number;
11 readonly sha256: string;
12 readonly languages: readonly string[];
13 readonly accuracy: number;
14 readonly speed: number;
15 readonly benchmark: NonNullable<EnvironmentSpeechModel["benchmark"]>;
16 readonly recommended: boolean;
17 readonly supportsStreaming: boolean;
18 readonly supportsLanguageDetection: boolean;
19 readonly supportsTranslation: boolean;
20};
21​
22// Scores remain required by the wire schema but are not displayed.
23export const SPEECH_MODELS: readonly SpeechModel[] = catalog.models.map((model) => ({
24 ...model,
25 accuracy: 0,
26 speed: 0,
27}));
28​
29export const DEFAULT_SPEECH_MODEL_ID = "handy-computer/parakeet-unified-en-0.6b-gguf";
30export const getSpeechModel = (modelId: string): SpeechModel | undefined =>
31 SPEECH_MODELS.find((model) => model.id === modelId);
32​
33export { effectiveSpeechLanguage } from "@t3tools/shared/speech";