forked from Lilly-Protocol/agentlily-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel-provider.ts
More file actions
36 lines (31 loc) · 1.02 KB
/
Copy pathmodel-provider.ts
File metadata and controls
36 lines (31 loc) · 1.02 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
export interface ModelPrompt {
instructions: string;
input: string;
}
export interface ModelResponse {
outputText: string;
metadata?: Record<string, unknown>;
}
export interface ModelProvider {
readonly name: string;
generate(prompt: ModelPrompt): Promise<ModelResponse>;
}
export class UnconfiguredModelProvider implements ModelProvider {
public readonly name = "unconfigured";
public async generate(prompt: ModelPrompt): Promise<ModelResponse> {
console.warn(
"UnconfiguredModelProvider: no model provider is configured. " +
"generate() was called but will return placeholder text. " +
"Configure a real ModelProvider to enable AI-powered task execution."
);
return {
outputText:
"No model provider is configured. Contributors can implement one behind the ModelProvider interface.",
metadata: {
warning: "unconfigured_provider",
instructionsLength: prompt.instructions?.length ?? 0,
inputLength: prompt.input?.length ?? 0
}
};
}
}