@bobmatnyc/ai-code-review
Version:
A TypeScript-based tool for automated code reviews using AI models from Google Gemini, Anthropic Claude, and OpenRouter
85 lines (84 loc) • 3.4 kB
TypeScript
/**
* @fileoverview OpenAI client implementation using the abstract client interface.
*
* This module implements the OpenAI client using the abstract client base class.
* It provides functionality for interacting with OpenAI's GPT models for code reviews.
*/
import { AbstractClient } from '../base';
import { ReviewType, ReviewResult, FileInfo, ReviewOptions } from '../../types/review';
import { ProjectDocs } from '../../utils/projectDocs';
/**
* OpenAI client implementation
*/
export declare class OpenAIClient extends AbstractClient {
protected apiKey: string | undefined;
/**
* Initialize with default values
*/
constructor();
/**
* Check if the client is initialized
* @returns True if initialized, false otherwise
*/
getIsInitialized(): boolean;
/**
* 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 OpenAI client
* @returns Promise resolving to a boolean indicating success
*/
initialize(): Promise<boolean>;
/**
* Get the API model name to use for requests
* @returns The actual model name to use in API requests
*/
private getApiModelName;
/**
* Add model-specific parameters using the model configuration registry
* @param requestBody The request body to modify
* @returns The modified request body
*/
private applyModelConfiguration;
/**
* 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>;
}