@n1k1t/unit-generator
Version:
Coverage based unit tests AI generator
53 lines • 2.03 kB
TypeScript
import { FlexibleSchema, Tool, ToolExecuteFunction } from 'ai';
import { Project } from '../../project';
export interface ILlmToolParameters<TOptions extends object> {
options: TOptions;
project: Project;
}
export declare class LlmToolCompilationError extends Error {
property: string;
constructor(property: string);
}
export declare class LlmToolExecutionError extends Error {
name: string;
constructor(name: string, reason: string);
static build(name: string, source: unknown): LlmToolExecutionError;
}
export declare class LlmToolCompiler<TSchema extends {
input: unknown;
output: unknown;
options: {};
} = any> {
description: string;
private provided;
TOptions: TSchema['options'];
TExecutor: (parameters: ILlmToolParameters<TSchema['options']>) => ToolExecuteFunction<TSchema['input'], TSchema['output']>;
constructor(description: string, provided: {
executor?: LlmToolCompiler<TSchema>['TExecutor'];
options?: TSchema['options'];
schema: {
input?: FlexibleSchema<TSchema['input']>;
output?: FlexibleSchema<TSchema['output']>;
};
});
input<T, U extends LlmToolCompiler<{
input: T;
output: TSchema['output'];
options: TSchema['options'];
}>>(schema: FlexibleSchema<T>): U;
output<T, U extends LlmToolCompiler<{
input: TSchema['input'];
output: T;
options: TSchema['options'];
}>>(schema: FlexibleSchema<T>): U;
/** Provides options to tool (makes clone of this instance) */
options(payload: TSchema['options']): this;
execute(executor: NonNullable<LlmToolCompiler<TSchema>['TExecutor']>): this;
compile(parameters: Omit<ILlmToolParameters<any>, 'options'>): Tool<TSchema['input'], TSchema['output']>;
static build<TOptions extends object = {}, TOutput = any>(description: string): LlmToolCompiler<{
input: unknown;
output: TOutput;
options: TOptions;
}>;
}
//# sourceMappingURL=model.d.ts.map