UNPKG

gpt-research

Version:

Autonomous AI research agent that conducts comprehensive research on any topic and generates detailed reports with citations

35 lines 1.64 kB
import { ChatMessage, ChatOptions, EmbeddingOptions, LLMCosts } from '../types'; import { EventEmitter } from 'events'; export interface LLMProviderConfig { apiKey: string; baseURL?: string; organization?: string; timeout?: number; maxRetries?: number; } export declare abstract class LLMProvider extends EventEmitter { protected config: LLMProviderConfig; protected modelCosts: Map<string, { input: number; output: number; }>; constructor(config: LLMProviderConfig); abstract createChatCompletion(messages: ChatMessage[], options?: ChatOptions): Promise<string>; abstract createChatCompletionStream(messages: ChatMessage[], options?: ChatOptions): AsyncGenerator<string>; abstract createEmbedding(text: string | string[], options?: EmbeddingOptions): Promise<number[] | number[][]>; abstract getAvailableModels(): Promise<string[]>; protected abstract initializeModelCosts(): void; estimateCost(input: string, output: string, model: string): LLMCosts; validateApiKey(): Promise<boolean>; protected handleError(error: any): never; protected retry<T>(fn: () => Promise<T>, retries?: number, delay?: number): Promise<T>; protected countTokens(text: string): number; protected truncateToTokenLimit(text: string, maxTokens: number): string; } export declare class LLMProviderFactory { private static providers; static register(name: string, provider: typeof LLMProvider): void; static create(name: string, config: LLMProviderConfig): LLMProvider; static getAvailableProviders(): string[]; } //# sourceMappingURL=LLMProvider.d.ts.map