@blank-utils/llm 0.2.3 → 0.2.6
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 +134 -4
- package/dist/index.js +755 -293
- package/dist/react/index.js +778 -293
- package/package.json +6 -3
- package/dist/backends/transformers.d.ts +0 -45
- package/dist/backends/transformers.d.ts.map +0 -1
- package/dist/backends/webllm.d.ts +0 -35
- package/dist/backends/webllm.d.ts.map +0 -1
- package/dist/core.d.ts +0 -71
- package/dist/core.d.ts.map +0 -1
- package/dist/detect.d.ts +0 -21
- package/dist/detect.d.ts.map +0 -1
- package/dist/helpers.d.ts +0 -35
- package/dist/helpers.d.ts.map +0 -1
- package/dist/index.d.ts +0 -27
- package/dist/index.d.ts.map +0 -1
- package/dist/models.d.ts +0 -74
- package/dist/models.d.ts.map +0 -1
- package/dist/react/chat-input.d.ts +0 -43
- package/dist/react/chat-input.d.ts.map +0 -1
- package/dist/react/components.d.ts +0 -52
- package/dist/react/components.d.ts.map +0 -1
- package/dist/react/index.d.ts +0 -311
- package/dist/react/index.d.ts.map +0 -1
- package/dist/types.d.ts +0 -180
- package/dist/types.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blank-utils/llm",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Run LLMs directly in your browser with WebGPU acceleration. Supports React hooks and eager background loading.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"dev": "bun --watch ./src/index.ts",
|
|
36
36
|
"clean": "rm -rf dist",
|
|
37
|
-
"build:js": "bun build ./src/index.ts --outfile ./dist/index.js --format esm --external react --external react-dom && bun build ./src/react/index.tsx --outfile ./dist/react/index.js --format esm --external react --external react-dom",
|
|
37
|
+
"build:js": "bun build ./src/index.ts --outfile ./dist/index.js --format esm --external react --external react-dom --external streamdown --external @streamdown/code --external @streamdown/mermaid && bun build ./src/react/index.tsx --outfile ./dist/react/index.js --format esm --external react --external react-dom --external streamdown --external @streamdown/code --external @streamdown/mermaid",
|
|
38
38
|
"postbuild": "mkdir -p dist/react && cp node_modules/@huggingface/transformers/dist/*.wasm dist/ && cp node_modules/onnxruntime-web/dist/*.mjs dist/ && cp node_modules/onnxruntime-web/dist/*.wasm dist/ && cp dist/*.wasm dist/react/ 2>/dev/null || true && cp dist/*.mjs dist/react/ 2>/dev/null || true",
|
|
39
39
|
"build:types": "tsc -p tsconfig.build.json",
|
|
40
40
|
"build": "bun run clean && bun run build:js && bun run postbuild && bun run build:types",
|
|
@@ -91,6 +91,9 @@
|
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@huggingface/transformers": "^3.8.1",
|
|
94
|
-
"@mlc-ai/web-llm": "^0.2.80"
|
|
94
|
+
"@mlc-ai/web-llm": "^0.2.80",
|
|
95
|
+
"@streamdown/code": "^1.0.2",
|
|
96
|
+
"@streamdown/mermaid": "^1.0.2",
|
|
97
|
+
"streamdown": "^2.2.0"
|
|
95
98
|
}
|
|
96
99
|
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transformers.js Backend Implementation
|
|
3
|
-
* Fallback backend using HuggingFace Transformers.js with ONNX runtime
|
|
4
|
-
*/
|
|
5
|
-
import type { LLMProvider, ChatMessage, GenerateOptions, StreamCallback, LoadProgressCallback, Backend, Device, Quantization } from '../types';
|
|
6
|
-
/**
|
|
7
|
-
* Default model for Transformers.js backend
|
|
8
|
-
* Using Qwen2.5 0.5B as it's well-tested with ONNX
|
|
9
|
-
*/
|
|
10
|
-
import { DEFAULT_TRANSFORMERS_MODEL, TRANSFORMERS_MODELS, type TransformersModelID } from '../models';
|
|
11
|
-
export { DEFAULT_TRANSFORMERS_MODEL, TRANSFORMERS_MODELS };
|
|
12
|
-
export type TransformersModelAlias = TransformersModelID;
|
|
13
|
-
/**
|
|
14
|
-
* Model size estimates for UI display
|
|
15
|
-
*/
|
|
16
|
-
export declare const TRANSFORMERS_MODEL_SIZES: Record<TransformersModelAlias, string>;
|
|
17
|
-
/**
|
|
18
|
-
* Configuration for TransformersProvider
|
|
19
|
-
*/
|
|
20
|
-
export interface TransformersProviderConfig {
|
|
21
|
-
device?: Device;
|
|
22
|
-
quantization?: Quantization;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Transformers.js provider implementation
|
|
26
|
-
*/
|
|
27
|
-
export declare class TransformersProvider implements LLMProvider {
|
|
28
|
-
readonly backend: Backend;
|
|
29
|
-
private pipeline;
|
|
30
|
-
private currentModel;
|
|
31
|
-
private device;
|
|
32
|
-
private quantization;
|
|
33
|
-
constructor(config?: TransformersProviderConfig);
|
|
34
|
-
get isReady(): boolean;
|
|
35
|
-
get modelId(): string | null;
|
|
36
|
-
load(modelId: string, onProgress?: LoadProgressCallback): Promise<void>;
|
|
37
|
-
chat(messages: ChatMessage[], options?: GenerateOptions): Promise<string>;
|
|
38
|
-
stream(messages: ChatMessage[], onToken: StreamCallback, options?: GenerateOptions): Promise<string>;
|
|
39
|
-
unload(): Promise<void>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Create a Transformers.js provider instance
|
|
43
|
-
*/
|
|
44
|
-
export declare function createTransformersProvider(config?: TransformersProviderConfig): TransformersProvider;
|
|
45
|
-
//# sourceMappingURL=transformers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformers.d.ts","sourceRoot":"","sources":["../../src/backends/transformers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,eAAe,EACf,cAAc,EACd,oBAAoB,EAEpB,OAAO,EACP,MAAM,EACN,YAAY,EACb,MAAM,UAAU,CAAC;AAKlB;;;GAGG;AACH,OAAO,EAAE,0BAA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
* WebLLM Backend Implementation
|
|
3
|
-
* Primary backend using MLC's WebLLM for high-performance inference
|
|
4
|
-
*/
|
|
5
|
-
import type { LLMProvider, ChatMessage, GenerateOptions, StreamCallback, LoadProgressCallback, Backend } from '../types';
|
|
6
|
-
/**
|
|
7
|
-
* Default model for WebLLM backend
|
|
8
|
-
* Using Phi 3.5 Mini as it's well-tested and reasonably sized
|
|
9
|
-
*/
|
|
10
|
-
import { DEFAULT_WEBLLM_MODEL, WEBLLM_MODELS, type WebLLMModelID } from '../models';
|
|
11
|
-
export { DEFAULT_WEBLLM_MODEL, WEBLLM_MODELS };
|
|
12
|
-
export type WebLLMModelAlias = WebLLMModelID;
|
|
13
|
-
/**
|
|
14
|
-
* Model size estimates for UI display
|
|
15
|
-
*/
|
|
16
|
-
export declare const WEBLLM_MODEL_SIZES: Record<WebLLMModelAlias, string>;
|
|
17
|
-
/**
|
|
18
|
-
* WebLLM provider implementation
|
|
19
|
-
*/
|
|
20
|
-
export declare class WebLLMProvider implements LLMProvider {
|
|
21
|
-
readonly backend: Backend;
|
|
22
|
-
private engine;
|
|
23
|
-
private currentModel;
|
|
24
|
-
get isReady(): boolean;
|
|
25
|
-
get modelId(): string | null;
|
|
26
|
-
load(modelId: string, onProgress?: LoadProgressCallback): Promise<void>;
|
|
27
|
-
chat(messages: ChatMessage[], options?: GenerateOptions): Promise<string>;
|
|
28
|
-
stream(messages: ChatMessage[], onToken: StreamCallback, options?: GenerateOptions): Promise<string>;
|
|
29
|
-
unload(): Promise<void>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Create a WebLLM provider instance
|
|
33
|
-
*/
|
|
34
|
-
export declare function createWebLLMProvider(): WebLLMProvider;
|
|
35
|
-
//# sourceMappingURL=webllm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webllm.d.ts","sourceRoot":"","sources":["../../src/backends/webllm.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,eAAe,EACf,cAAc,EACd,oBAAoB,EAEpB,OAAO,EACR,MAAM,UAAU,CAAC;AAMlB;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,CAAC;AAE/C,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CA6B/D,CAAC;AAYF;;GAEG;AACH,qBAAa,cAAe,YAAW,WAAW;IAChD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAY;IAErC,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,YAAY,CAAuB;IAE3C,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAE3B;IAEK,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBvE,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBzE,MAAM,CACV,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC;IA8BZ,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAO9B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAErD"}
|
package/dist/core.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core LLM functionality - Separated from index.ts to avoid circular dependencies
|
|
3
|
-
* with React integration.
|
|
4
|
-
*
|
|
5
|
-
* @module local-llm/core
|
|
6
|
-
*/
|
|
7
|
-
export type { Backend, Device, Quantization, LLMConfig, MessageRole, ChatMessage, StreamCallback, LoadProgress, LoadProgressCallback, GenerateOptions, LLMProvider as LLMProviderInterface, AttachOptions, BrowserCapabilities, SupportedModel, } from './types';
|
|
8
|
-
export { checkWebGPU, checkWasm, detectCapabilities, logCapabilities } from './detect';
|
|
9
|
-
export { WebLLMProvider, createWebLLMProvider, DEFAULT_WEBLLM_MODEL, WEBLLM_MODELS, } from './backends/webllm';
|
|
10
|
-
export { TransformersProvider, createTransformersProvider, DEFAULT_TRANSFORMERS_MODEL, TRANSFORMERS_MODELS, } from './backends/transformers';
|
|
11
|
-
export { createOutputStreamer, attachToElements, createChatUI, createLoadingIndicator, } from './helpers';
|
|
12
|
-
import type { LLMConfig, ChatMessage, GenerateOptions, StreamCallback, AttachOptions } from './types';
|
|
13
|
-
/**
|
|
14
|
-
* Main LLM interface with simplified API
|
|
15
|
-
*/
|
|
16
|
-
export interface LocalLLM {
|
|
17
|
-
/**
|
|
18
|
-
* Whether the model is loaded and ready
|
|
19
|
-
*/
|
|
20
|
-
readonly isReady: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* The current model ID
|
|
23
|
-
*/
|
|
24
|
-
readonly modelId: string | null;
|
|
25
|
-
/**
|
|
26
|
-
* The backend being used
|
|
27
|
-
*/
|
|
28
|
-
readonly backend: 'webllm' | 'transformers';
|
|
29
|
-
/**
|
|
30
|
-
* Generate a chat response
|
|
31
|
-
*/
|
|
32
|
-
chat(messages: ChatMessage[] | string, options?: GenerateOptions): Promise<string>;
|
|
33
|
-
/**
|
|
34
|
-
* Generate with streaming output
|
|
35
|
-
*/
|
|
36
|
-
stream(messages: ChatMessage[] | string, onToken: StreamCallback, options?: GenerateOptions): Promise<string>;
|
|
37
|
-
/**
|
|
38
|
-
* Attach to input/output elements for automatic generation
|
|
39
|
-
*/
|
|
40
|
-
attachToInput(inputSelector: string | HTMLInputElement | HTMLTextAreaElement, outputSelector: string | HTMLElement, options?: AttachOptions): () => void;
|
|
41
|
-
/**
|
|
42
|
-
* Unload the model and free resources
|
|
43
|
-
*/
|
|
44
|
-
unload(): Promise<void>;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Create a LocalLLM instance
|
|
48
|
-
*
|
|
49
|
-
* @param config - Configuration options
|
|
50
|
-
* @returns Promise that resolves to a LocalLLM instance once the model is loaded
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
* // Simple usage with defaults
|
|
55
|
-
* const llm = await createLLM();
|
|
56
|
-
*
|
|
57
|
-
* // With configuration
|
|
58
|
-
* const llm = await createLLM({
|
|
59
|
-
* model: 'phi-3-mini',
|
|
60
|
-
* backend: 'webllm',
|
|
61
|
-
* systemPrompt: 'You are a helpful assistant.',
|
|
62
|
-
* onLoadProgress: (p) => console.log(p.progress)
|
|
63
|
-
* });
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
export declare function createLLM(config?: LLMConfig): Promise<LocalLLM>;
|
|
67
|
-
/**
|
|
68
|
-
* Quick helper to test if the current browser supports WebGPU
|
|
69
|
-
*/
|
|
70
|
-
export declare function isWebGPUSupported(): Promise<boolean>;
|
|
71
|
-
//# sourceMappingURL=core.d.ts.map
|
package/dist/core.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,OAAO,EACP,MAAM,EACN,YAAY,EACZ,SAAS,EACT,WAAW,EACX,WAAW,EACX,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,WAAW,IAAI,oBAAoB,EACnC,aAAa,EACb,mBAAmB,EACnB,cAAc,GACf,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGvF,OAAO,EAC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yFzE;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAG1D"}
|
package/dist/detect.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser capability detection utilities
|
|
3
|
-
*/
|
|
4
|
-
import type { BrowserCapabilities } from './types';
|
|
5
|
-
/**
|
|
6
|
-
* Check if WebGPU is available in the current browser
|
|
7
|
-
*/
|
|
8
|
-
export declare function checkWebGPU(): Promise<boolean>;
|
|
9
|
-
/**
|
|
10
|
-
* Check if WebAssembly is available
|
|
11
|
-
*/
|
|
12
|
-
export declare function checkWasm(): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Detect browser capabilities and recommend backend/device
|
|
15
|
-
*/
|
|
16
|
-
export declare function detectCapabilities(): Promise<BrowserCapabilities>;
|
|
17
|
-
/**
|
|
18
|
-
* Log capability detection results to console
|
|
19
|
-
*/
|
|
20
|
-
export declare function logCapabilities(): Promise<BrowserCapabilities>;
|
|
21
|
-
//# sourceMappingURL=detect.d.ts.map
|
package/dist/detect.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAmB,MAAM,SAAS,CAAC;AAEpE;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAapD;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAYnC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAuBvE;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAUpE"}
|
package/dist/helpers.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DOM Helper Utilities
|
|
3
|
-
* Easy integration with HTML input/output elements
|
|
4
|
-
*/
|
|
5
|
-
import type { StreamCallback, AttachOptions } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Creates a streaming callback that updates an output element
|
|
8
|
-
*/
|
|
9
|
-
export declare function createOutputStreamer(outputSelector: string | HTMLElement, options?: {
|
|
10
|
-
append?: boolean;
|
|
11
|
-
scrollToBottom?: boolean;
|
|
12
|
-
}): StreamCallback;
|
|
13
|
-
/**
|
|
14
|
-
* Attach LLM to input/output elements with automatic handling
|
|
15
|
-
*/
|
|
16
|
-
export declare function attachToElements(inputSelector: string | HTMLInputElement | HTMLTextAreaElement, outputSelector: string | HTMLElement, generateFn: (input: string, onToken: StreamCallback) => Promise<string>, options?: AttachOptions): () => void;
|
|
17
|
-
/**
|
|
18
|
-
* Create a simple chat UI in a container
|
|
19
|
-
*/
|
|
20
|
-
export declare function createChatUI(containerSelector: string | HTMLElement): {
|
|
21
|
-
input: HTMLTextAreaElement;
|
|
22
|
-
output: HTMLDivElement;
|
|
23
|
-
sendButton: HTMLButtonElement;
|
|
24
|
-
cleanup: () => void;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Create a loading indicator
|
|
28
|
-
*/
|
|
29
|
-
export declare function createLoadingIndicator(containerSelector: string | HTMLElement): {
|
|
30
|
-
show: () => void;
|
|
31
|
-
hide: () => void;
|
|
32
|
-
setProgress: (percent: number, status?: string) => void;
|
|
33
|
-
element: HTMLDivElement;
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=helpers.d.ts.map
|
package/dist/helpers.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgB7D;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,MAAM,GAAG,WAAW,EACpC,OAAO,CAAC,EAAE;IACR,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GACA,cAAc,CAoBhB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,MAAM,GAAG,gBAAgB,GAAG,mBAAmB,EAC9D,cAAc,EAAE,MAAM,GAAG,WAAW,EACpC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,MAAM,CAAC,EACvE,OAAO,CAAC,EAAE,aAAa,GACtB,MAAM,IAAI,CA8DZ;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,iBAAiB,EAAE,MAAM,GAAG,WAAW,GAAG;IACrE,KAAK,EAAE,mBAAmB,CAAC;IAC3B,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAyBA;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,iBAAiB,EAAE,MAAM,GAAG,WAAW,GAAG;IAC/E,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,OAAO,EAAE,cAAc,CAAC;CACzB,CAwCA"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Local LLM - Browser-based LLM inference library
|
|
3
|
-
*
|
|
4
|
-
* A simple, generalized library for interacting with LLMs directly in the browser.
|
|
5
|
-
* Works in any codebase with WebGPU or WASM support.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { createLLM } from '@blank-utils/llm';
|
|
10
|
-
*
|
|
11
|
-
* const llm = await createLLM({
|
|
12
|
-
* onLoadProgress: (p) => console.log(`Loading: ${p.progress}%`)
|
|
13
|
-
* });
|
|
14
|
-
*
|
|
15
|
-
* // Streaming generation
|
|
16
|
-
* await llm.stream('Tell me a joke', (token) => console.log(token));
|
|
17
|
-
*
|
|
18
|
-
* // Attach to DOM elements
|
|
19
|
-
* llm.attachToInput('#input', '#output');
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @module @blank-utils/llm
|
|
23
|
-
*/
|
|
24
|
-
export { type Backend, type Device, type Quantization, type LLMConfig, type MessageRole, type ChatMessage, type StreamCallback, type LoadProgress, type LoadProgressCallback, type GenerateOptions, type LLMProviderInterface, type AttachOptions, type BrowserCapabilities, checkWebGPU, checkWasm, detectCapabilities, logCapabilities, WebLLMProvider, createWebLLMProvider, DEFAULT_WEBLLM_MODEL, WEBLLM_MODELS, TransformersProvider, createTransformersProvider, DEFAULT_TRANSFORMERS_MODEL, TRANSFORMERS_MODELS, createOutputStreamer, attachToElements, createChatUI, createLoadingIndicator, type LocalLLM, createLLM, isWebGPUSupported, } from './core';
|
|
25
|
-
export { createLLM as default } from './core';
|
|
26
|
-
export { LLMProvider, useLLM, useChat, useStream, useCompletion, LLMLoading, LLMReady, Chat, ChatInput, type LLMContextValue, type LLMProviderProps, type UseChatOptions, type UseChatReturn, type UseStreamOptions, type UseStreamReturn, type UseCompletionOptions, type UseCompletionReturn, type LLMLoadingProps, type LLMReadyProps, type ChatProps, type ChatInputProps, } from './react';
|
|
27
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EAGxB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,eAAe,EAGf,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,mBAAmB,EAGnB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EAGtB,KAAK,QAAQ,EACb,SAAS,EACT,iBAAiB,GAClB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,QAAQ,CAAC;AAQ9C,OAAO,EAEL,WAAW,EACX,MAAM,EAGN,OAAO,EACP,SAAS,EACT,aAAa,EAGb,UAAU,EACV,QAAQ,EAGR,IAAI,EACJ,SAAS,EAGT,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC"}
|
package/dist/models.d.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supported Models Configuration
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Default model for WebLLM backend
|
|
6
|
-
* Using Phi 3.5 Mini as it's well-tested and reasonably sized
|
|
7
|
-
*/
|
|
8
|
-
export declare const DEFAULT_WEBLLM_MODEL = "Phi-3.5-mini-instruct-q4f16_1-MLC";
|
|
9
|
-
/**
|
|
10
|
-
* Popular WebLLM model options with correct MLC model IDs
|
|
11
|
-
* These IDs must match exactly what's in web-llm's prebuiltAppConfig
|
|
12
|
-
*
|
|
13
|
-
* @see https://github.com/mlc-ai/web-llm/blob/main/src/config.ts
|
|
14
|
-
*/
|
|
15
|
-
export declare const WEBLLM_MODELS: {
|
|
16
|
-
readonly 'llama-3.2-1b': "Llama-3.2-1B-Instruct-q4f16_1-MLC";
|
|
17
|
-
readonly 'llama-3.2-3b': "Llama-3.2-3B-Instruct-q4f16_1-MLC";
|
|
18
|
-
readonly 'llama-3.1-8b': "Llama-3.1-8B-Instruct-q4f16_1-MLC";
|
|
19
|
-
readonly 'llama-3.1-8b-1k': "Llama-3.1-8B-Instruct-q4f16_1-MLC-1k";
|
|
20
|
-
readonly 'phi-3.5-mini': "Phi-3.5-mini-instruct-q4f16_1-MLC";
|
|
21
|
-
readonly 'phi-3.5-mini-1k': "Phi-3.5-mini-instruct-q4f16_1-MLC-1k";
|
|
22
|
-
readonly 'phi-3.5-vision': "Phi-3.5-vision-instruct-q4f16_1-MLC";
|
|
23
|
-
readonly 'qwen-2.5-0.5b': "Qwen2.5-0.5B-Instruct-q4f16_1-MLC";
|
|
24
|
-
readonly 'qwen-2.5-1.5b': "Qwen2.5-1.5B-Instruct-q4f16_1-MLC";
|
|
25
|
-
readonly 'qwen-2.5-3b': "Qwen2.5-3B-Instruct-q4f16_1-MLC";
|
|
26
|
-
readonly 'qwen-2.5-7b': "Qwen2.5-7B-Instruct-q4f16_1-MLC";
|
|
27
|
-
readonly 'qwen-2.5-coder-0.5b': "Qwen2.5-Coder-0.5B-Instruct-q4f16_1-MLC";
|
|
28
|
-
readonly 'qwen-2.5-coder-1.5b': "Qwen2.5-Coder-1.5B-Instruct-q4f16_1-MLC";
|
|
29
|
-
readonly 'qwen-3-0.6b': "Qwen3-0.6B-q4f16_1-MLC";
|
|
30
|
-
readonly 'qwen-3-1.7b': "Qwen3-1.7B-q4f16_1-MLC";
|
|
31
|
-
readonly 'qwen-3-4b': "Qwen3-4B-q4f16_1-MLC";
|
|
32
|
-
readonly 'qwen-3-8b': "Qwen3-8B-q4f16_1-MLC";
|
|
33
|
-
readonly 'gemma-2-2b': "gemma-2-2b-it-q4f16_1-MLC";
|
|
34
|
-
readonly 'gemma-2-2b-1k': "gemma-2-2b-it-q4f16_1-MLC-1k";
|
|
35
|
-
readonly 'gemma-2-9b': "gemma-2-9b-it-q4f16_1-MLC";
|
|
36
|
-
readonly 'smollm2-135m': "SmolLM2-135M-Instruct-q0f16-MLC";
|
|
37
|
-
readonly 'smollm2-360m': "SmolLM2-360M-Instruct-q4f16_1-MLC";
|
|
38
|
-
readonly 'smollm2-1.7b': "SmolLM2-1.7B-Instruct-q4f16_1-MLC";
|
|
39
|
-
readonly 'mistral-7b': "Mistral-7B-Instruct-v0.3-q4f16_1-MLC";
|
|
40
|
-
readonly 'deepseek-r1-qwen-7b': "DeepSeek-R1-Distill-Qwen-7B-q4f16_1-MLC";
|
|
41
|
-
readonly 'deepseek-r1-llama-8b': "DeepSeek-R1-Distill-Llama-8B-q4f16_1-MLC";
|
|
42
|
-
readonly 'hermes-3-llama-3.2-3b': "Hermes-3-Llama-3.2-3B-q4f16_1-MLC";
|
|
43
|
-
readonly 'hermes-3-llama-3.1-8b': "Hermes-3-Llama-3.1-8B-q4f16_1-MLC";
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Default model for Transformers.js backend
|
|
47
|
-
* Using Qwen2.5 0.5B as it's well-tested with ONNX
|
|
48
|
-
*/
|
|
49
|
-
export declare const DEFAULT_TRANSFORMERS_MODEL = "onnx-community/Qwen2.5-0.5B-Instruct";
|
|
50
|
-
/**
|
|
51
|
-
* Transformers.js compatible models (must have ONNX weights)
|
|
52
|
-
* These are specifically converted for browser use via transformers.js
|
|
53
|
-
*
|
|
54
|
-
* @see https://huggingface.co/onnx-community for more models
|
|
55
|
-
*/
|
|
56
|
-
export declare const TRANSFORMERS_MODELS: {
|
|
57
|
-
readonly 'qwen-2.5-0.5b': "onnx-community/Qwen2.5-0.5B-Instruct";
|
|
58
|
-
readonly 'qwen-2.5-1.5b': "onnx-community/Qwen2.5-1.5B-Instruct";
|
|
59
|
-
readonly 'qwen-2.5-coder-0.5b': "onnx-community/Qwen2.5-Coder-0.5B-Instruct";
|
|
60
|
-
readonly 'qwen-2.5-coder-1.5b': "onnx-community/Qwen2.5-Coder-1.5B-Instruct";
|
|
61
|
-
readonly 'qwen-3-0.6b': "onnx-community/Qwen3-0.6B-ONNX";
|
|
62
|
-
readonly 'smollm2-135m': "HuggingFaceTB/SmolLM2-135M-Instruct";
|
|
63
|
-
readonly 'smollm2-360m': "HuggingFaceTB/SmolLM2-360M-Instruct";
|
|
64
|
-
readonly 'smollm2-1.7b': "HuggingFaceTB/SmolLM2-1.7B-Instruct";
|
|
65
|
-
readonly 'phi-3-mini': "Xenova/Phi-3-mini-4k-instruct";
|
|
66
|
-
readonly tinyllama: "Xenova/TinyLlama-1.1B-Chat-v1.0";
|
|
67
|
-
};
|
|
68
|
-
export type WebLLMModelID = keyof typeof WEBLLM_MODELS;
|
|
69
|
-
export type TransformersModelID = keyof typeof TRANSFORMERS_MODELS;
|
|
70
|
-
/**
|
|
71
|
-
* Union of all supported model IDs for type safety
|
|
72
|
-
*/
|
|
73
|
-
export type SupportedModel = WebLLMModelID | TransformersModelID | (string & {});
|
|
74
|
-
//# sourceMappingURL=models.d.ts.map
|
package/dist/models.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,sCAAsC,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDhB,CAAC;AAGX;;;GAGG;AACH,eAAO,MAAM,0BAA0B,yCAAyC,CAAC;AAEjF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;CAoBtB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,aAAa,CAAC;AACvD,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,mBAAmB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ChatInput — Self-contained auto-resizing textarea with send button.
|
|
3
|
-
* Zero external dependencies. All styles embedded via CSS-in-JS.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```tsx
|
|
7
|
-
* <ChatInput
|
|
8
|
-
* value={input}
|
|
9
|
-
* onChange={setInput}
|
|
10
|
-
* onSend={handleSend}
|
|
11
|
-
* disabled={isGenerating}
|
|
12
|
-
* placeholder="Type a message..."
|
|
13
|
-
* />
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
import * as React from 'react';
|
|
17
|
-
export interface ChatInputProps {
|
|
18
|
-
/** Current value of the input */
|
|
19
|
-
value: string;
|
|
20
|
-
/** Called when value changes */
|
|
21
|
-
onChange: (value: string) => void;
|
|
22
|
-
/** Called when user submits (Enter or send button) */
|
|
23
|
-
onSend: () => void;
|
|
24
|
-
/** Called when user clicks stop */
|
|
25
|
-
onStop?: () => void;
|
|
26
|
-
/** Whether the input is disabled (e.g. during generation) */
|
|
27
|
-
disabled?: boolean;
|
|
28
|
-
/** Whether currently generating (shows stop button instead of send) */
|
|
29
|
-
isGenerating?: boolean;
|
|
30
|
-
/** Placeholder text */
|
|
31
|
-
placeholder?: string;
|
|
32
|
-
/** Maximum rows before scrolling */
|
|
33
|
-
maxRows?: number;
|
|
34
|
-
/** Optional action elements to render in the toolbar */
|
|
35
|
-
actions?: React.ReactNode;
|
|
36
|
-
/** Theme */
|
|
37
|
-
theme?: 'dark' | 'light';
|
|
38
|
-
/** Additional className for the container */
|
|
39
|
-
className?: string;
|
|
40
|
-
}
|
|
41
|
-
declare function ChatInput({ value, onChange, onSend, onStop, disabled, isGenerating, placeholder, maxRows, actions, theme, className, }: ChatInputProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
-
export { ChatInput };
|
|
43
|
-
//# sourceMappingURL=chat-input.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat-input.d.ts","sourceRoot":"","sources":["../../src/react/chat-input.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IAEd,gCAAgC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC,sDAAsD;IACtD,MAAM,EAAE,MAAM,IAAI,CAAC;IAEnB,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,uEAAuE;IACvE,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,wDAAwD;IACxD,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEzB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA4HD,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,MAAM,EACN,QAAgB,EAChB,YAAoB,EACpB,WAAiC,EACjC,OAAW,EACX,OAAO,EACP,KAAc,EACd,SAAS,GACV,EAAE,cAAc,2CAuEhB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Chat — A complete, self-contained chat interface for @blank-utils/llm.
|
|
3
|
-
* Drop inside <LLMProvider> and get a working chat UI in one line.
|
|
4
|
-
*
|
|
5
|
-
* Zero external dependencies. All styles embedded.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* import { LLMProvider, Chat } from "@blank-utils/llm/react";
|
|
10
|
-
*
|
|
11
|
-
* function App() {
|
|
12
|
-
* return (
|
|
13
|
-
* <LLMProvider model="qwen-2.5-0.5b">
|
|
14
|
-
* <Chat />
|
|
15
|
-
* </LLMProvider>
|
|
16
|
-
* );
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
import * as React from 'react';
|
|
21
|
-
import type { UseChatOptions } from './index';
|
|
22
|
-
export interface ChatProps {
|
|
23
|
-
/** System prompt for the conversation */
|
|
24
|
-
systemPrompt?: string;
|
|
25
|
-
/** Placeholder text for the input */
|
|
26
|
-
placeholder?: string;
|
|
27
|
-
/** Theme */
|
|
28
|
-
theme?: 'dark' | 'light';
|
|
29
|
-
/** Additional className for the outermost container */
|
|
30
|
-
className?: string;
|
|
31
|
-
/** Maximum height of the chat container. Default: '600px' */
|
|
32
|
-
maxHeight?: string;
|
|
33
|
-
/** Options passed to useChat internally */
|
|
34
|
-
chatOptions?: Omit<UseChatOptions, 'systemPrompt'>;
|
|
35
|
-
/** Custom actions rendered in the input toolbar */
|
|
36
|
-
inputActions?: React.ReactNode;
|
|
37
|
-
/** Called when a message is sent */
|
|
38
|
-
onSend?: (message: string) => void;
|
|
39
|
-
/** Called when a response is received */
|
|
40
|
-
onResponse?: (response: string) => void;
|
|
41
|
-
/** Called on error */
|
|
42
|
-
onError?: (error: Error) => void;
|
|
43
|
-
/** Whether to show the model info header. Default: true */
|
|
44
|
-
showHeader?: boolean;
|
|
45
|
-
/** Whether to show loading progress. Default: true */
|
|
46
|
-
showProgress?: boolean;
|
|
47
|
-
/** Custom welcome message when chat is empty */
|
|
48
|
-
welcomeMessage?: string;
|
|
49
|
-
}
|
|
50
|
-
declare function Chat({ systemPrompt, placeholder, theme, className, maxHeight, inputActions, onSend: onSendProp, onResponse, onError: onErrorProp, showHeader, showProgress, welcomeMessage, }: ChatProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
-
export { Chat };
|
|
52
|
-
//# sourceMappingURL=components.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/react/components.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAa9C,MAAM,WAAW,SAAS;IACxB,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEzB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IAEnD,mDAAmD;IACnD,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE/B,oCAAoC;IACpC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC,yCAAyC;IACzC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAExC,sBAAsB;IACtB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,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