UNPKG

@bobmatnyc/ai-code-review

Version:

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

50 lines (49 loc) 2.54 kB
/** * @fileoverview Client for interacting with the Google Gemini API. * * This module provides a comprehensive client for interacting with Google's Gemini AI models. * It handles API key management, model selection and fallback, request formatting, response * processing, rate limiting, error handling, and cost estimation for code reviews. * * Key features: * - Automatic model selection with fallback to alternative models * - Support for both streaming and non-streaming responses * - Robust error handling and rate limit management * - Mock response generation for testing without an API key * - Cost estimation for API usage * - Support for different review types (quick fixes, architectural, security, performance) * * The client prioritizes the latest Gemini models but includes fallback options * to ensure reliability even when specific models are unavailable. */ import { ReviewType, ReviewResult, FileInfo, ReviewOptions } from '../types/review'; import { ProjectDocs } from '../utils/projectDocs'; /** * Generate a code review using the Gemini 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 generateReview(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 generateConsolidatedReview(files: FileInfo[], projectName: string, reviewType: ReviewType, projectDocs?: ProjectDocs | null, options?: ReviewOptions): Promise<ReviewResult>; /** * Generate an architectural review for a project * @param files Array of file information objects * @param projectName Name of the project * @param projectDocs Optional project documentation * @param options Review options * @returns Promise resolving to the review result */ export declare function generateArchitecturalReview(files: FileInfo[], projectName: string, projectDocs?: ProjectDocs | null, options?: ReviewOptions): Promise<ReviewResult>;