@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
74 lines (73 loc) • 3.02 kB
JavaScript
import { STT_PROVIDER_DESCRIPTORS } from "./sttDescriptors.js";
/**
* Static catalog of every shipped media-handler provider, across all six
* ecosystems (TTS, STT, Realtime, Video, Avatar, Music). Pure data — no
* factory functions, no class imports — mirroring the
* src/lib/factories/providerDescriptors.ts pattern for text/image
* providers.
*
* Entries mirror providerRegistry.ts's hand-constructed TTS/STT/Realtime/
* Video/Avatar/Music registration blocks (registerAllProviders()) exactly —
* this file states today's truth, not an aspirational shape. Keep it in
* sync if those blocks change.
*/
export const MEDIA_HANDLER_CATALOG = [
// --- TTS ---
{ kind: "tts", name: "google-ai", aliases: ["vertex"] },
{ kind: "tts", name: "openai-tts" },
{ kind: "tts", name: "elevenlabs", aliases: ["elevenlabs-tts"] },
{ kind: "tts", name: "azure-tts" },
{ kind: "tts", name: "fish-audio" },
{ kind: "tts", name: "sixtydb" },
{ kind: "tts", name: "cartesia" },
// --- STT ---
// Derived from STT_PROVIDER_DESCRIPTORS (names, aliases and precedence
// order) so the catalog and the descriptors cannot drift. "elevenlabs" is
// reused across kinds on purpose — TTS primary, STT alias — the same way
// "vertex" is a TTS alias and the Video primary; each kind has its own
// registry.
...STT_PROVIDER_DESCRIPTORS.map((descriptor) => ({
kind: "stt",
name: descriptor.name,
...(descriptor.aliases ? { aliases: descriptor.aliases } : {}),
})),
// --- Realtime ---
{ kind: "realtime", name: "openai-realtime" },
{ kind: "realtime", name: "gemini-live" },
// --- Video ---
{ kind: "video", name: "vertex" },
{ kind: "video", name: "kling" },
{ kind: "video", name: "runway" },
{ kind: "video", name: "replicate" },
// --- Avatar ---
{ kind: "avatar", name: "d-id" },
{ kind: "avatar", name: "replicate", aliases: ["musetalk"] },
{ kind: "avatar", name: "heygen" },
// --- Music ---
{ kind: "music", name: "beatoven" },
{ kind: "music", name: "replicate", aliases: ["musicgen"] },
{ kind: "music", name: "elevenlabs-music", aliases: ["elevenlabs-sound"] },
{ kind: "music", name: "lyria" },
];
/** Every selectable provider name for `kind`, primaries and aliases both. */
export function providerChoicesFor(kind) {
const choices = [];
for (const entry of MEDIA_HANDLER_CATALOG) {
if (entry.kind !== kind) {
continue;
}
choices.push(entry.name);
if (entry.aliases) {
choices.push(...entry.aliases);
}
}
return choices;
}
/** The first-listed primary provider name for `kind` — used as a fallback default. */
export function defaultProviderFor(kind) {
const first = MEDIA_HANDLER_CATALOG.find((entry) => entry.kind === kind);
if (!first) {
throw new Error(`No media handler catalog entries registered for kind "${kind}"`);
}
return first.name;
}