@beltoinc/slyos-sdk 1.5.4 → 1.5.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/dist/index.js CHANGED
@@ -8,28 +8,28 @@ if (env.backends?.onnx?.wasm) {
8
8
  const modelMap = {
9
9
  // LLM models (1B+)
10
10
  'quantum-1.7b': {
11
- hfModel: 'HuggingFaceTB/SmolLM2-1.7B-Instruct',
11
+ hfModel: 'onnx-community/SmolLM2-1.7B-Instruct',
12
12
  task: 'text-generation',
13
13
  category: 'llm',
14
14
  sizesMB: { q4: 900, q8: 1700, fp16: 3400, fp32: 6800 },
15
15
  minRAM_MB: { q4: 2048, q8: 3072, fp16: 5120, fp32: 8192 },
16
16
  },
17
17
  'quantum-3b': {
18
- hfModel: 'Qwen/Qwen2.5-3B-Instruct',
18
+ hfModel: 'onnx-community/Qwen2.5-3B-Instruct',
19
19
  task: 'text-generation',
20
20
  category: 'llm',
21
21
  sizesMB: { q4: 1600, q8: 3200, fp16: 6400, fp32: 12800 },
22
22
  minRAM_MB: { q4: 3072, q8: 5120, fp16: 8192, fp32: 16384 },
23
23
  },
24
24
  'quantum-code-3b': {
25
- hfModel: 'Qwen/Qwen2.5-Coder-3B-Instruct',
25
+ hfModel: 'onnx-community/Qwen2.5-Coder-3B-Instruct',
26
26
  task: 'text-generation',
27
27
  category: 'llm',
28
28
  sizesMB: { q4: 1600, q8: 3200, fp16: 6400, fp32: 12800 },
29
29
  minRAM_MB: { q4: 3072, q8: 5120, fp16: 8192, fp32: 16384 },
30
30
  },
31
31
  'quantum-8b': {
32
- hfModel: 'Qwen/Qwen2.5-7B-Instruct',
32
+ hfModel: 'onnx-community/Qwen2.5-7B-Instruct',
33
33
  task: 'text-generation',
34
34
  category: 'llm',
35
35
  sizesMB: { q4: 4200, q8: 8400, fp16: 16800, fp32: 33600 },
@@ -968,6 +968,28 @@ class SlyOS {
968
968
  const totalMs = Date.now() - startTime;
969
969
  const tokensGenerated = response.split(/\s+/).filter(Boolean).length;
970
970
  this.emitProgress('ready', 100, `Streamed ${tokensGenerated} tokens in ${(totalMs / 1000).toFixed(1)}s`);
971
+ this.emitEvent('inference_complete', { modelId, latencyMs: totalMs, tokensGenerated });
972
+ // Batch telemetry (device intelligence)
973
+ this.recordTelemetry({
974
+ latency_ms: totalMs,
975
+ tokens_generated: tokensGenerated,
976
+ success: true,
977
+ model_id: modelId,
978
+ timestamp: Date.now(),
979
+ });
980
+ // Legacy telemetry — updates analytics_daily for dashboard counts
981
+ if (this.token) {
982
+ await axios.post(`${this.apiUrl}/api/telemetry`, {
983
+ device_id: this.deviceId,
984
+ event_type: 'inference',
985
+ model_id: modelId,
986
+ latency_ms: totalMs,
987
+ tokens_generated: tokensGenerated,
988
+ success: true,
989
+ }, {
990
+ headers: { Authorization: `Bearer ${this.token}` },
991
+ }).catch(() => { });
992
+ }
971
993
  return { text: response, firstTokenMs: firstTokenTime, totalMs, tokensGenerated };
972
994
  }
973
995
  catch (error) {
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "@beltoinc/slyos-sdk",
3
- "version": "1.5.4",
4
- "description": "SlyOS - On-Device AI SDK for Web and Node.js",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "type": "module",
8
- "scripts": {
9
- "build": "tsc",
10
- "prepublishOnly": "npm run build"
11
- },
12
- "keywords": [
13
- "ai",
14
- "on-device",
15
- "machine-learning",
16
- "llm",
17
- "transformers",
18
- "slyos",
19
- "edge-ai",
20
- "rag"
21
- ],
22
- "author": "Belto Inc.",
23
- "license": "MIT",
24
- "repository": {
25
- "type": "git",
26
- "url": "https://github.com/BeltoAI/sly.os.git"
27
- },
28
- "dependencies": {
29
- "axios": "^1.6.5",
30
- "@huggingface/transformers": "^3.1.2"
31
- },
32
- "devDependencies": {
33
- "typescript": "^5.3.3"
34
- }
35
- }
1
+ {
2
+ "name": "@beltoinc/slyos-sdk",
3
+ "version": "1.5.6",
4
+ "description": "SlyOS - On-Device AI SDK for Web and Node.js",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "module",
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "prepublishOnly": "npm run build"
11
+ },
12
+ "keywords": [
13
+ "ai",
14
+ "on-device",
15
+ "machine-learning",
16
+ "llm",
17
+ "transformers",
18
+ "slyos",
19
+ "edge-ai",
20
+ "rag"
21
+ ],
22
+ "author": "Belto Inc.",
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/BeltoAI/sly.os.git"
27
+ },
28
+ "dependencies": {
29
+ "axios": "^1.6.5",
30
+ "@huggingface/transformers": "^3.1.2"
31
+ },
32
+ "devDependencies": {
33
+ "typescript": "^5.3.3"
34
+ }
35
+ }