forked from angular/web-codegen-scorer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgateway.ts
More file actions
63 lines (54 loc) · 1.68 KB
/
gateway.ts
File metadata and controls
63 lines (54 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import PQueue from 'p-queue';
import { LlmGenerateFilesContext } from '../codegen/llm-runner.js';
import { Environment } from '../configuration/environment.js';
import { ProgressLogger } from '../progress/progress-logger.js';
import {
LlmContextFile,
LlmResponse,
LlmResponseFile,
RootPromptDefinition,
} from '../shared-interfaces.js';
import { BuildResult } from '../workers/builder/builder-types.js';
export type EvalID = string & { __evalID: true };
export interface Gateway<Env extends Environment> {
/** Initializes an eval. */
initializeEval(): Promise<EvalID>;
/** Generates initial files for an eval. */
generateInitialFiles(
id: EvalID,
requestCtx: LlmGenerateFilesContext,
model: string,
contextFiles: LlmContextFile[],
abortSignal: AbortSignal
): Promise<LlmResponse>;
repairBuild(
id: EvalID,
requestCtx: LlmGenerateFilesContext,
model: string,
errorMessage: string,
appFiles: LlmResponseFile[],
contextFiles: LlmContextFile[],
abortSignal: AbortSignal
): Promise<LlmResponse>;
shouldRetryFailedBuilds(evalID: EvalID): boolean;
tryBuild(
id: EvalID,
env: Env,
appDirectoryPath: string,
rootPromptDef: RootPromptDefinition,
workerConcurrencyQueue: PQueue,
abortSignal: AbortSignal,
progress: ProgressLogger
): Promise<BuildResult>;
serveBuild<T>(
id: EvalID,
env: Env,
appDirectoryPath: string,
rootPromptDef: RootPromptDefinition,
progress: ProgressLogger,
logicWhileServing: (serveUrl: string) => Promise<T>
): Promise<T>;
finalizeEval(id: EvalID): Promise<void>;
// TODO: Consider supporting in the future.
// rateBuild(id: EvalID): AssessmentResult[];
}