@lewist9x/distil
Version:
An opinionated library for managing LLM pipelines. Define, track, rate, and curate prompt–completion pairs for fine-tuning.
22 lines (21 loc) • 770 B
TypeScript
import { LLMInput } from "./types";
/**
* Validate required fields on LLMInput.
*/
export declare function validateInput(input: any): LLMInput;
/**
* Estimate cost using an average token length heuristic.
*/
export declare function calculateCost(inputStr: string, outputStr: string): number;
/**
* Simple retry wrapper for async functions.
*/
export declare function retry<T>(fn: () => Promise<T>, retries?: number, delay?: number): Promise<T>;
/**
* Generic postprocessing function. Extend as needed.
*/
export declare function postprocess(response: string, extraData?: any): string;
/**
* Compute a unique SHA-256 hash based on the systemPrompt, userPrompt, and sorted parameter keys.
*/
export declare function computeTemplateHash(input: LLMInput): string;