llm-checker 3.2.1 → 3.2.2
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 +92 -7
- package/bin/enhanced_cli.js +447 -0
- package/package.json +7 -1
- package/src/index.js +84 -20
- package/src/models/deterministic-selector.js +406 -22
- package/src/models/intelligent-selector.js +89 -4
- package/src/policy/audit-reporter.js +420 -0
- package/src/policy/cli-policy.js +403 -0
- package/src/policy/policy-engine.js +497 -0
- package/src/policy/policy-manager.js +324 -0
- package/src/provenance/model-provenance.js +176 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "llm-checker",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Intelligent CLI tool with AI-powered model selection that analyzes your hardware and recommends optimal LLM models for your system",
|
|
5
5
|
"bin": {
|
|
6
6
|
"llm-checker": "bin/cli.js",
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
"test:platform": "node tests/platform-tests/cross-platform.test.js",
|
|
15
15
|
"test:ui": "node tests/ui-tests/interface.test.js",
|
|
16
16
|
"test:runtime": "node tests/runtime-specdec-tests.js",
|
|
17
|
+
"test:deterministic-pool": "node tests/deterministic-model-pool-check.js",
|
|
18
|
+
"test:policy": "node tests/policy-commands.test.js",
|
|
19
|
+
"test:policy-cli": "node tests/policy-cli-enforcement.js",
|
|
20
|
+
"test:policy-engine": "node tests/policy-engine.test.js",
|
|
21
|
+
"test:policy-e2e": "node tests/policy-e2e-integration.test.js",
|
|
17
22
|
"test:hardware-detector": "node tests/hardware-detector-regression.js",
|
|
18
23
|
"test:all": "node tests/run-all-tests.js",
|
|
19
24
|
"build": "echo 'No build needed'",
|
|
@@ -38,6 +43,7 @@
|
|
|
38
43
|
"ora": "^5.4.1",
|
|
39
44
|
"systeminformation": "^5.21.0",
|
|
40
45
|
"table": "^6.8.1",
|
|
46
|
+
"yaml": "^2.8.1",
|
|
41
47
|
"zod": "^3.23.0"
|
|
42
48
|
},
|
|
43
49
|
"optionalDependencies": {
|
package/src/index.js
CHANGED
|
@@ -14,6 +14,10 @@ const {
|
|
|
14
14
|
getRuntimePullCommand,
|
|
15
15
|
getRuntimeRunCommand
|
|
16
16
|
} = require('./runtime/runtime-support');
|
|
17
|
+
const {
|
|
18
|
+
attachModelProvenance,
|
|
19
|
+
attachProvenanceToCollection
|
|
20
|
+
} = require('./provenance/model-provenance');
|
|
17
21
|
|
|
18
22
|
class LLMChecker {
|
|
19
23
|
constructor(options = {}) {
|
|
@@ -275,9 +279,9 @@ class LLMChecker {
|
|
|
275
279
|
|
|
276
280
|
return {
|
|
277
281
|
hardware,
|
|
278
|
-
compatible: enrichedResults.compatible,
|
|
279
|
-
marginal: enrichedResults.marginal,
|
|
280
|
-
incompatible: enrichedResults.incompatible,
|
|
282
|
+
compatible: attachProvenanceToCollection(enrichedResults.compatible),
|
|
283
|
+
marginal: attachProvenanceToCollection(enrichedResults.marginal),
|
|
284
|
+
incompatible: attachProvenanceToCollection(enrichedResults.incompatible),
|
|
281
285
|
recommendations,
|
|
282
286
|
intelligentRecommendations,
|
|
283
287
|
ollamaInfo: ollamaIntegration.ollamaInfo,
|
|
@@ -499,11 +503,17 @@ class LLMChecker {
|
|
|
499
503
|
|
|
500
504
|
// Agregar modelos estáticos
|
|
501
505
|
staticModels.forEach(model => {
|
|
502
|
-
allModelsMap.set(
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
506
|
+
allModelsMap.set(
|
|
507
|
+
model.name,
|
|
508
|
+
attachModelProvenance(
|
|
509
|
+
{
|
|
510
|
+
...model,
|
|
511
|
+
source: 'static_database',
|
|
512
|
+
isOllamaInstalled: false
|
|
513
|
+
},
|
|
514
|
+
{ source: 'static_database' }
|
|
515
|
+
)
|
|
516
|
+
);
|
|
507
517
|
});
|
|
508
518
|
|
|
509
519
|
// Agregar modelos de Ollama (con prioridad si ya existen)
|
|
@@ -513,14 +523,26 @@ class LLMChecker {
|
|
|
513
523
|
if (modelKey) {
|
|
514
524
|
// Mejorar modelo existente con datos de Ollama
|
|
515
525
|
const existing = allModelsMap.get(modelKey);
|
|
516
|
-
allModelsMap.set(
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
526
|
+
allModelsMap.set(
|
|
527
|
+
modelKey,
|
|
528
|
+
attachModelProvenance(
|
|
529
|
+
{
|
|
530
|
+
...existing,
|
|
531
|
+
...this.createEnhancedModelFromOllama(ollamaModel, existing),
|
|
532
|
+
source: 'enhanced_with_ollama'
|
|
533
|
+
},
|
|
534
|
+
{ source: 'enhanced_with_ollama' }
|
|
535
|
+
)
|
|
536
|
+
);
|
|
521
537
|
} else {
|
|
522
538
|
// Crear nuevo modelo desde datos de Ollama
|
|
523
|
-
const newModel =
|
|
539
|
+
const newModel = attachModelProvenance(
|
|
540
|
+
{
|
|
541
|
+
...this.createModelFromOllamaData(ollamaModel),
|
|
542
|
+
source: 'ollama_database'
|
|
543
|
+
},
|
|
544
|
+
{ source: 'ollama_database' }
|
|
545
|
+
);
|
|
524
546
|
allModelsMap.set(newModel.name, {
|
|
525
547
|
...newModel,
|
|
526
548
|
source: 'ollama_database'
|
|
@@ -703,6 +725,8 @@ class LLMChecker {
|
|
|
703
725
|
createEnhancedModelFromOllama(ollamaModel, existingModel) {
|
|
704
726
|
// Extract real file size from variants if available
|
|
705
727
|
let realStorageSize = null;
|
|
728
|
+
let selectedTag = ollamaModel.model_identifier;
|
|
729
|
+
let selectedDigest = null;
|
|
706
730
|
if (ollamaModel.variants && ollamaModel.variants.length > 0) {
|
|
707
731
|
// Try to match based on the existing model size
|
|
708
732
|
let mainVariant = null;
|
|
@@ -727,9 +751,13 @@ class LLMChecker {
|
|
|
727
751
|
if (mainVariant && mainVariant.real_size_gb) {
|
|
728
752
|
realStorageSize = mainVariant.real_size_gb;
|
|
729
753
|
}
|
|
754
|
+
if (mainVariant && mainVariant.tag) {
|
|
755
|
+
selectedTag = mainVariant.tag;
|
|
756
|
+
}
|
|
757
|
+
selectedDigest = mainVariant?.digest || mainVariant?.sha256 || null;
|
|
730
758
|
}
|
|
731
759
|
|
|
732
|
-
|
|
760
|
+
const model = {
|
|
733
761
|
...existingModel,
|
|
734
762
|
ollamaId: ollamaModel.model_identifier,
|
|
735
763
|
frameworks: Array.from(new Set([...(existingModel.frameworks || []), 'ollama', 'vllm', 'mlx'])),
|
|
@@ -745,8 +773,18 @@ class LLMChecker {
|
|
|
745
773
|
installation: {
|
|
746
774
|
...existingModel.installation,
|
|
747
775
|
...this.createRuntimeInstallationCommands(ollamaModel.model_identifier, ollamaModel.model_name || existingModel.name)
|
|
748
|
-
}
|
|
776
|
+
},
|
|
777
|
+
source: 'enhanced_with_ollama',
|
|
778
|
+
registry: 'ollama.com',
|
|
779
|
+
version: selectedTag,
|
|
780
|
+
license: ollamaModel.license || existingModel.license,
|
|
781
|
+
digest: selectedDigest || existingModel.digest
|
|
749
782
|
};
|
|
783
|
+
|
|
784
|
+
return attachModelProvenance(model, {
|
|
785
|
+
source: 'enhanced_with_ollama',
|
|
786
|
+
registry: 'ollama.com'
|
|
787
|
+
});
|
|
750
788
|
}
|
|
751
789
|
|
|
752
790
|
createModelFromOllamaData(ollamaModel) {
|
|
@@ -774,6 +812,8 @@ class LLMChecker {
|
|
|
774
812
|
|
|
775
813
|
// Extract real file size from variants if available
|
|
776
814
|
let realStorageSize = null;
|
|
815
|
+
let selectedTag = ollamaModel.model_identifier;
|
|
816
|
+
let selectedDigest = null;
|
|
777
817
|
if (ollamaModel.variants && ollamaModel.variants.length > 0) {
|
|
778
818
|
// Find the main variant (usually the first one or one matching the base model name)
|
|
779
819
|
const mainVariant = ollamaModel.variants.find(v =>
|
|
@@ -784,6 +824,10 @@ class LLMChecker {
|
|
|
784
824
|
if (mainVariant && mainVariant.real_size_gb) {
|
|
785
825
|
realStorageSize = mainVariant.real_size_gb;
|
|
786
826
|
}
|
|
827
|
+
if (mainVariant && mainVariant.tag) {
|
|
828
|
+
selectedTag = mainVariant.tag;
|
|
829
|
+
}
|
|
830
|
+
selectedDigest = mainVariant?.digest || mainVariant?.sha256 || null;
|
|
787
831
|
}
|
|
788
832
|
|
|
789
833
|
let category = 'medium';
|
|
@@ -797,7 +841,7 @@ class LLMChecker {
|
|
|
797
841
|
if (id.includes('code')) specialization = 'code';
|
|
798
842
|
else if (id.includes('embed')) specialization = 'embeddings';
|
|
799
843
|
|
|
800
|
-
|
|
844
|
+
const model = {
|
|
801
845
|
name: ollamaModel.model_name,
|
|
802
846
|
ollamaId: ollamaModel.model_identifier,
|
|
803
847
|
size: size,
|
|
@@ -819,8 +863,18 @@ class LLMChecker {
|
|
|
819
863
|
pulls: ollamaModel.pulls,
|
|
820
864
|
lastUpdated: ollamaModel.last_updated,
|
|
821
865
|
year: 2024,
|
|
822
|
-
ollamaAvailable: true
|
|
866
|
+
ollamaAvailable: true,
|
|
867
|
+
source: 'ollama_database',
|
|
868
|
+
registry: 'ollama.com',
|
|
869
|
+
version: selectedTag,
|
|
870
|
+
license: ollamaModel.license,
|
|
871
|
+
digest: selectedDigest
|
|
823
872
|
};
|
|
873
|
+
|
|
874
|
+
return attachModelProvenance(model, {
|
|
875
|
+
source: 'ollama_database',
|
|
876
|
+
registry: 'ollama.com'
|
|
877
|
+
});
|
|
824
878
|
}
|
|
825
879
|
|
|
826
880
|
checkIfModelInstalled(model, ollamaIntegration) {
|
|
@@ -931,7 +985,7 @@ class LLMChecker {
|
|
|
931
985
|
else if (id.includes('chat')) specialization = 'chat';
|
|
932
986
|
else if (id.includes('embed')) specialization = 'embeddings';
|
|
933
987
|
|
|
934
|
-
|
|
988
|
+
const model = {
|
|
935
989
|
name: cloudModel.model_name,
|
|
936
990
|
size: size,
|
|
937
991
|
type: 'local',
|
|
@@ -955,8 +1009,18 @@ class LLMChecker {
|
|
|
955
1009
|
url: cloudModel.url,
|
|
956
1010
|
model_type: cloudModel.model_type,
|
|
957
1011
|
identifier: cloudModel.model_identifier
|
|
958
|
-
}
|
|
1012
|
+
},
|
|
1013
|
+
source: 'ollama_registry',
|
|
1014
|
+
registry: 'ollama.com',
|
|
1015
|
+
version: cloudModel.model_identifier,
|
|
1016
|
+
license: cloudModel.license,
|
|
1017
|
+
digest: cloudModel.digest || cloudModel.sha256
|
|
959
1018
|
};
|
|
1019
|
+
|
|
1020
|
+
return attachModelProvenance(model, {
|
|
1021
|
+
source: 'ollama_registry',
|
|
1022
|
+
registry: 'ollama.com'
|
|
1023
|
+
});
|
|
960
1024
|
}
|
|
961
1025
|
|
|
962
1026
|
findMatchingModel(ollamaModel, availableModels) {
|