@euconform/core 1.4.0 → 1.6.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.
Files changed (179) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +46 -0
  3. package/dist/datasets/crows-pairs.d.ts +18 -0
  4. package/dist/datasets/crows-pairs.d.ts.map +1 -1
  5. package/dist/datasets/crows-pairs.js +58 -0
  6. package/dist/evidence/bias-comparison-markdown.d.ts +11 -0
  7. package/dist/evidence/bias-comparison-markdown.d.ts.map +1 -0
  8. package/dist/evidence/bias-comparison-markdown.js +120 -0
  9. package/dist/evidence/bias-comparison.d.ts +133 -0
  10. package/dist/evidence/bias-comparison.d.ts.map +1 -0
  11. package/dist/evidence/bias-comparison.js +274 -0
  12. package/dist/evidence/bias-statistics.d.ts +72 -0
  13. package/dist/evidence/bias-statistics.d.ts.map +1 -0
  14. package/dist/evidence/bias-statistics.js +122 -0
  15. package/dist/evidence/bias-v2-semantics.d.ts +19 -0
  16. package/dist/evidence/bias-v2-semantics.d.ts.map +1 -0
  17. package/dist/evidence/bias-v2-semantics.js +133 -0
  18. package/dist/evidence/browser.d.ts +18 -0
  19. package/dist/evidence/browser.d.ts.map +1 -0
  20. package/dist/evidence/browser.js +14 -0
  21. package/dist/evidence/bundle.d.ts +1 -0
  22. package/dist/evidence/bundle.d.ts.map +1 -1
  23. package/dist/evidence/bundle.js +2 -0
  24. package/dist/evidence/index.d.ts +9 -2
  25. package/dist/evidence/index.d.ts.map +1 -1
  26. package/dist/evidence/index.js +5 -1
  27. package/dist/evidence/output.d.ts.map +1 -1
  28. package/dist/evidence/output.js +1 -0
  29. package/dist/evidence/types.d.ts +183 -3
  30. package/dist/evidence/types.d.ts.map +1 -1
  31. package/dist/evidence/validate-bias-v2.d.ts +31 -0
  32. package/dist/evidence/validate-bias-v2.d.ts.map +1 -0
  33. package/dist/evidence/validate-bias-v2.js +40 -0
  34. package/dist/evidence/validate.d.ts +29 -2
  35. package/dist/evidence/validate.d.ts.map +1 -1
  36. package/dist/evidence/validate.js +96 -11
  37. package/dist/fairness-metrics.d.ts +15 -11
  38. package/dist/fairness-metrics.d.ts.map +1 -1
  39. package/dist/fairness-metrics.js +59 -183
  40. package/dist/index.d.ts +2 -2
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +1 -1
  43. package/dist/inference/browser-inference.d.ts +6 -57
  44. package/dist/inference/browser-inference.d.ts.map +1 -1
  45. package/dist/inference/browser-inference.js +6 -219
  46. package/dist/inference/capability-detection.d.ts +9 -2
  47. package/dist/inference/capability-detection.d.ts.map +1 -1
  48. package/dist/inference/capability-detection.js +18 -16
  49. package/dist/inference/index.d.ts +15 -2
  50. package/dist/inference/index.d.ts.map +1 -1
  51. package/dist/inference/index.js +12 -3
  52. package/dist/inference/inference-factory.d.ts +6 -3
  53. package/dist/inference/inference-factory.d.ts.map +1 -1
  54. package/dist/inference/inference-factory.js +7 -26
  55. package/dist/inference/ollama-client.d.ts +29 -0
  56. package/dist/inference/ollama-client.d.ts.map +1 -1
  57. package/dist/inference/ollama-client.js +29 -0
  58. package/dist/inference/scored-log-prob-types.d.ts +64 -0
  59. package/dist/inference/scored-log-prob-types.d.ts.map +1 -0
  60. package/dist/inference/scored-log-prob-types.js +12 -0
  61. package/dist/inference/sequence-logprob.d.ts +34 -0
  62. package/dist/inference/sequence-logprob.d.ts.map +1 -0
  63. package/dist/inference/sequence-logprob.js +87 -0
  64. package/dist/inference/template-scoring.d.ts +124 -0
  65. package/dist/inference/template-scoring.d.ts.map +1 -0
  66. package/dist/inference/template-scoring.js +164 -0
  67. package/dist/inference/transformers-inference.d.ts +124 -0
  68. package/dist/inference/transformers-inference.d.ts.map +1 -0
  69. package/dist/inference/transformers-inference.js +392 -0
  70. package/dist/legal-checks/bias-metrics.d.ts +5 -7
  71. package/dist/legal-checks/bias-metrics.d.ts.map +1 -1
  72. package/dist/legal-checks/bias-metrics.js +8 -101
  73. package/dist/metrics/crows-pairs-bias.d.ts +17 -9
  74. package/dist/metrics/crows-pairs-bias.d.ts.map +1 -1
  75. package/dist/metrics/crows-pairs-bias.js +147 -59
  76. package/dist/metrics/stereotype-bias.d.ts +13 -5
  77. package/dist/metrics/stereotype-bias.d.ts.map +1 -1
  78. package/dist/metrics/stereotype-bias.js +16 -99
  79. package/dist/sbom/component-mapper.d.ts +26 -0
  80. package/dist/sbom/component-mapper.d.ts.map +1 -0
  81. package/dist/sbom/component-mapper.js +83 -0
  82. package/dist/sbom/cyclonedx-import.d.ts +34 -0
  83. package/dist/sbom/cyclonedx-import.d.ts.map +1 -0
  84. package/dist/sbom/cyclonedx-import.js +131 -0
  85. package/dist/sbom/index.d.ts +6 -0
  86. package/dist/sbom/index.d.ts.map +1 -0
  87. package/dist/sbom/index.js +4 -0
  88. package/dist/sbom/known-packages.d.ts +13 -0
  89. package/dist/sbom/known-packages.d.ts.map +1 -0
  90. package/dist/sbom/known-packages.js +129 -0
  91. package/dist/sbom/purl.d.ts +14 -0
  92. package/dist/sbom/purl.d.ts.map +1 -0
  93. package/dist/sbom/purl.js +56 -0
  94. package/dist/sbom/types.d.ts +39 -0
  95. package/dist/sbom/types.d.ts.map +1 -0
  96. package/dist/sbom/types.js +5 -0
  97. package/dist/scanner/detectors/ai-framework-detector.js +1 -1
  98. package/dist/scanner/detectors/local-inference-detector.d.ts.map +1 -1
  99. package/dist/scanner/detectors/local-inference-detector.js +1 -1
  100. package/dist/scanner/detectors/package-json-detector.d.ts.map +1 -1
  101. package/dist/scanner/detectors/package-json-detector.js +1 -0
  102. package/dist/types.d.ts +103 -2
  103. package/dist/types.d.ts.map +1 -1
  104. package/dist/validation/index.d.ts +2 -0
  105. package/dist/validation/index.d.ts.map +1 -0
  106. package/dist/validation/index.js +1 -0
  107. package/dist/validation/schema-validator.d.ts +18 -0
  108. package/dist/validation/schema-validator.d.ts.map +1 -0
  109. package/dist/validation/schema-validator.js +105 -0
  110. package/package.json +9 -3
  111. package/scripts/seed-logprob-fixture.mjs +179 -0
  112. package/scripts/ts-extensionless-resolve-hook.mjs +26 -0
  113. package/src/datasets/crows-pairs.ts +74 -0
  114. package/src/evidence/bias-comparison-markdown.ts +162 -0
  115. package/src/evidence/bias-comparison.ts +432 -0
  116. package/src/evidence/bias-statistics.ts +180 -0
  117. package/src/evidence/bias-v2-semantics.ts +214 -0
  118. package/src/evidence/browser.ts +35 -0
  119. package/src/evidence/bundle.ts +2 -0
  120. package/src/evidence/index.ts +31 -0
  121. package/src/evidence/output.ts +1 -0
  122. package/src/evidence/types.ts +213 -3
  123. package/src/evidence/validate-bias-v2.ts +47 -0
  124. package/src/evidence/validate.ts +151 -17
  125. package/src/fairness-metrics.ts +79 -222
  126. package/src/index.ts +7 -0
  127. package/src/inference/browser-inference.ts +14 -256
  128. package/src/inference/capability-detection.ts +32 -18
  129. package/src/inference/index.ts +33 -5
  130. package/src/inference/inference-factory.ts +9 -30
  131. package/src/inference/ollama-client.ts +29 -0
  132. package/src/inference/scored-log-prob-types.ts +66 -0
  133. package/src/inference/sequence-logprob.ts +136 -0
  134. package/src/inference/template-scoring.ts +248 -0
  135. package/src/inference/transformers-inference.ts +494 -0
  136. package/src/legal-checks/bias-metrics.ts +20 -118
  137. package/src/metrics/crows-pairs-bias.ts +180 -83
  138. package/src/metrics/stereotype-bias.ts +27 -119
  139. package/src/sbom/component-mapper.ts +107 -0
  140. package/src/sbom/cyclonedx-import.ts +198 -0
  141. package/src/sbom/index.ts +12 -0
  142. package/src/sbom/known-packages.ts +142 -0
  143. package/src/sbom/purl.ts +66 -0
  144. package/src/sbom/types.ts +34 -0
  145. package/src/scanner/detectors/ai-framework-detector.ts +1 -1
  146. package/src/scanner/detectors/local-inference-detector.ts +2 -1
  147. package/src/scanner/detectors/package-json-detector.ts +1 -0
  148. package/src/types.ts +108 -2
  149. package/src/validation/index.ts +7 -0
  150. package/src/validation/schema-validator.ts +147 -0
  151. package/tests/annex-iv-report.test.ts +1 -1
  152. package/tests/capability-detection.test.ts +57 -0
  153. package/tests/crows-pairs-bias.test.ts +286 -186
  154. package/tests/custom-dataset.test.ts +80 -0
  155. package/tests/evidence/bias-artifact-v2.test.ts +135 -0
  156. package/tests/evidence/bias-artifact.test.ts +78 -0
  157. package/tests/evidence/bias-comparison.test.ts +397 -0
  158. package/tests/evidence/bias-statistics.test.ts +191 -0
  159. package/tests/evidence/external-observation.test.ts +167 -0
  160. package/tests/evidence/spec-schemas.test.ts +35 -2
  161. package/tests/evidence/validate-bias-v2.test.ts +180 -0
  162. package/tests/fairness-metrics.test.ts +77 -1
  163. package/tests/fixtures/cyclonedx-minimal.json +13 -0
  164. package/tests/fixtures/cyclonedx-mixed.json +17 -0
  165. package/tests/fixtures/cyclonedx-ml-bom.json +25 -0
  166. package/tests/inference/browser-inference-scoring.test.ts +159 -0
  167. package/tests/inference/fixtures/logprob-golden.json +69 -0
  168. package/tests/inference/gemma-template.integration.test.ts +81 -0
  169. package/tests/inference/logprob-golden.integration.test.ts +128 -0
  170. package/tests/inference/synthetic-logits.test.ts +188 -0
  171. package/tests/inference/template-scoring.test.ts +249 -0
  172. package/tests/inference/transformers-inference-template-mode.test.ts +214 -0
  173. package/tests/integration/bias-calculation.integration.test.ts +119 -599
  174. package/tests/sbom/component-mapper.test.ts +258 -0
  175. package/tests/sbom/cyclonedx-import.test.ts +329 -0
  176. package/tests/sbom/purl.test.ts +102 -0
  177. package/tests/stilled-ollama-paths.test.ts +76 -0
  178. package/tests/validation/schema-validator.test.ts +219 -0
  179. package/src/inference/transformers.d.ts +0 -62
@@ -0,0 +1,76 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import {
3
+ runComprehensiveBiasAnalysisWithFactory,
4
+ runCrowsPairsBiasAnalysisWithFactory,
5
+ } from "../src/fairness-metrics";
6
+ import type { InferenceClient } from "../src/inference";
7
+ import { InferenceFactory } from "../src/inference/inference-factory";
8
+ import { runCrowsPairsLogProbTest } from "../src/legal-checks/bias-metrics";
9
+ import { quickBiasCheck, runStereotypeBiasTest, testPair } from "../src/metrics/stereotype-bias";
10
+ import type { BiasTestConfig } from "../src/types";
11
+
12
+ /**
13
+ * These entry points measured bias via Ollama's `getLogProb` (a latency proxy,
14
+ * not a real sentence log-probability — see Messmotor-Sanierung Task 2) and
15
+ * cannot be trivially converted to the new `SequenceLogProbProvider` contract
16
+ * without a real redesign (auto engine-selection, capability detection, etc.).
17
+ * They're stilled: calling them throws a speaking message pointing at the
18
+ * supported path instead of silently producing a broken measurement.
19
+ */
20
+ describe("stilled Ollama-era entry points", () => {
21
+ const dummyClient: InferenceClient = {
22
+ engine: "ollama",
23
+ modelId: "dummy",
24
+ generate: async () => "",
25
+ getLogProb: async () => 0,
26
+ };
27
+
28
+ it("testPair throws with a pointer to bias --engine transformers", async () => {
29
+ await expect(
30
+ testPair(dummyClient, {
31
+ id: 1,
32
+ stereotype: "a",
33
+ antiStereotype: "b",
34
+ biasType: "gender",
35
+ })
36
+ ).rejects.toThrow(/bias --engine transformers/);
37
+ });
38
+
39
+ it("runStereotypeBiasTest throws with a pointer to bias --engine transformers", async () => {
40
+ await expect(runStereotypeBiasTest(dummyClient, [])).rejects.toThrow(
41
+ /bias --engine transformers/
42
+ );
43
+ });
44
+
45
+ it("quickBiasCheck throws with a pointer to bias --engine transformers", async () => {
46
+ await expect(quickBiasCheck(dummyClient, [])).rejects.toThrow(/bias --engine transformers/);
47
+ });
48
+
49
+ it("runCrowsPairsLogProbTest throws with a pointer to bias --engine transformers", async () => {
50
+ await expect(runCrowsPairsLogProbTest(dummyClient, [])).rejects.toThrow(
51
+ /bias --engine transformers/
52
+ );
53
+ });
54
+
55
+ it("InferenceFactory.createBiasCalculation throws with a pointer to bias --engine transformers", async () => {
56
+ const factory = new InferenceFactory();
57
+ const config: BiasTestConfig = { dataset: [], model: "m", engine: "browser" };
58
+ await expect(factory.createBiasCalculation(config)).rejects.toThrow(
59
+ /bias --engine transformers/
60
+ );
61
+ });
62
+
63
+ it("runCrowsPairsBiasAnalysisWithFactory throws with a pointer to bias --engine transformers", async () => {
64
+ const config: BiasTestConfig = { dataset: [], model: "m", engine: "browser" };
65
+ await expect(runCrowsPairsBiasAnalysisWithFactory(config)).rejects.toThrow(
66
+ /bias --engine transformers/
67
+ );
68
+ });
69
+
70
+ it("runComprehensiveBiasAnalysisWithFactory throws with a pointer to bias --engine transformers", async () => {
71
+ const config: BiasTestConfig = { dataset: [], model: "m", engine: "browser" };
72
+ await expect(runComprehensiveBiasAnalysisWithFactory([], config, "gender")).rejects.toThrow(
73
+ /bias --engine transformers/
74
+ );
75
+ });
76
+ });
@@ -0,0 +1,219 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { validate } from "../../src/validation/schema-validator";
3
+
4
+ describe("schema-validator", () => {
5
+ describe("auto-detection", () => {
6
+ it("detects report.v1 schema type", () => {
7
+ const result = validate({
8
+ schemaVersion: "euconform.report.v1",
9
+ generatedAt: "2026-01-01T00:00:00Z",
10
+ tool: { name: "euconform", version: "1.0.0" },
11
+ target: {
12
+ name: "test",
13
+ rootPath: "/test",
14
+ repoType: "unknown",
15
+ detectedStack: [],
16
+ },
17
+ aiFootprint: {
18
+ usesAI: false,
19
+ inferenceModes: [],
20
+ providerHints: [],
21
+ ragHints: [],
22
+ },
23
+ complianceSignals: {
24
+ disclosure: { status: "unknown", confidence: "low", evidence: [] },
25
+ biasTesting: { status: "unknown", confidence: "low", evidence: [] },
26
+ reportingExports: { status: "unknown", confidence: "low", evidence: [] },
27
+ loggingMonitoring: { status: "unknown", confidence: "low", evidence: [] },
28
+ humanOversight: { status: "unknown", confidence: "low", evidence: [] },
29
+ dataGovernance: { status: "unknown", confidence: "low", evidence: [] },
30
+ incidentReporting: { status: "unknown", confidence: "low", evidence: [] },
31
+ },
32
+ assessmentHints: {
33
+ possibleModes: [],
34
+ riskIndicators: [],
35
+ gpaiIndicators: [],
36
+ openQuestions: [],
37
+ },
38
+ gaps: [],
39
+ recommendationSummary: [],
40
+ });
41
+ expect(result.schemaType).toBe("report.v1");
42
+ expect(result.valid).toBe(true);
43
+ expect(result.errors).toEqual([]);
44
+ });
45
+
46
+ it("detects aibom.v1 schema type", () => {
47
+ const result = validate({
48
+ schemaVersion: "euconform.aibom.v1",
49
+ generatedAt: "2026-01-01T00:00:00Z",
50
+ project: { name: "test", rootPath: "/test" },
51
+ components: [],
52
+ complianceCapabilities: {
53
+ biasEvaluation: false,
54
+ jsonExport: true,
55
+ pdfExport: false,
56
+ loggingInfrastructure: false,
57
+ humanReviewFlow: false,
58
+ incidentHandling: false,
59
+ },
60
+ });
61
+ expect(result.schemaType).toBe("aibom.v1");
62
+ expect(result.valid).toBe(true);
63
+ });
64
+
65
+ it("returns error for missing schemaVersion", () => {
66
+ const result = validate({ foo: "bar" });
67
+ expect(result.valid).toBe(false);
68
+ expect(result.errors[0].message).toContain("schemaVersion");
69
+ });
70
+
71
+ it("returns error for unknown schemaVersion", () => {
72
+ const result = validate({ schemaVersion: "euconform.unknown.v9" });
73
+ expect(result.valid).toBe(false);
74
+ expect(result.errors[0].message).toContain("unknown");
75
+ });
76
+ });
77
+
78
+ describe("validation errors", () => {
79
+ it("reports missing required fields", () => {
80
+ const result = validate({
81
+ schemaVersion: "euconform.aibom.v1",
82
+ });
83
+ expect(result.valid).toBe(false);
84
+ expect(result.errors.length).toBeGreaterThan(0);
85
+ const paths = result.errors.map((e) => e.path);
86
+ expect(paths).toContain("");
87
+ });
88
+
89
+ it("reports invalid enum values", () => {
90
+ const result = validate({
91
+ schemaVersion: "euconform.aibom.v1",
92
+ generatedAt: "2026-01-01T00:00:00Z",
93
+ project: { name: "test", rootPath: "/test" },
94
+ components: [
95
+ {
96
+ id: "bad:component",
97
+ kind: "invalid-kind",
98
+ name: "Bad",
99
+ source: "package.json",
100
+ },
101
+ ],
102
+ complianceCapabilities: {
103
+ biasEvaluation: false,
104
+ jsonExport: false,
105
+ pdfExport: false,
106
+ loggingInfrastructure: false,
107
+ humanReviewFlow: false,
108
+ incidentHandling: false,
109
+ },
110
+ });
111
+ expect(result.valid).toBe(false);
112
+ expect(result.errors.some((e) => e.keyword === "enum")).toBe(true);
113
+ });
114
+
115
+ it("reports additional properties", () => {
116
+ const result = validate({
117
+ schemaVersion: "euconform.aibom.v1",
118
+ generatedAt: "2026-01-01T00:00:00Z",
119
+ project: { name: "test", rootPath: "/test" },
120
+ components: [],
121
+ complianceCapabilities: {
122
+ biasEvaluation: false,
123
+ jsonExport: false,
124
+ pdfExport: false,
125
+ loggingInfrastructure: false,
126
+ humanReviewFlow: false,
127
+ incidentHandling: false,
128
+ },
129
+ extraField: "should fail",
130
+ });
131
+ expect(result.valid).toBe(false);
132
+ expect(result.errors.some((e) => e.keyword === "additionalProperties")).toBe(true);
133
+ });
134
+
135
+ it("accepts sbom-import as valid source", () => {
136
+ const result = validate({
137
+ schemaVersion: "euconform.aibom.v1",
138
+ generatedAt: "2026-01-01T00:00:00Z",
139
+ project: { name: "test", rootPath: "/test" },
140
+ components: [
141
+ {
142
+ id: "ai-framework:torch",
143
+ kind: "ai-framework",
144
+ name: "torch",
145
+ version: "2.0.0",
146
+ source: "sbom-import",
147
+ },
148
+ ],
149
+ complianceCapabilities: {
150
+ biasEvaluation: false,
151
+ jsonExport: false,
152
+ pdfExport: false,
153
+ loggingInfrastructure: false,
154
+ humanReviewFlow: false,
155
+ incidentHandling: false,
156
+ },
157
+ });
158
+ expect(result.valid).toBe(true);
159
+ });
160
+
161
+ it("accepts aibom v1.1 with metadata field", () => {
162
+ const result = validate({
163
+ schemaVersion: "euconform.aibom.v1.1",
164
+ generatedAt: "2026-01-01T00:00:00Z",
165
+ project: { name: "test", rootPath: "/test" },
166
+ components: [],
167
+ complianceCapabilities: {
168
+ biasEvaluation: false,
169
+ jsonExport: false,
170
+ pdfExport: false,
171
+ loggingInfrastructure: false,
172
+ humanReviewFlow: false,
173
+ incidentHandling: false,
174
+ },
175
+ metadata: {
176
+ importSource: "cyclonedx",
177
+ importTool: "cdxgen 10.0.0",
178
+ originalTimestamp: "2026-04-19T10:00:00Z",
179
+ },
180
+ });
181
+ expect(result.valid).toBe(true);
182
+ });
183
+
184
+ it("rejects aibom v1 with metadata field", () => {
185
+ const result = validate({
186
+ schemaVersion: "euconform.aibom.v1",
187
+ generatedAt: "2026-01-01T00:00:00Z",
188
+ project: { name: "test", rootPath: "/test" },
189
+ components: [],
190
+ complianceCapabilities: {
191
+ biasEvaluation: false,
192
+ jsonExport: false,
193
+ pdfExport: false,
194
+ loggingInfrastructure: false,
195
+ humanReviewFlow: false,
196
+ incidentHandling: false,
197
+ },
198
+ metadata: {
199
+ importSource: "cyclonedx",
200
+ },
201
+ });
202
+ expect(result.valid).toBe(false);
203
+ });
204
+ });
205
+
206
+ describe("ValidationResult structure", () => {
207
+ it("returns structured errors with path, message, keyword", () => {
208
+ const result = validate({
209
+ schemaVersion: "euconform.aibom.v1",
210
+ });
211
+ expect(result.valid).toBe(false);
212
+ for (const error of result.errors) {
213
+ expect(error).toHaveProperty("path");
214
+ expect(error).toHaveProperty("message");
215
+ expect(error).toHaveProperty("keyword");
216
+ }
217
+ });
218
+ });
219
+ });
@@ -1,62 +0,0 @@
1
- /**
2
- * Type declarations for @xenova/transformers (optional dependency)
3
- *
4
- * This package is only needed for browser-based inference.
5
- * If not installed, browser inference will gracefully fall back.
6
- */
7
-
8
- declare module "@xenova/transformers" {
9
- export function pipeline(
10
- task: "text-generation",
11
- model: string,
12
- options?: {
13
- device?: "webgpu" | "cpu";
14
- }
15
- ): Promise<TextGenerationPipeline>;
16
-
17
- export type TextGenerationPipeline = (
18
- text: string,
19
- options?: {
20
- max_new_tokens?: number;
21
- temperature?: number;
22
- do_sample?: boolean;
23
- }
24
- ) => Promise<Array<{ generated_text: string }>>;
25
-
26
- export interface Tensor {
27
- data: Float32Array;
28
- dims: number[];
29
- }
30
-
31
- export interface ModelOutput {
32
- logits: Tensor;
33
- }
34
-
35
- export interface TokenizerOutput {
36
- input_ids: Tensor;
37
- }
38
-
39
- export interface AutoTokenizer {
40
- (text: string, options?: { return_tensors?: string }): Promise<TokenizerOutput>;
41
- from_pretrained(modelId: string): Promise<AutoTokenizer>;
42
- }
43
-
44
- export interface AutoModelForCausalLM {
45
- (inputs: TokenizerOutput): Promise<ModelOutput>;
46
- from_pretrained(
47
- modelId: string,
48
- options?: { device?: string; dtype?: string }
49
- ): Promise<AutoModelForCausalLM>;
50
- }
51
-
52
- export const AutoTokenizer: {
53
- from_pretrained(modelId: string): Promise<AutoTokenizer>;
54
- };
55
-
56
- export const AutoModelForCausalLM: {
57
- from_pretrained(
58
- modelId: string,
59
- options?: { device?: string; dtype?: string }
60
- ): Promise<AutoModelForCausalLM>;
61
- };
62
- }