@jackhua/mini-langchain
Version:
A lightweight TypeScript implementation of LangChain with cost optimization features
81 lines • 1.57 kB
TypeScript
/**
* Built-in debugging and development tools
*/
import { BaseChain } from '../chains/base';
import { BaseLLM } from '../llms/base';
/**
* Debug log entry
*/
interface DebugLog {
type: string;
chainName?: string;
provider?: string;
inputs?: any;
outputs?: any;
duration?: number;
timestamp: Date;
error?: string;
}
/**
* Chain debugger for development
*/
export declare class ChainDebugger {
private logs;
private breakpoints;
/**
* Wrap a chain with debugging capabilities
*/
wrap(chain: BaseChain): BaseChain;
/**
* Set a breakpoint on a chain
*/
setBreakpoint(chainName: string): void;
/**
* Remove a breakpoint
*/
removeBreakpoint(chainName: string): void;
/**
* Pause execution at breakpoint
*/
private pause;
/**
* Log debug information
*/
private log;
/**
* Print formatted log
*/
private printLog;
/**
* Get all logs
*/
getLogs(): DebugLog[];
/**
* Clear logs
*/
clearLogs(): void;
/**
* Export logs to file
*/
exportLogs(filepath: string): void;
}
/**
* LLM call inspector
*/
export declare class LLMInspector {
private callHistory;
/**
* Wrap an LLM with inspection capabilities
*/
wrap(llm: BaseLLM): BaseLLM;
/**
* Estimate token count (simple approximation)
*/
private estimateTokens;
/**
* Print LLM call details
*/
private printCall;
}
export {};
//# sourceMappingURL=debugger.d.ts.map