@vfarcic/dot-ai
Version:
AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance
107 lines • 3.52 kB
TypeScript
/**
* Shared debugging utilities for AI providers
*
* Common functions for logging metrics and debugging AI interactions
* when DEBUG_DOT_AI=true
*/
import { AIResponse, AgenticResult } from '../ai-provider.interface';
/**
* Create debug directory if it doesn't exist
*/
export declare function ensureDebugDirectory(): string;
/**
* Generate unique identifier for debug files with operation context
*/
export declare function generateDebugId(operation: string): string;
/**
* Unified evaluation metrics entry for AI quality assessment and performance tracking
* PRD #154: Single interface for all metrics and evaluation data
*/
export interface EvaluationMetrics {
operation: string;
sdk: string;
inputTokens: number;
outputTokens: number;
durationMs: number;
iterationCount: number;
toolCallCount: number;
status: string;
completionReason: string;
modelVersion: string;
cacheCreationTokens?: number;
cacheReadTokens?: number;
cacheHitRate?: number;
uniqueToolsUsed?: string[];
test_scenario: string;
ai_response_summary: string;
debug_files?: {
full_prompt: string;
full_response: string;
};
user_intent: string;
interaction_id: string;
failure_analysis?: string | {
failure_type: "timeout" | "error" | "infrastructure";
failure_reason: string;
time_to_failure: number;
};
}
/**
* Determine if dataset generation should be skipped for specific operations
*/
export declare function shouldSkipDatasetGeneration(operation: string): boolean;
/**
* Log unified evaluation metrics when DEBUG_DOT_AI=true
* Single function for all metrics and evaluation data capture
*/
/**
* Generate eval dataset entry in standard OpenAI Evals format
* Logs evaluation metrics to JSONL dataset files for AI quality assessment
*/
export declare function logEvaluationDataset(metrics: EvaluationMetrics, debugMode?: boolean): void;
/**
* Create AgenticResult and log metrics in one step
* Reduces code duplication across providers
*
* PRD #154: Updated to use unified evaluation metrics
*/
export declare function createAndLogAgenticResult(config: {
finalMessage: string;
iterations: number;
toolCallsExecuted: Array<{
tool: string;
input: unknown;
output: unknown;
}>;
totalTokens: {
input: number;
output: number;
cacheCreation: number;
cacheRead: number;
};
status: 'success' | 'failed' | 'timeout' | 'parse_error';
completionReason: 'investigation_complete' | 'max_iterations' | 'parse_failure' | 'model_stopped' | 'error';
modelVersion: string;
operation: string;
sdk: string;
startTime: number;
debugMode: boolean;
debugFiles?: {
promptFile: string;
responseFile: string;
} | null;
evaluationContext?: {
user_intent?: string;
failure_analysis?: string;
};
interaction_id?: string;
}): AgenticResult;
/**
* Save just the AI prompt for debugging (useful when AI call fails)
*/
export declare function debugLogPromptOnly(debugId: string, prompt: string, operation: string, provider: string, model: string, debugMode: boolean): void;
/**
* Save AI interaction for debugging when DEBUG_DOT_AI=true
*/
export declare function debugLogInteraction(debugId: string, prompt: string, response: AIResponse, operation: string, provider: string, model: string, debugMode: boolean): void;
//# sourceMappingURL=provider-debug-utils.d.ts.map