UNPKG

@bobmatnyc/ai-code-review

Version:

A TypeScript-based tool for automated code reviews using AI models from Google Gemini, Anthropic Claude, and OpenRouter

43 lines (42 loc) 2.05 kB
/** * @fileoverview Client for interacting with the OpenRouter API. * * This module provides a client for interacting with OpenRouter's API, which gives * access to a variety of AI models from different providers. It handles API key * management, request formatting, response processing, rate limiting, error handling, * and cost estimation for code reviews. * * Key features: * - Support for various models through OpenRouter (Claude, GPT-4, etc.) * - Streaming and non-streaming responses * - Robust error handling and rate limit management * - Cost estimation for API usage * - Support for different review types */ import { ReviewType, ReviewResult, FileInfo, ReviewOptions } from '../types/review'; import { ProjectDocs } from '../utils/projectDocs'; /** * Initialize the OpenRouter client * @returns Promise resolving to a boolean indicating if initialization was successful */ export declare function initializeAnyOpenRouterModel(): Promise<boolean>; /** * Generate a code review using the OpenRouter API * @param fileContent Content of the file to review * @param filePath Path to the file * @param reviewType Type of review to perform * @param projectDocs Optional project documentation * @param options Review options * @returns Promise resolving to the review result */ export declare function generateOpenRouterReview(fileContent: string, filePath: string, reviewType: ReviewType, projectDocs?: ProjectDocs | null, options?: ReviewOptions): Promise<ReviewResult>; /** * Generate a consolidated review for multiple files * @param files Array of file information objects * @param projectName Name of the project * @param reviewType Type of review to perform * @param projectDocs Optional project documentation * @param options Review options * @returns Promise resolving to the review result */ export declare function generateOpenRouterConsolidatedReview(files: FileInfo[], projectName: string, reviewType: ReviewType, projectDocs?: ProjectDocs | null, options?: ReviewOptions): Promise<ReviewResult>;