llmforge
Version:
One API, every AI model, instant switching. Change from GPT-4 to Gemini to local models with a single config update. LLMForge is the lightweight, TypeScript-first solution for multi-provider AI applications with zero vendor lock-in.
33 lines (32 loc) • 1.48 kB
TypeScript
import { LLMConfig, GenerateContentRequest, GenerateContentResponse, Tool, Content } from '../types';
import { OpenAIStreamProcessor } from '../strategies/stream/openai.stream';
import { OpenAIRequest, OpenAIResponse } from '../types';
export declare class OpenAIClient {
private httpClient;
private retryHandler;
private streamProcessor;
constructor(config: LLMConfig);
private convertToOpenAIRequest;
private convertToolsToOpenAI;
private convertFromOpenAIResponse;
generateContent(request: GenerateContentRequest): Promise<GenerateContentResponse>;
generateContentStreamAsync(request: GenerateContentRequest): AsyncGenerator<any>;
chat(message: string, options?: {
systemInstruction?: string;
generationConfig?: LLMConfig['generationConfig'];
tools?: Tool[];
sessionId?: string;
}): Promise<GenerateContentResponse>;
continueConversation(contents: Content[], options?: {
generationConfig?: LLMConfig['generationConfig'];
tools?: Tool[];
}): Promise<GenerateContentResponse>;
callFunction(message: string, tools: Tool[], options?: {
generationConfig?: LLMConfig['generationConfig'];
systemInstruction?: string;
}): Promise<GenerateContentResponse>;
handleOpenAIRequest(openAIRequest: OpenAIRequest): Promise<OpenAIResponse>;
get stream(): OpenAIStreamProcessor;
updateConfig(newConfig: Partial<LLMConfig>): void;
getConfig(): LLMConfig;
}