UNPKG

@bobmatnyc/ai-code-review

Version:

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

88 lines (87 loc) 3.42 kB
/** * @fileoverview Gemini client implementation using the abstract client interface. * * This module implements the Gemini client using the abstract client base class. * It provides functionality for interacting with Google's Gemini models for code reviews. */ import { AbstractClient } from '../base'; import { ReviewType, ReviewResult, FileInfo, ReviewOptions } from '../../types/review'; import { ProjectDocs } from '../../utils/projectDocs'; import { GoogleGenerativeAI } from '@google/generative-ai'; /** * Interface for custom model options */ interface CustomModel { name: string; displayName: string; useV1Beta?: boolean; } /** * Gemini client implementation */ export declare class GeminiClient extends AbstractClient { protected apiKey: string | undefined; protected genAI: GoogleGenerativeAI | null; protected customModel: CustomModel | null; /** * Initialize with default values */ constructor(); /** * Check if the provided model name is supported by this client * @param modelName The full model name (potentially with provider prefix) * @returns Object indicating if this is the correct client for the model */ isModelSupported(modelName: string): { isCorrect: boolean; adapter: string; modelName: string; }; /** * Get the provider name for this client * @returns The provider name */ protected getProviderName(): string; /** * Initialize the Gemini client * @returns Promise resolving to a boolean indicating success */ initialize(): Promise<boolean>; /** * Generate a review for a single file * @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 */ 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 */ 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 */ generateArchitecturalReview(files: FileInfo[], projectName: string, projectDocs?: ProjectDocs | null, options?: ReviewOptions): Promise<ReviewResult>; /** * Generate a response from the Gemini API * @param prompt The prompt to send to the API * @param options Review options * @returns Promise resolving to the response text */ private generateGeminiResponse; } export {};