File size: 1,330 Bytes
06671aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import type { InferenceProviderId } from "./types";

export class ProviderModelMismatchError extends Error {
    readonly code = "provider_model_mismatch" as const;

    constructor(message = "provider_model_mismatch") {
        super(message);
        this.name = "ProviderModelMismatchError";
    }
}

export class MissingApiKeyError extends Error {
    readonly code = "missing_api_key" as const;
    readonly provider: InferenceProviderId;

    constructor(provider: InferenceProviderId) {
        super(`missing_api_key:${provider}`);
        this.name = "MissingApiKeyError";
        this.provider = provider;
    }
}

export class VertexNotConfiguredError extends Error {
    readonly code = "vertex_not_configured" as const;
    readonly missingEnvVars: string[];

    constructor(missingEnvVars: string[]) {
        super(
            `Vertex AI provider not configured. Missing: ${missingEnvVars.join(", ")}`,
        );
        this.name = "VertexNotConfiguredError";
        this.missingEnvVars = missingEnvVars;
    }
}

export class InferenceManifestValidationError extends Error {
    readonly issues: string[];

    constructor(issues: string[]) {
        super(`Invalid inference manifest:\n- ${issues.join("\n- ")}`);
        this.name = "InferenceManifestValidationError";
        this.issues = issues;
    }
}