@tryhamster/gerbil 1.1.2 → 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.
- package/README.md +18 -16
- package/dist/cli.mjs +1 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/gpu/hooks.d.mts +3 -3
- package/dist/gpu/hooks.mjs +5 -5
- package/dist/gpu/hooks.mjs.map +1 -1
- package/dist/index-Dgmb2kE3.d.mts.map +1 -1
- package/package.json +1 -2
- package/docs/PROJECT-STATE.md +0 -321
- package/docs/adding-a-model-family.md +0 -280
- package/docs/ai-sdk.md +0 -205
- package/docs/architecture/README.md +0 -84
- package/docs/architecture/caching.md +0 -227
- package/docs/architecture/inference.md +0 -176
- package/docs/architecture/overview.md +0 -189
- package/docs/architecture/streaming.md +0 -261
- package/docs/architecture/webgpu.md +0 -213
- package/docs/browser.md +0 -762
- package/docs/cli.md +0 -155
- package/docs/embeddings.md +0 -156
- package/docs/frameworks.md +0 -90
- package/docs/gerbil-site-native-migration.md +0 -217
- package/docs/gpu-engine/architectures.md +0 -398
- package/docs/gpu-engine/ir.md +0 -372
- package/docs/gpu-engine/kernels.md +0 -718
- package/docs/gpu-engine/paper.html +0 -1759
- package/docs/gpu-engine/paper.md +0 -2109
- package/docs/gpu-engine/safetensors.md +0 -312
- package/docs/gpu-engine/tokenizer.md +0 -302
- package/docs/kernel-research-queue.md +0 -85
- package/docs/mcp-client.md +0 -224
- package/docs/mcp.md +0 -109
- package/docs/memory-rag.md +0 -91
- package/docs/memory.md +0 -301
- package/docs/metal-safari-intel.md +0 -190
- package/docs/mobile-failure-diagnosis.md +0 -124
- package/docs/mobile.md +0 -99
- package/docs/observability.md +0 -230
- package/docs/onnx-removal-plan.md +0 -339
- package/docs/repl.md +0 -473
- package/docs/research/autoresearch-portable.md +0 -933
- package/docs/research/dispatch-reduction-hivemind.md +0 -84
- package/docs/research/ios-safari-model-caching.md +0 -117
- package/docs/research/mobile-webgpu-speed-fusion.md +0 -135
- package/docs/research/native-stt-model-selection.md +0 -49
- package/docs/research/native-tts-model-selection.md +0 -90
- package/docs/research/native-vs-chromium-decision.md +0 -152
- package/docs/research/nemotron-mamba2-inference.md +0 -910
- package/docs/research/qwen35-multimodal.md +0 -293
- package/docs/research/qwen36-gemma4-targets.md +0 -337
- package/docs/research/sota-embedding-models.md +0 -179
- package/docs/research/sota-mobile-models-2026.md +0 -263
- package/docs/research/sota-modality-models.md +0 -202
- package/docs/research/tps-baselines.md +0 -71
- package/docs/research/webgpu-m4-reference.md +0 -104
- package/docs/site-update-plan.md +0 -155
- package/docs/skills.md +0 -261
- package/docs/structured-output.md +0 -123
- package/docs/stt.md +0 -111
- package/docs/tools.md +0 -304
- package/docs/tts.md +0 -147
- 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/
|
|
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/
|
|
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/
|
|
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/
|
|
202
|
+
In React, use `useObject` (from `@tryhamster/gerbil/hooks`):
|
|
203
203
|
|
|
204
204
|
```tsx
|
|
205
|
-
import { useObject } from "@tryhamster/gerbil/
|
|
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 {
|
|
330
|
+
import type { AgentTool } from "@tryhamster/gerbil/gpu";
|
|
329
331
|
|
|
330
|
-
const weatherTool =
|
|
332
|
+
const weatherTool: AgentTool = {
|
|
331
333
|
name: "get_weather",
|
|
332
334
|
description: "Get weather for a city",
|
|
333
|
-
parameters:
|
|
334
|
-
execute:
|
|
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/
|
|
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/
|
|
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/
|
|
423
|
+
live at `@tryhamster/gerbil/hooks` and run pure WebGPU compute:
|
|
422
424
|
|
|
423
425
|
```tsx
|
|
424
|
-
import { useChat } from "@tryhamster/gerbil/
|
|
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/
|
|
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
|
|