@infersec/conduit 1.58.1 → 1.60.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/ConduitConnection.d.ts +24 -0
- package/dist/benchmark/evaluation/bfclEvaluator.d.ts +25 -0
- package/dist/benchmark/evaluation/codeEvaluator.d.ts +20 -0
- package/dist/benchmark/evaluation/codingEvaluator.d.ts +3 -0
- package/dist/benchmark/evaluation/completion.d.ts +18 -0
- package/dist/benchmark/evaluation/mbppEvaluator.d.ts +10 -0
- package/dist/benchmark/output/writer.d.ts +15 -0
- package/dist/benchmark/provision.d.ts +17 -0
- package/dist/benchmark/runner.d.ts +7 -0
- package/dist/benchmark/sampling/gpuMemory.d.ts +2 -0
- package/dist/benchmark/sampling/memorySampler.d.ts +7 -0
- package/dist/benchmark/sampling/processMemory.d.ts +2 -0
- package/dist/benchmark/teardown.d.ts +7 -0
- package/dist/benchmark/types.d.ts +167 -0
- package/dist/benchmark/waitForReady.d.ts +5 -0
- package/dist/cli.js +55100 -17734
- package/dist/commands/benchmark.d.ts +6 -0
- package/dist/commands/models.d.ts +6 -0
- package/dist/requestHandlers/createConduitOpenAIAPIReferenceHandlers.d.ts +1 -1
- package/dist/start.d.ts +1 -1
- package/dist/utils/port.d.ts +1 -0
- package/package.json +3 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { LLMEngine, ULID } from "@infersec/definitions";
|
|
2
|
+
import type { Logger } from "@infersec/logger";
|
|
3
|
+
export interface ConduitConnectionOptions {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
apiURL: string;
|
|
6
|
+
engine: LLMEngine;
|
|
7
|
+
enginePort: number;
|
|
8
|
+
logger: Logger;
|
|
9
|
+
port: number;
|
|
10
|
+
rootDirectory?: string;
|
|
11
|
+
sourceID: ULID;
|
|
12
|
+
}
|
|
13
|
+
export declare class ConduitConnection {
|
|
14
|
+
private abortController;
|
|
15
|
+
private configuration;
|
|
16
|
+
private logger;
|
|
17
|
+
private server;
|
|
18
|
+
private shutdownFn;
|
|
19
|
+
readonly port: number;
|
|
20
|
+
readonly enginePort: number;
|
|
21
|
+
constructor(options: ConduitConnectionOptions);
|
|
22
|
+
start(): Promise<void>;
|
|
23
|
+
stop(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BFCLAnswer, BFCLProblem } from "../types.js";
|
|
2
|
+
export type { BFCLAnswer };
|
|
3
|
+
export declare function loadBFCLProblems(): Promise<{
|
|
4
|
+
problems: BFCLProblem[];
|
|
5
|
+
answers: Map<string, BFCLAnswer>;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function evaluateBFCL(options: {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
answers: Map<string, BFCLAnswer>;
|
|
10
|
+
completionEndpoint: string;
|
|
11
|
+
concurrency: number;
|
|
12
|
+
endpointID: string;
|
|
13
|
+
onProgress?: (completed: number, total: number) => void;
|
|
14
|
+
problems: BFCLProblem[];
|
|
15
|
+
}): Promise<{
|
|
16
|
+
accuracy: number;
|
|
17
|
+
completionTokens: number;
|
|
18
|
+
failedRequests: number;
|
|
19
|
+
latencies: number[];
|
|
20
|
+
promptTokens: number;
|
|
21
|
+
timeToFirstTokenMs: number[];
|
|
22
|
+
total: number;
|
|
23
|
+
totalLatencyMs: number;
|
|
24
|
+
totalRequests: number;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BenchmarkStats, HumanEvalProblem } from "../types.js";
|
|
2
|
+
interface ProblemResult {
|
|
3
|
+
completionTokens: number;
|
|
4
|
+
latencyMs: number;
|
|
5
|
+
passed: boolean;
|
|
6
|
+
promptTokens: number;
|
|
7
|
+
success: boolean;
|
|
8
|
+
timeToFirstTokenMs: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function evaluateCodeCompletion(options: {
|
|
11
|
+
apiKey: string;
|
|
12
|
+
completionEndpoint: string;
|
|
13
|
+
concurrency: number;
|
|
14
|
+
endpointID: string;
|
|
15
|
+
onProgress?: (completed: number, total: number) => void;
|
|
16
|
+
problems: HumanEvalProblem[];
|
|
17
|
+
}): Promise<BenchmarkStats>;
|
|
18
|
+
export declare function buildStats(results: ProblemResult[], problemCount: number): BenchmarkStats;
|
|
19
|
+
export declare function stripMarkdownFences(code: string): string;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function stripThinkTags(text: string): string;
|
|
2
|
+
export interface CompletionResponse {
|
|
3
|
+
completionTokens: number;
|
|
4
|
+
content: string;
|
|
5
|
+
latencyMs: number;
|
|
6
|
+
promptTokens: number;
|
|
7
|
+
timeToFirstTokenMs: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function getCompletion(options: {
|
|
10
|
+
apiKey: string;
|
|
11
|
+
endpoint: string;
|
|
12
|
+
endpointID: string;
|
|
13
|
+
maxTokens: number;
|
|
14
|
+
prompt: string;
|
|
15
|
+
stripThink?: boolean;
|
|
16
|
+
systemPrompt?: string;
|
|
17
|
+
temperature?: number;
|
|
18
|
+
}): Promise<CompletionResponse>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BenchmarkStats, MBPPPlusProblem } from "../types.js";
|
|
2
|
+
export declare function loadMBPPPlusProblems(): Promise<MBPPPlusProblem[]>;
|
|
3
|
+
export declare function evaluateMBPPPlus(options: {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
completionEndpoint: string;
|
|
6
|
+
concurrency: number;
|
|
7
|
+
endpointID: string;
|
|
8
|
+
onProgress?: (completed: number, total: number) => void;
|
|
9
|
+
problems: MBPPPlusProblem[];
|
|
10
|
+
}): Promise<BenchmarkStats>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HardwareConfig, ModelMetadata, RunResult } from "../types.js";
|
|
2
|
+
export declare function slugToFilename(slug: string, quantization: string | null): string;
|
|
3
|
+
export declare function writeOutput(options: {
|
|
4
|
+
hardware: HardwareConfig;
|
|
5
|
+
metadata?: ModelMetadata;
|
|
6
|
+
modelMetadata: {
|
|
7
|
+
format: string;
|
|
8
|
+
parameterCount: string;
|
|
9
|
+
quantization: string | null;
|
|
10
|
+
};
|
|
11
|
+
outputDir: string;
|
|
12
|
+
recommended?: string[] | false;
|
|
13
|
+
run: RunResult;
|
|
14
|
+
slug: string;
|
|
15
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ProvisionResult {
|
|
2
|
+
endpointID: string;
|
|
3
|
+
modelID: string;
|
|
4
|
+
sourceIDs: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare function provisionResources(options: {
|
|
7
|
+
accountId: string;
|
|
8
|
+
apiUrl: string;
|
|
9
|
+
apiKey: string;
|
|
10
|
+
contextLength: number;
|
|
11
|
+
engine: "llama.cpp" | "vllm";
|
|
12
|
+
format: string;
|
|
13
|
+
parallelism: number;
|
|
14
|
+
quantization: string | null;
|
|
15
|
+
slug: string;
|
|
16
|
+
}): Promise<ProvisionResult>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
export interface BenchmarkConfig {
|
|
2
|
+
hardware: HardwareConfig;
|
|
3
|
+
outputDir: string;
|
|
4
|
+
tests: TestEntry[];
|
|
5
|
+
}
|
|
6
|
+
export interface HardwareConfig {
|
|
7
|
+
device: string;
|
|
8
|
+
os: string;
|
|
9
|
+
ramTotalGB: number;
|
|
10
|
+
vramGB: number;
|
|
11
|
+
}
|
|
12
|
+
export interface TestEntry {
|
|
13
|
+
benchmarks?: {
|
|
14
|
+
bfcl?: boolean;
|
|
15
|
+
humanevalplus?: boolean;
|
|
16
|
+
mbppplus?: boolean;
|
|
17
|
+
};
|
|
18
|
+
concurrency: number;
|
|
19
|
+
contextLength: number;
|
|
20
|
+
engine: "llama.cpp" | "vllm";
|
|
21
|
+
format: string;
|
|
22
|
+
generate: boolean;
|
|
23
|
+
parallelism: number;
|
|
24
|
+
parameterCount: string;
|
|
25
|
+
quantization: string | null;
|
|
26
|
+
recommended?: string[] | false;
|
|
27
|
+
slug: string;
|
|
28
|
+
source?: ModelSource;
|
|
29
|
+
vllmImage?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ModelSource {
|
|
32
|
+
type: "huggingface";
|
|
33
|
+
url: string;
|
|
34
|
+
}
|
|
35
|
+
export interface RunResult {
|
|
36
|
+
concurrency: number;
|
|
37
|
+
contextLength: number;
|
|
38
|
+
date: string;
|
|
39
|
+
engine: string;
|
|
40
|
+
hardware: HardwareConfig;
|
|
41
|
+
maxTokens: number;
|
|
42
|
+
memory: MemoryResult;
|
|
43
|
+
parallelism: number;
|
|
44
|
+
performance: PerformanceResult;
|
|
45
|
+
quality: QualityResult;
|
|
46
|
+
}
|
|
47
|
+
export interface PerformanceResult {
|
|
48
|
+
avgLatencyMs: number;
|
|
49
|
+
completionTokens: number;
|
|
50
|
+
failedRequests: number;
|
|
51
|
+
p50LatencyMs: number;
|
|
52
|
+
p95LatencyMs: number;
|
|
53
|
+
p99LatencyMs: number;
|
|
54
|
+
promptTokens: number;
|
|
55
|
+
successRate: number;
|
|
56
|
+
timeToFirstTokenMs: number;
|
|
57
|
+
tokensPerSecond: number;
|
|
58
|
+
totalRequests: number;
|
|
59
|
+
}
|
|
60
|
+
export interface MemoryResult {
|
|
61
|
+
baselineRamUsedMB: number;
|
|
62
|
+
baselineVramUsedMB: number;
|
|
63
|
+
modelRamMB: number;
|
|
64
|
+
modelVramMB: number;
|
|
65
|
+
peakRamUsedMB: number;
|
|
66
|
+
peakVramUsedMB: number;
|
|
67
|
+
ramTotalMB: number;
|
|
68
|
+
vramTotalMB: number;
|
|
69
|
+
}
|
|
70
|
+
export interface QualityResult {
|
|
71
|
+
bfcl?: {
|
|
72
|
+
accuracy: number;
|
|
73
|
+
problems: number;
|
|
74
|
+
};
|
|
75
|
+
humanevalplus?: {
|
|
76
|
+
passed: number;
|
|
77
|
+
passRate: number;
|
|
78
|
+
problems: number;
|
|
79
|
+
};
|
|
80
|
+
mbppplus?: {
|
|
81
|
+
passed: number;
|
|
82
|
+
passRate: number;
|
|
83
|
+
problems: number;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface ModelMetadata {
|
|
87
|
+
author: string;
|
|
88
|
+
baseModel?: string;
|
|
89
|
+
contextLength?: number;
|
|
90
|
+
description?: string;
|
|
91
|
+
license?: string;
|
|
92
|
+
modelType?: string;
|
|
93
|
+
source: ModelSource;
|
|
94
|
+
}
|
|
95
|
+
export interface ModelOutput {
|
|
96
|
+
metadata?: ModelMetadata;
|
|
97
|
+
model: {
|
|
98
|
+
format: string;
|
|
99
|
+
parameterCount: string;
|
|
100
|
+
quantization: string | null;
|
|
101
|
+
};
|
|
102
|
+
recommended?: string[] | false;
|
|
103
|
+
runs: RunResult[];
|
|
104
|
+
slug: string;
|
|
105
|
+
}
|
|
106
|
+
export interface MemorySample {
|
|
107
|
+
ramTotalMB: number;
|
|
108
|
+
ramUsedMB: number;
|
|
109
|
+
timestamp: number;
|
|
110
|
+
vramTotalMB: number;
|
|
111
|
+
vramUsedMB: number;
|
|
112
|
+
}
|
|
113
|
+
export interface MemorySampleResult {
|
|
114
|
+
baseline: MemorySample;
|
|
115
|
+
peak: MemorySample;
|
|
116
|
+
samples: MemorySample[];
|
|
117
|
+
}
|
|
118
|
+
export interface BenchmarkStats {
|
|
119
|
+
avgLatencyMs: number;
|
|
120
|
+
completionTokens: number;
|
|
121
|
+
failedRequests: number;
|
|
122
|
+
latencies: number[];
|
|
123
|
+
passed: number;
|
|
124
|
+
p50LatencyMs: number;
|
|
125
|
+
p95LatencyMs: number;
|
|
126
|
+
p99LatencyMs: number;
|
|
127
|
+
problems: number;
|
|
128
|
+
promptTokens: number;
|
|
129
|
+
successRate: number;
|
|
130
|
+
timeToFirstTokenMs: number[];
|
|
131
|
+
totalLatencyMs: number;
|
|
132
|
+
totalRequests: number;
|
|
133
|
+
}
|
|
134
|
+
export interface HumanEvalProblem {
|
|
135
|
+
entryPoint: string;
|
|
136
|
+
id: string;
|
|
137
|
+
prompt: string;
|
|
138
|
+
test: string;
|
|
139
|
+
}
|
|
140
|
+
export interface MBPPPlusProblem {
|
|
141
|
+
assertions: string;
|
|
142
|
+
entryPoint: string;
|
|
143
|
+
id: string;
|
|
144
|
+
prompt: string;
|
|
145
|
+
solution: string;
|
|
146
|
+
}
|
|
147
|
+
export interface BFCLFunction {
|
|
148
|
+
description: string;
|
|
149
|
+
name: string;
|
|
150
|
+
parameters: {
|
|
151
|
+
properties: Record<string, Record<string, unknown>>;
|
|
152
|
+
required?: string[];
|
|
153
|
+
type: string;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export interface BFCLProblem {
|
|
157
|
+
function: BFCLFunction[];
|
|
158
|
+
id: string;
|
|
159
|
+
question: Array<Array<{
|
|
160
|
+
content: string;
|
|
161
|
+
role: string;
|
|
162
|
+
}>>;
|
|
163
|
+
}
|
|
164
|
+
export interface BFCLAnswer {
|
|
165
|
+
ground_truth: Array<Record<string, Record<string, unknown>>>;
|
|
166
|
+
id: string;
|
|
167
|
+
}
|