@tryhamster/gerbil 1.1.1 → 1.1.3

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 (98) hide show
  1. package/README.md +18 -16
  2. package/dist/{architectures-C1I5V3Dt.mjs → architectures-wan0swXu.mjs} +2 -9
  3. package/dist/architectures-wan0swXu.mjs.map +1 -0
  4. package/dist/cli.mjs +8 -8
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/frameworks/express.mjs +1 -1
  7. package/dist/frameworks/fastify.mjs +1 -1
  8. package/dist/frameworks/hono.mjs +1 -1
  9. package/dist/frameworks/next.mjs +1 -1
  10. package/dist/frameworks/trpc.mjs +1 -1
  11. package/dist/{gerbil-ro5mEpFh.mjs → gerbil-CQspp8fS.mjs} +2 -2
  12. package/dist/{gerbil-ro5mEpFh.mjs.map → gerbil-CQspp8fS.mjs.map} +1 -1
  13. package/dist/gerbil-tHnYb9nZ.mjs +4 -0
  14. package/dist/gpu/hooks.d.mts +3 -3
  15. package/dist/gpu/hooks.mjs +5 -5
  16. package/dist/gpu/hooks.mjs.map +1 -1
  17. package/dist/gpu/index.mjs +3 -3
  18. package/dist/{gpu-yxEq7qT1.mjs → gpu-BYCQ5aTI.mjs} +3 -3
  19. package/dist/gpu-BYCQ5aTI.mjs.map +1 -0
  20. package/dist/index-CKszv3lt.d.mts.map +1 -1
  21. package/dist/index-Dgmb2kE3.d.mts.map +1 -1
  22. package/dist/index.mjs +5 -5
  23. package/dist/integrations/ai-sdk.mjs +1 -1
  24. package/dist/integrations/langchain.mjs +1 -1
  25. package/dist/integrations/llamaindex.mjs +1 -1
  26. package/dist/integrations/mcp.mjs +4 -4
  27. package/dist/{mcp-B0eW-OKz.mjs → mcp-CszII8GJ.mjs} +3 -3
  28. package/dist/{mcp-B0eW-OKz.mjs.map → mcp-CszII8GJ.mjs.map} +1 -1
  29. package/dist/moonshine-stt-BtR-KiSP.mjs +4 -0
  30. package/dist/{moonshine-stt-Cqdf1myz.mjs → moonshine-stt-DDUm5WfP.mjs} +114 -8
  31. package/dist/moonshine-stt-DDUm5WfP.mjs.map +1 -0
  32. package/dist/{one-liner-b0vlnTgd.mjs → one-liner-DVche8Eg.mjs} +2 -2
  33. package/dist/{one-liner-b0vlnTgd.mjs.map → one-liner-DVche8Eg.mjs.map} +1 -1
  34. package/dist/repl-BYJA2U7t.mjs +9 -0
  35. package/dist/skills/index.mjs +3 -3
  36. package/dist/{skills-DCvZK8kL.mjs → skills-BQI-VSn2.mjs} +2 -2
  37. package/dist/{skills-DCvZK8kL.mjs.map → skills-BQI-VSn2.mjs.map} +1 -1
  38. package/package.json +1 -2
  39. package/dist/architectures-C1I5V3Dt.mjs.map +0 -1
  40. package/dist/gerbil-Dy9Zhc_j.mjs +0 -4
  41. package/dist/gpu-yxEq7qT1.mjs.map +0 -1
  42. package/dist/moonshine-stt-Cqdf1myz.mjs.map +0 -1
  43. package/dist/moonshine-stt-TYYYaPo3.mjs +0 -4
  44. package/dist/repl-DUyb-ut6.mjs +0 -9
  45. package/docs/PROJECT-STATE.md +0 -321
  46. package/docs/adding-a-model-family.md +0 -280
  47. package/docs/ai-sdk.md +0 -205
  48. package/docs/architecture/README.md +0 -84
  49. package/docs/architecture/caching.md +0 -227
  50. package/docs/architecture/inference.md +0 -176
  51. package/docs/architecture/overview.md +0 -189
  52. package/docs/architecture/streaming.md +0 -261
  53. package/docs/architecture/webgpu.md +0 -213
  54. package/docs/browser.md +0 -762
  55. package/docs/cli.md +0 -155
  56. package/docs/embeddings.md +0 -156
  57. package/docs/frameworks.md +0 -90
  58. package/docs/gerbil-site-native-migration.md +0 -217
  59. package/docs/gpu-engine/architectures.md +0 -398
  60. package/docs/gpu-engine/ir.md +0 -372
  61. package/docs/gpu-engine/kernels.md +0 -718
  62. package/docs/gpu-engine/paper.html +0 -1759
  63. package/docs/gpu-engine/paper.md +0 -2109
  64. package/docs/gpu-engine/safetensors.md +0 -312
  65. package/docs/gpu-engine/tokenizer.md +0 -302
  66. package/docs/kernel-research-queue.md +0 -85
  67. package/docs/mcp-client.md +0 -224
  68. package/docs/mcp.md +0 -109
  69. package/docs/memory-rag.md +0 -91
  70. package/docs/memory.md +0 -301
  71. package/docs/metal-safari-intel.md +0 -190
  72. package/docs/mobile-failure-diagnosis.md +0 -124
  73. package/docs/mobile.md +0 -99
  74. package/docs/observability.md +0 -230
  75. package/docs/onnx-removal-plan.md +0 -339
  76. package/docs/repl.md +0 -473
  77. package/docs/research/autoresearch-portable.md +0 -933
  78. package/docs/research/dispatch-reduction-hivemind.md +0 -84
  79. package/docs/research/ios-safari-model-caching.md +0 -117
  80. package/docs/research/mobile-webgpu-speed-fusion.md +0 -135
  81. package/docs/research/native-stt-model-selection.md +0 -49
  82. package/docs/research/native-tts-model-selection.md +0 -90
  83. package/docs/research/native-vs-chromium-decision.md +0 -152
  84. package/docs/research/nemotron-mamba2-inference.md +0 -910
  85. package/docs/research/qwen35-multimodal.md +0 -293
  86. package/docs/research/qwen36-gemma4-targets.md +0 -337
  87. package/docs/research/sota-embedding-models.md +0 -179
  88. package/docs/research/sota-mobile-models-2026.md +0 -263
  89. package/docs/research/sota-modality-models.md +0 -202
  90. package/docs/research/tps-baselines.md +0 -71
  91. package/docs/research/webgpu-m4-reference.md +0 -104
  92. package/docs/site-update-plan.md +0 -155
  93. package/docs/skills.md +0 -261
  94. package/docs/structured-output.md +0 -123
  95. package/docs/stt.md +0 -111
  96. package/docs/tools.md +0 -304
  97. package/docs/tts.md +0 -147
  98. package/docs/vision.md +0 -158
package/README.md CHANGED
@@ -123,12 +123,12 @@ For a copy-pasteable version see [`examples/benchmark.ts`](./examples/benchmark.
123
123
 
124
124
  ## React Quickstart
125
125
 
126
- `useEngine` (from `@tryhamster/gerbil/gpu/hooks`) owns the full engine lifecycle —
126
+ `useEngine` (from `@tryhamster/gerbil/hooks`) owns the full engine lifecycle —
127
127
  load, unload, hot-swap on config change, and reference-counted sharing so multiple
128
128
  components never upload the same weights to the GPU twice.
129
129
 
130
130
  ```tsx
131
- import { useEngine } from "@tryhamster/gerbil/gpu/hooks";
131
+ import { useEngine } from "@tryhamster/gerbil/hooks";
132
132
 
133
133
  function Chat() {
134
134
  const { complete, completion, isLoading, isGenerating, tps } = useEngine({
@@ -156,7 +156,7 @@ and `dispose`. Pass `enableVision: true` or `embedding: true` to load those moda
156
156
  until the engine is ready — and keep it warm across navigation (no GPU re-upload):
157
157
 
158
158
  ```tsx
159
- import { GerbilGate } from "@tryhamster/gerbil/gpu/hooks";
159
+ import { GerbilGate } from "@tryhamster/gerbil/hooks";
160
160
 
161
161
  <GerbilGate
162
162
  model="mlx-community/Qwen3.5-0.8B-4bit"
@@ -199,10 +199,10 @@ const engine = await WebGPUEngine.create({ repo: "mlx-community/Qwen3.5-0.8B-4bi
199
199
  await engine.generateObject("…", { schema: { required: ["title"] } });
200
200
  ```
201
201
 
202
- In React, use `useObject` (from `@tryhamster/gerbil/gpu/hooks`):
202
+ In React, use `useObject` (from `@tryhamster/gerbil/hooks`):
203
203
 
204
204
  ```tsx
205
- import { useObject } from "@tryhamster/gerbil/gpu/hooks";
205
+ import { useObject } from "@tryhamster/gerbil/hooks";
206
206
 
207
207
  const { generate, object, isGenerating } = useObject<{ city: string }>();
208
208
  await generate("Extract the city from: I live in Paris", {
@@ -322,17 +322,19 @@ const skill = useSkill("my-skill");
322
322
 
323
323
  ## Tools & Agents
324
324
 
325
- Gerbil supports tool calling with Qwen3 models for agentic workflows:
325
+ Gerbil supports tool calling with Qwen3 models for agentic workflows. A tool is a
326
+ plain object (`AgentTool`) — give it a `name`, `description`, optional `parameters`,
327
+ and an `execute` function:
326
328
 
327
329
  ```typescript
328
- import { defineTool, executeToolCall } from "@tryhamster/gerbil";
330
+ import type { AgentTool } from "@tryhamster/gerbil/gpu";
329
331
 
330
- const weatherTool = defineTool({
332
+ const weatherTool: AgentTool = {
331
333
  name: "get_weather",
332
334
  description: "Get weather for a city",
333
- parameters: z.object({ city: z.string() }),
334
- execute: async ({ city }) => `Weather in ${city}: 72°F, sunny`,
335
- });
335
+ parameters: { city: "string" },
336
+ execute: ({ city }) => `Weather in ${city}: 72°F, sunny`,
337
+ };
336
338
  ```
337
339
 
338
340
  **Agentic loop, on-device.** `engine.generateWithTools` (and the `useAgent` React hook)
@@ -340,7 +342,7 @@ run the whole loop — generate → call a tool → feed the result back → rep
340
342
  step trace for UIs:
341
343
 
342
344
  ```tsx
343
- import { useAgent } from "@tryhamster/gerbil/gpu/hooks";
345
+ import { useAgent } from "@tryhamster/gerbil/hooks";
344
346
 
345
347
  const { run, steps, answer, isRunning } = useAgent({
346
348
  model: "mlx-community/Qwen3.5-0.8B-4bit",
@@ -377,7 +379,7 @@ Inline autocomplete — `engine.autocomplete(prefix)` and the debounced `useAuto
377
379
  hook return a brief single-line continuation (low-latency defaults + cleanup):
378
380
 
379
381
  ```tsx
380
- import { useAutocomplete } from "@tryhamster/gerbil/gpu/hooks";
382
+ import { useAutocomplete } from "@tryhamster/gerbil/hooks";
381
383
 
382
384
  const { suggestion, onInput, accept, dismiss } = useAutocomplete({
383
385
  model: "mlx-community/Qwen3.5-0.8B-4bit",
@@ -418,10 +420,10 @@ gerbil update # Update to latest version
418
420
  ## Browser Usage
419
421
 
420
422
  Run LLMs directly in the browser with WebGPU — no server required. The React hooks
421
- live at `@tryhamster/gerbil/gpu/hooks` and run pure WebGPU compute:
423
+ live at `@tryhamster/gerbil/hooks` and run pure WebGPU compute:
422
424
 
423
425
  ```tsx
424
- import { useChat } from "@tryhamster/gerbil/gpu/hooks";
426
+ import { useChat } from "@tryhamster/gerbil/hooks";
425
427
 
426
428
  function Chat() {
427
429
  const { messages, send, isLoading, isGenerating } = useChat();
@@ -454,7 +456,7 @@ function Chat() {
454
456
  | **LangChain** | `@tryhamster/gerbil/langchain` | [📖 LangChain](https://gerbilsdk.com/docs/frameworks/langchain) |
455
457
  | **MCP Server** | `npx @tryhamster/gerbil serve --mcp` | [📖 MCP](https://gerbilsdk.com/docs/mcp) |
456
458
 
457
- **Native engine:** `import { WebGPUEngine } from "@tryhamster/gerbil/gpu"` (or `useEngine` from `@tryhamster/gerbil/gpu/hooks` for React) is the primary surface for text, vision, embeddings, and speech.
459
+ **Native engine:** `import { WebGPUEngine } from "@tryhamster/gerbil/gpu"` (or `useEngine` from `@tryhamster/gerbil/hooks` for React) is the primary surface for text, vision, embeddings, and speech.
458
460
 
459
461
  ## Supported Models
460
462
 
@@ -1216,17 +1216,10 @@ function generateKaniTtsGraph(rawConfig, dtype, _groupSize, kvDtype) {
1216
1216
  dtype: "f32",
1217
1217
  storage: "activation"
1218
1218
  });
1219
- addTensor({
1220
- name: CANONICAL_KEYS.LM_HEAD,
1221
- shape: [vocab_size, hidden_size],
1222
- dtype: "f32",
1223
- storage: "constant",
1224
- safetensorsKey: CANONICAL_KEYS.EMBED
1225
- });
1226
1219
  addNode({
1227
1220
  id: "lm_head",
1228
1221
  opType: "MatMul",
1229
- inputs: ["final_norm_last", CANONICAL_KEYS.LM_HEAD],
1222
+ inputs: ["final_norm_last", CANONICAL_KEYS.EMBED],
1230
1223
  outputs: ["logits"],
1231
1224
  attributes: {
1232
1225
  M_tensor: "final_norm_last",
@@ -6067,4 +6060,4 @@ function isArchitectureSupported(name) {
6067
6060
 
6068
6061
  //#endregion
6069
6062
  export { parseKaniConfig as C, createDefaultHFKeyMapper as D, GEMMA4_VIS_KEYS as E, nanoCodecWeightMap as S, DTYPE_BYTES as T, generateNanoCodecDecoderGraph as _, generateMoonshineEncoderGraph as a, kaniLayerAlpha as b, DEFAULT_GROUP_SIZE as c, KANI_START_OF_HUMAN as d, audioTokensToCodes as f, generateKaniTtsGraph as g, foldNanoCodecWeightNorm as h, generateMoonshineDecoderGraph as i, quantizeInt4 as l, computeKaniPositions as m, isArchitectureSupported as n, moonshineEncoderFrames as o, buildKaniLayerCosSin as p, MOONSHINE_REMAINING_WORK as r, parseMoonshineConfig as s, generateGraph as t, KANI_END_OF_HUMAN as u, kaniAttentionLayerIndices as v, CANONICAL_KEYS as w, kaniSinTensor as x, kaniCosTensor as y };
6070
- //# sourceMappingURL=architectures-C1I5V3Dt.mjs.map
6063
+ //# sourceMappingURL=architectures-wan0swXu.mjs.map