@tryhamster/gerbil 1.8.0 → 1.10.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.
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +10 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/cli.mjs +7 -7
- package/dist/cli.mjs.map +1 -1
- package/dist/frameworks/express.mjs +1 -1
- package/dist/frameworks/fastify.mjs +1 -1
- package/dist/frameworks/hono.mjs +1 -1
- package/dist/frameworks/next.d.mts +2 -2
- package/dist/frameworks/next.mjs +1 -1
- package/dist/frameworks/trpc.mjs +1 -1
- package/dist/{gerbil-DU1aRO6v.d.mts → gerbil-CSk3AHNN.d.mts} +10 -9
- package/dist/{gerbil-DU1aRO6v.d.mts.map → gerbil-CSk3AHNN.d.mts.map} +1 -1
- package/dist/gerbil-DrV6iNcD.mjs +4 -0
- package/dist/{gerbil-Cgmb4Dit.mjs → gerbil-DtREprR_.mjs} +32 -10
- package/dist/gerbil-DtREprR_.mjs.map +1 -0
- package/dist/gpu/hooks.d.mts +16 -1
- package/dist/gpu/hooks.d.mts.map +1 -1
- package/dist/gpu/hooks.mjs +29 -4
- package/dist/gpu/hooks.mjs.map +1 -1
- package/dist/gpu/index.d.mts +1 -1
- package/dist/gpu/index.mjs +2 -2
- package/dist/{gpu-kQVLpV3n.mjs → gpu-NPdk7pmr.mjs} +221 -25
- package/dist/gpu-NPdk7pmr.mjs.map +1 -0
- package/dist/{index-ElJKy9i9.d.mts → index-B56xBiR2.d.mts} +96 -4
- package/dist/index-B56xBiR2.d.mts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/integrations/ai-sdk.mjs +1 -1
- package/dist/integrations/langchain.mjs +1 -1
- package/dist/integrations/llamaindex.mjs +1 -1
- package/dist/integrations/mcp.d.mts +2 -2
- package/dist/integrations/mcp.mjs +4 -4
- package/dist/{mcp-DTusP2m5.mjs → mcp-XU4quJ9w.mjs} +3 -3
- package/dist/{mcp-DTusP2m5.mjs.map → mcp-XU4quJ9w.mjs.map} +1 -1
- package/dist/moonshine-stt-BRTnAoQ8.mjs +4 -0
- package/dist/{moonshine-stt-9wc6t11v.mjs → moonshine-stt-BYbYwSz2.mjs} +301 -13
- package/dist/moonshine-stt-BYbYwSz2.mjs.map +1 -0
- package/dist/{one-liner-Bk5x7gYH.mjs → one-liner-1WoJGLlZ.mjs} +2 -2
- package/dist/{one-liner-Bk5x7gYH.mjs.map → one-liner-1WoJGLlZ.mjs.map} +1 -1
- package/dist/{repl-DV6l-jT8.mjs → repl-B41yROa-.mjs} +3 -3
- package/dist/skills/index.d.mts +4 -4
- package/dist/skills/index.mjs +3 -3
- package/dist/{skills-BhcwnL2l.mjs → skills-C9RgR8qU.mjs} +2 -2
- package/dist/{skills-BhcwnL2l.mjs.map → skills-C9RgR8qU.mjs.map} +1 -1
- package/dist/tune/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/gerbil-BFk5jV0h.mjs +0 -4
- package/dist/gerbil-Cgmb4Dit.mjs.map +0 -1
- package/dist/gpu-kQVLpV3n.mjs.map +0 -1
- package/dist/index-ElJKy9i9.d.mts.map +0 -1
- package/dist/moonshine-stt-9wc6t11v.mjs.map +0 -1
- package/dist/moonshine-stt-B7rDn6Q9.mjs +0 -4
package/dist/gpu/hooks.mjs
CHANGED
|
@@ -143,7 +143,7 @@ async function decodeImage(src) {
|
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
function useEngine(options = {}) {
|
|
146
|
-
const { model: modelOption, maxSeqLen, dtype = "auto", autoLoad = false, enableVision = false, embedding = false, loadingTimeout = 3e5, onReady, onError } = options;
|
|
146
|
+
const { model: modelOption, maxSeqLen, dtype = "auto", autoLoad = false, enableVision = false, embedding = false, adapter = null, loadingTimeout = 3e5, onReady, onError } = options;
|
|
147
147
|
const model = resolveDefaultRepo({
|
|
148
148
|
repo: modelOption,
|
|
149
149
|
embedding,
|
|
@@ -153,6 +153,7 @@ function useEngine(options = {}) {
|
|
|
153
153
|
const stoppedRef = useRef(false);
|
|
154
154
|
const timeoutRef = useRef(null);
|
|
155
155
|
const heldKeyRef = useRef(null);
|
|
156
|
+
const appliedAdapterRef = useRef(null);
|
|
156
157
|
const failedKeyRef = useRef(null);
|
|
157
158
|
const [isLoading, setIsLoading] = useState(false);
|
|
158
159
|
const [loadingProgress, setLoadingProgress] = useState(null);
|
|
@@ -394,17 +395,39 @@ function useEngine(options = {}) {
|
|
|
394
395
|
return () => {
|
|
395
396
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
396
397
|
engineRef.current = null;
|
|
398
|
+
appliedAdapterRef.current = null;
|
|
397
399
|
if (heldKeyRef.current) {
|
|
398
400
|
releaseSharedEngine(heldKeyRef.current);
|
|
399
401
|
heldKeyRef.current = null;
|
|
400
402
|
}
|
|
401
403
|
};
|
|
402
404
|
}, []);
|
|
405
|
+
useEffect(() => {
|
|
406
|
+
if (!isReady) return;
|
|
407
|
+
const engine = engineRef.current;
|
|
408
|
+
if (!engine || typeof engine.loadAdapter !== "function") return;
|
|
409
|
+
const target = adapter ?? null;
|
|
410
|
+
if (appliedAdapterRef.current === target) return;
|
|
411
|
+
let cancelled = false;
|
|
412
|
+
engine.loadAdapter(target).then(() => {
|
|
413
|
+
if (!cancelled) appliedAdapterRef.current = target;
|
|
414
|
+
}).catch((e) => {
|
|
415
|
+
if (!cancelled) fail(e);
|
|
416
|
+
});
|
|
417
|
+
return () => {
|
|
418
|
+
cancelled = true;
|
|
419
|
+
};
|
|
420
|
+
}, [
|
|
421
|
+
adapter,
|
|
422
|
+
isReady,
|
|
423
|
+
fail
|
|
424
|
+
]);
|
|
403
425
|
useEffect(() => {
|
|
404
426
|
if (heldKeyRef.current === modelKey) return;
|
|
405
427
|
failedKeyRef.current = null;
|
|
406
428
|
if (heldKeyRef.current === null) return;
|
|
407
429
|
engineRef.current = null;
|
|
430
|
+
appliedAdapterRef.current = null;
|
|
408
431
|
releaseSharedEngine(heldKeyRef.current);
|
|
409
432
|
heldKeyRef.current = null;
|
|
410
433
|
setIsReady(false);
|
|
@@ -549,7 +572,7 @@ function useAgent(options) {
|
|
|
549
572
|
* ```
|
|
550
573
|
*/
|
|
551
574
|
function useAutocomplete(options) {
|
|
552
|
-
const { model, debounceMs = 550, minChars = 8, maxTokens = 16, temperature = .3, autoLoad = false, maxSeqLen } = options;
|
|
575
|
+
const { model, debounceMs = 550, minChars = 8, maxTokens = 16, temperature = .3, repetitionPenalty = 1.25, autoLoad = false, maxSeqLen } = options;
|
|
553
576
|
const engine = useEngine({
|
|
554
577
|
model,
|
|
555
578
|
autoLoad,
|
|
@@ -571,7 +594,8 @@ function useAutocomplete(options) {
|
|
|
571
594
|
if (engine.error) return;
|
|
572
595
|
const out = await engine.autocomplete(text, {
|
|
573
596
|
maxTokens,
|
|
574
|
-
temperature
|
|
597
|
+
temperature,
|
|
598
|
+
repetitionPenalty
|
|
575
599
|
});
|
|
576
600
|
if (requestedForRef.current !== text) return;
|
|
577
601
|
if (out) setSuggestion(out);
|
|
@@ -583,7 +607,8 @@ function useAutocomplete(options) {
|
|
|
583
607
|
engine,
|
|
584
608
|
minChars,
|
|
585
609
|
maxTokens,
|
|
586
|
-
temperature
|
|
610
|
+
temperature,
|
|
611
|
+
repetitionPenalty
|
|
587
612
|
]);
|
|
588
613
|
const onInput = useCallback((text) => {
|
|
589
614
|
setSuggestion("");
|