UNPKG

@dooor-ai/toolkit

Version:

Guards, Evals & Observability for AI applications - works seamlessly with LangChain/LangGraph

32 lines 952 B
import { Eval } from "./base"; import { EvalResult, EvalConfig } from "../core/types"; export interface CostEvalConfig extends EvalConfig { /** Budget limit per request in USD (triggers alert if exceeded) */ budgetLimitUsd?: number; /** Whether to alert when budget is exceeded */ alertOnExceed?: boolean; } /** * Eval that tracks cost per request * * @example * ```typescript * const eval = new CostEval({ * budgetLimitUsd: 0.10, // Alert if request costs > $0.10 * alertOnExceed: true * }); * ``` */ export declare class CostEval extends Eval { private budgetLimitUsd; private alertOnExceed; private readonly pricing; constructor(config?: CostEvalConfig); get name(): string; evaluate(input: string, output: string, metadata: Record<string, any>): Promise<EvalResult>; /** * Calculate cost based on tokens and model */ private calculateCost; } //# sourceMappingURL=cost.d.ts.map