@tryhamster/gerbil 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/architectures-Ol7yUmKf.mjs.map +1 -1
  2. package/dist/browser/index.d.ts +7 -1
  3. package/dist/browser/index.d.ts.map +1 -1
  4. package/dist/cli.mjs +7 -7
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/{defaults-CudhglS1.mjs → defaults-KnrRSIeJ.mjs} +20 -7
  7. package/dist/defaults-KnrRSIeJ.mjs.map +1 -0
  8. package/dist/frameworks/express.d.mts +2 -2
  9. package/dist/frameworks/express.mjs +1 -1
  10. package/dist/frameworks/fastify.d.mts +2 -2
  11. package/dist/frameworks/fastify.mjs +1 -1
  12. package/dist/frameworks/hono.d.mts +2 -2
  13. package/dist/frameworks/hono.mjs +1 -1
  14. package/dist/frameworks/next.d.mts +4 -4
  15. package/dist/frameworks/next.mjs +1 -1
  16. package/dist/frameworks/react.d.mts +2 -2
  17. package/dist/frameworks/trpc.d.mts +2 -2
  18. package/dist/frameworks/trpc.mjs +1 -1
  19. package/dist/gerbil-CUzVDAU7.mjs +4 -0
  20. package/dist/{gerbil-Du-1M2Wq.mjs → gerbil-DGrCwGtJ.mjs} +26 -3
  21. package/dist/{gerbil-Du-1M2Wq.mjs.map → gerbil-DGrCwGtJ.mjs.map} +1 -1
  22. package/dist/{gerbil-4Xid85_Z.d.mts → gerbil-_68_JSGV.d.mts} +15 -4
  23. package/dist/gerbil-_68_JSGV.d.mts.map +1 -0
  24. package/dist/gpu/hooks.d.mts +21 -16
  25. package/dist/gpu/hooks.d.mts.map +1 -1
  26. package/dist/gpu/hooks.mjs +20 -15
  27. package/dist/gpu/hooks.mjs.map +1 -1
  28. package/dist/gpu/index.d.mts +3 -3
  29. package/dist/gpu/index.mjs +4 -4
  30. package/dist/{gpu-BECDib8p.mjs → gpu-DbB321DN.mjs} +1530 -235
  31. package/dist/gpu-DbB321DN.mjs.map +1 -0
  32. package/dist/{index-C4kJrqs1.d.mts → index-BdbeBDTz.d.mts} +210 -9
  33. package/dist/index-BdbeBDTz.d.mts.map +1 -0
  34. package/dist/index.d.mts +4 -4
  35. package/dist/index.mjs +5 -5
  36. package/dist/integrations/ai-sdk.d.mts +2 -2
  37. package/dist/integrations/ai-sdk.mjs +1 -1
  38. package/dist/integrations/langchain.d.mts +2 -2
  39. package/dist/integrations/langchain.mjs +1 -1
  40. package/dist/integrations/llamaindex.d.mts +2 -2
  41. package/dist/integrations/llamaindex.mjs +1 -1
  42. package/dist/integrations/mcp.d.mts +4 -4
  43. package/dist/integrations/mcp.mjs +4 -4
  44. package/dist/{mcp-4imtBQLX.mjs → mcp-DcE3wn-L.mjs} +3 -3
  45. package/dist/{mcp-4imtBQLX.mjs.map → mcp-DcE3wn-L.mjs.map} +1 -1
  46. package/dist/{moonshine-stt-BO5gZ_D6.mjs → moonshine-stt-BGmctcdO.mjs} +555 -7
  47. package/dist/moonshine-stt-BGmctcdO.mjs.map +1 -0
  48. package/dist/moonshine-stt-QoNJeCzR.mjs +4 -0
  49. package/dist/{one-liner-X5vMbWzs.mjs → one-liner-DTGg6zdm.mjs} +2 -2
  50. package/dist/{one-liner-X5vMbWzs.mjs.map → one-liner-DTGg6zdm.mjs.map} +1 -1
  51. package/dist/{outetts-DmR0NfSG.d.mts → outetts-Cr5oGk4z.d.mts} +9 -6
  52. package/dist/{outetts-DmR0NfSG.d.mts.map → outetts-Cr5oGk4z.d.mts.map} +1 -1
  53. package/dist/{repl-CGadrKcY.mjs → repl-Ci0zXCT_.mjs} +3 -3
  54. package/dist/skills/index.d.mts +6 -6
  55. package/dist/skills/index.mjs +3 -3
  56. package/dist/{skills-BFGAXYkm.mjs → skills-Dsf0op66.mjs} +2 -2
  57. package/dist/{skills-BFGAXYkm.mjs.map → skills-Dsf0op66.mjs.map} +1 -1
  58. package/dist/{types-Cpf-aOxX.d.mts → types-CjG36Vzj.d.mts} +9 -3
  59. package/dist/{types-Cpf-aOxX.d.mts.map → types-CjG36Vzj.d.mts.map} +1 -1
  60. package/package.json +1 -1
  61. package/dist/defaults-CudhglS1.mjs.map +0 -1
  62. package/dist/gerbil-4Xid85_Z.d.mts.map +0 -1
  63. package/dist/gerbil-BikD0xFU.mjs +0 -4
  64. package/dist/gpu-BECDib8p.mjs.map +0 -1
  65. package/dist/index-C4kJrqs1.d.mts.map +0 -1
  66. package/dist/moonshine-stt-BO5gZ_D6.mjs.map +0 -1
  67. package/dist/moonshine-stt-fVw-UB4s.mjs +0 -4
@@ -10,6 +10,7 @@ const DEFAULT_MODELS = {
10
10
  embedding: "mlx-community/embeddinggemma-300m-4bit",
11
11
  tts: "nineninesix/kani-tts-450m-0.2-ft",
12
12
  ttsOute: "OuteAI/OuteTTS-1.0-0.6B",
13
+ ttsParler: "parler-tts/parler-tts-mini-v1",
13
14
  stt: "UsefulSensors/moonshine-base"
14
15
  };
15
16
  /**
@@ -25,14 +26,26 @@ const OUTETTS_ASSETS = {
25
26
  speakersBaseURL: `${OUTETTS_ASSET_BASE}/speakers`,
26
27
  defaultVoice: "en-female-1-neutral"
27
28
  };
28
- /** Bundled OuteTTS preset voices (the edwko/OuteTTS v3 default_speakers set). */
29
+ /**
30
+ * Bundled OuteTTS preset voices.
31
+ *
32
+ * Provenance (honest labelling):
33
+ * - `en-female-1-neutral` is the ONE AUTHENTIC OuteAI voice — the OuteTTS v3 bundled
34
+ * default speaker (default_speakers/en-female-1-neutral), copied verbatim.
35
+ * - `gerbil-voice-2..6` are DERIVED voices: distinct timbres produced by running
36
+ * pitch/tempo-varied renderings of that authentic clip back through the REAL
37
+ * DAC.speech encode + prosody pipeline (scripts/engine/stage-outetts-assets.py).
38
+ * They are genuine DAC-encoded OuteSpeakers, but they are NOT OuteAI's own
39
+ * `en-male-*` voices, so they are not labelled as such. (Earlier builds mislabelled
40
+ * them as `en-male-2-neutral` etc.; renamed for honesty.)
41
+ */
29
42
  const OUTETTS_PRESET_VOICES = [
30
43
  "en-female-1-neutral",
31
- "en-female-2-neutral",
32
- "en-male-1-neutral",
33
- "en-male-2-neutral",
34
- "en-male-3-neutral",
35
- "en-male-4-neutral"
44
+ "gerbil-voice-2",
45
+ "gerbil-voice-3",
46
+ "gerbil-voice-4",
47
+ "gerbil-voice-5",
48
+ "gerbil-voice-6"
36
49
  ];
37
50
  /** Resolve the model repo for a set of options, falling back to the defaults. */
38
51
  function resolveDefaultRepo(opts) {
@@ -44,4 +57,4 @@ function resolveDefaultRepo(opts) {
44
57
 
45
58
  //#endregion
46
59
  export { resolveDefaultRepo as i, OUTETTS_ASSETS as n, OUTETTS_PRESET_VOICES as r, DEFAULT_MODELS as t };
47
- //# sourceMappingURL=defaults-CudhglS1.mjs.map
60
+ //# sourceMappingURL=defaults-KnrRSIeJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults-KnrRSIeJ.mjs","names":[],"sources":["../src/gpu/defaults.ts"],"sourcesContent":["/**\n * Default model per capability. Kept in its own tiny module (no heavy imports)\n * so the React hooks can resolve defaults without statically pulling in the GPU\n * engine — they import the engine dynamically to stay light.\n */\nexport const DEFAULT_MODELS = {\n /** Text generation (also the vision-capable checkpoint). */\n text: \"mlx-community/Qwen3.5-0.8B-4bit\",\n /** Image understanding — same checkpoint, vision tower built on demand. */\n vision: \"mlx-community/Qwen3.5-0.8B-4bit\",\n /** Text embeddings. */\n embedding: \"mlx-community/embeddinggemma-300m-4bit\",\n /** Text-to-speech (Apache-2.0; LFM2-350M backbone + NanoCodec). Small/fast default. */\n tts: \"nineninesix/kani-tts-450m-0.2-ft\",\n /**\n * Selectable many-voices TTS (OuteTTS-1.0-0.6B: Qwen3-0.6B codec-LM + DAC.speech).\n * Pass this as the `repo`/`model` to engine.speak()/useTTS to route to OuteTTS.\n */\n ttsOute: \"OuteAI/OuteTTS-1.0-0.6B\",\n /**\n * Selectable describe-your-voice TTS (Parler-TTS-mini-v1: Flan-T5 encoder +\n * cross-attending decoder LM + dac_44khz). Pass this as the `repo`/`model` to\n * engine.speak()/useTTS with a `describeVoice` natural-language description.\n */\n ttsParler: \"parler-tts/parler-tts-mini-v1\",\n /** Speech-to-text. */\n stt: \"UsefulSensors/moonshine-base\",\n} as const;\n\n/**\n * OuteTTS auxiliary assets. The DAC.speech codec ships only `.pth` (non-safetensors),\n * so the folded weights (prep-dac-speech.py output) and the preset speaker JSONs are\n * hosted on the Cloudflare R2 model mirror (same public host the engine reads via\n * GERBIL_MODEL_BASE — range + CORS, free egress, no redirect). Override via the OuteTTS\n * options when self-hosting.\n */\nconst OUTETTS_ASSET_BASE =\n \"https://pub-0522ecec25fc412bb35a523f3e3f63c6.r2.dev/tryhamster/gerbil-outetts-assets\";\nexport const OUTETTS_ASSETS = {\n /** Folded DAC.speech.v1.0 encoder+decoder weights (prep-dac-speech.py output). */\n codecWeightsURL: `${OUTETTS_ASSET_BASE}/dac-speech-folded.safetensors`,\n /** Base URL for the preset speaker JSONs (`{name}.json`). */\n speakersBaseURL: `${OUTETTS_ASSET_BASE}/speakers`,\n /** The default preset voice. */\n defaultVoice: \"en-female-1-neutral\",\n} as const;\n\n/**\n * Bundled OuteTTS preset voices.\n *\n * Provenance (honest labelling):\n * - `en-female-1-neutral` is the ONE AUTHENTIC OuteAI voice — the OuteTTS v3 bundled\n * default speaker (default_speakers/en-female-1-neutral), copied verbatim.\n * - `gerbil-voice-2..6` are DERIVED voices: distinct timbres produced by running\n * pitch/tempo-varied renderings of that authentic clip back through the REAL\n * DAC.speech encode + prosody pipeline (scripts/engine/stage-outetts-assets.py).\n * They are genuine DAC-encoded OuteSpeakers, but they are NOT OuteAI's own\n * `en-male-*` voices, so they are not labelled as such. (Earlier builds mislabelled\n * them as `en-male-2-neutral` etc.; renamed for honesty.)\n */\nexport const OUTETTS_PRESET_VOICES = [\n \"en-female-1-neutral\",\n \"gerbil-voice-2\",\n \"gerbil-voice-3\",\n \"gerbil-voice-4\",\n \"gerbil-voice-5\",\n \"gerbil-voice-6\",\n] as const;\n\n/** Resolve the model repo for a set of options, falling back to the defaults. */\nexport function resolveDefaultRepo(opts: {\n repo?: string;\n embedding?: boolean;\n enableVision?: boolean;\n}): string {\n if (opts.repo) return opts.repo;\n if (opts.embedding) return DEFAULT_MODELS.embedding;\n if (opts.enableVision) return DEFAULT_MODELS.vision;\n return DEFAULT_MODELS.text;\n}\n"],"mappings":";;;;;;AAKA,MAAa,iBAAiB;CAE5B,MAAM;CAEN,QAAQ;CAER,WAAW;CAEX,KAAK;CAKL,SAAS;CAMT,WAAW;CAEX,KAAK;CACN;;;;;;;;AASD,MAAM,qBACJ;AACF,MAAa,iBAAiB;CAE5B,iBAAiB,GAAG,mBAAmB;CAEvC,iBAAiB,GAAG,mBAAmB;CAEvC,cAAc;CACf;;;;;;;;;;;;;;AAeD,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,SAAgB,mBAAmB,MAIxB;AACT,KAAI,KAAK,KAAM,QAAO,KAAK;AAC3B,KAAI,KAAK,UAAW,QAAO,eAAe;AAC1C,KAAI,KAAK,aAAc,QAAO,eAAe;AAC7C,QAAO,eAAe"}
@@ -1,5 +1,5 @@
1
- import "../outetts-DmR0NfSG.mjs";
2
- import { d as GerbilConfig } from "../types-Cpf-aOxX.mjs";
1
+ import "../outetts-Cr5oGk4z.mjs";
2
+ import { d as GerbilConfig } from "../types-CjG36Vzj.mjs";
3
3
  import { Request, Response, Router } from "express";
4
4
 
5
5
  //#region src/frameworks/express.d.ts
@@ -1,5 +1,5 @@
1
1
  import { t as __require } from "../chunk-B9cbKln6.mjs";
2
- import { r as DEFAULT_MODEL, t as Gerbil } from "../gerbil-Du-1M2Wq.mjs";
2
+ import { r as DEFAULT_MODEL, t as Gerbil } from "../gerbil-DGrCwGtJ.mjs";
3
3
  import "../utils-DKO55ZmZ.mjs";
4
4
 
5
5
  //#region src/frameworks/express.ts
@@ -1,5 +1,5 @@
1
- import "../outetts-DmR0NfSG.mjs";
2
- import { d as GerbilConfig } from "../types-Cpf-aOxX.mjs";
1
+ import "../outetts-Cr5oGk4z.mjs";
2
+ import { d as GerbilConfig } from "../types-CjG36Vzj.mjs";
3
3
 
4
4
  //#region src/frameworks/fastify.d.ts
5
5
 
@@ -1,4 +1,4 @@
1
- import { r as DEFAULT_MODEL, t as Gerbil } from "../gerbil-Du-1M2Wq.mjs";
1
+ import { r as DEFAULT_MODEL, t as Gerbil } from "../gerbil-DGrCwGtJ.mjs";
2
2
  import "../utils-DKO55ZmZ.mjs";
3
3
 
4
4
  //#region src/frameworks/fastify.ts
@@ -1,5 +1,5 @@
1
- import "../outetts-DmR0NfSG.mjs";
2
- import { d as GerbilConfig } from "../types-Cpf-aOxX.mjs";
1
+ import "../outetts-Cr5oGk4z.mjs";
2
+ import { d as GerbilConfig } from "../types-CjG36Vzj.mjs";
3
3
  import * as hono0 from "hono";
4
4
  import * as hono_types0 from "hono/types";
5
5
 
@@ -1,4 +1,4 @@
1
- import { r as DEFAULT_MODEL, t as Gerbil } from "../gerbil-Du-1M2Wq.mjs";
1
+ import { r as DEFAULT_MODEL, t as Gerbil } from "../gerbil-DGrCwGtJ.mjs";
2
2
  import "../utils-DKO55ZmZ.mjs";
3
3
 
4
4
  //#region src/frameworks/hono.ts
@@ -1,7 +1,7 @@
1
- import "../outetts-DmR0NfSG.mjs";
2
- import { d as GerbilConfig } from "../types-Cpf-aOxX.mjs";
3
- import "../index-C4kJrqs1.mjs";
4
- import { t as Gerbil } from "../gerbil-4Xid85_Z.mjs";
1
+ import "../outetts-Cr5oGk4z.mjs";
2
+ import { d as GerbilConfig } from "../types-CjG36Vzj.mjs";
3
+ import "../index-BdbeBDTz.mjs";
4
+ import { t as Gerbil } from "../gerbil-_68_JSGV.mjs";
5
5
 
6
6
  //#region src/frameworks/next.d.ts
7
7
 
@@ -1,4 +1,4 @@
1
- import { r as DEFAULT_MODEL, t as Gerbil } from "../gerbil-Du-1M2Wq.mjs";
1
+ import { r as DEFAULT_MODEL, t as Gerbil } from "../gerbil-DGrCwGtJ.mjs";
2
2
  import "../utils-DKO55ZmZ.mjs";
3
3
 
4
4
  //#region src/frameworks/next.ts
@@ -1,5 +1,5 @@
1
- import "../outetts-DmR0NfSG.mjs";
2
- import { d as GerbilConfig, l as GenerateOptions, u as GenerateResult } from "../types-Cpf-aOxX.mjs";
1
+ import "../outetts-Cr5oGk4z.mjs";
2
+ import { d as GerbilConfig, l as GenerateOptions, u as GenerateResult } from "../types-CjG36Vzj.mjs";
3
3
 
4
4
  //#region src/frameworks/react.d.ts
5
5
 
@@ -1,5 +1,5 @@
1
- import "../outetts-DmR0NfSG.mjs";
2
- import { d as GerbilConfig } from "../types-Cpf-aOxX.mjs";
1
+ import "../outetts-Cr5oGk4z.mjs";
2
+ import { d as GerbilConfig } from "../types-CjG36Vzj.mjs";
3
3
 
4
4
  //#region src/frameworks/trpc.d.ts
5
5
 
@@ -1,4 +1,4 @@
1
- import { r as DEFAULT_MODEL, t as Gerbil } from "../gerbil-Du-1M2Wq.mjs";
1
+ import { r as DEFAULT_MODEL, t as Gerbil } from "../gerbil-DGrCwGtJ.mjs";
2
2
  import "../utils-DKO55ZmZ.mjs";
3
3
  import { z } from "zod";
4
4
 
@@ -0,0 +1,4 @@
1
+ import { t as Gerbil } from "./gerbil-DGrCwGtJ.mjs";
2
+ import "./utils-DKO55ZmZ.mjs";
3
+
4
+ export { Gerbil };
@@ -1368,7 +1368,8 @@ The JSON must conform to this schema: ${JSON.stringify(zodToJsonSchema(schema))}
1368
1368
  temperature: options.temperature,
1369
1369
  topP: options.topP,
1370
1370
  topK: options.topK,
1371
- cloneSpeaker: options.cloneSpeaker
1371
+ cloneSpeaker: options.cloneSpeaker,
1372
+ describeVoice: options.describeVoice
1372
1373
  });
1373
1374
  return {
1374
1375
  audio: out.pcm,
@@ -1411,6 +1412,28 @@ The JSON must conform to this schema: ${JSON.stringify(zodToJsonSchema(schema))}
1411
1412
  return (await this.ensureNativeTTSEngine(model ?? DEFAULT_MODELS.ttsOute)).encodeSpeaker(ref);
1412
1413
  }
1413
1414
  /**
1415
+ * Invent a natural-language voice description for Parler-TTS. If a text model is
1416
+ * loaded it writes a richer one-line description from `hint` (e.g. "an excited
1417
+ * sports announcer"); otherwise it falls back to a host-side template bank. Pass the
1418
+ * result as `speak(text, { model: DEFAULT_MODELS.ttsParler, describeVoice })`.
1419
+ *
1420
+ * @example
1421
+ * const desc = await g.inventVoiceDescription("a calm meditation guide");
1422
+ * await g.speak("Breathe in.", { model: DEFAULT_MODELS.ttsParler, describeVoice: desc });
1423
+ */
1424
+ async inventVoiceDescription(hint) {
1425
+ if (this.isLoaded()) try {
1426
+ const prompt = "Write ONE concise sentence describing a speaking voice for a text-to-speech model. Mention gender, tone, pace, and recording quality. Reply with only the sentence." + (hint ? ` The voice should sound like: ${hint}.` : "");
1427
+ const line = (await this.generate(prompt, {
1428
+ maxTokens: 60,
1429
+ temperature: .9
1430
+ })).text.trim().split("\n")[0].trim();
1431
+ if (line.length > 0) return line;
1432
+ } catch {}
1433
+ const { ParlerTTS } = await import("./gpu/index.mjs");
1434
+ return ParlerTTS.randomVoiceDescription();
1435
+ }
1436
+ /**
1414
1437
  * Stream speech generation. The native engine synthesizes the full clip, so a
1415
1438
  * single final audio chunk is yielded.
1416
1439
  */
@@ -1524,7 +1547,7 @@ The JSON must conform to this schema: ${JSON.stringify(zodToJsonSchema(schema))}
1524
1547
  /** Lazily build (or reuse) the native MoonshineSTT engine (default repo). */
1525
1548
  async ensureNativeSTT() {
1526
1549
  if (!this.nativeSTT) {
1527
- const { MoonshineSTT } = await import("./moonshine-stt-fVw-UB4s.mjs");
1550
+ const { MoonshineSTT } = await import("./moonshine-stt-QoNJeCzR.mjs");
1528
1551
  this.nativeSTT = await MoonshineSTT.create();
1529
1552
  }
1530
1553
  return this.nativeSTT;
@@ -1691,4 +1714,4 @@ The JSON must conform to this schema: ${JSON.stringify(zodToJsonSchema(schema))}
1691
1714
 
1692
1715
  //#endregion
1693
1716
  export { resolveModel as a, configureGlobalCache as c, listBuiltinModels as i, getGlobalCache as l, BUILTIN_MODELS as n, ResponseCache as o, DEFAULT_MODEL as r, clearGlobalCache as s, Gerbil as t };
1694
- //# sourceMappingURL=gerbil-Du-1M2Wq.mjs.map
1717
+ //# sourceMappingURL=gerbil-DGrCwGtJ.mjs.map