UNPKG

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.

65 lines (64 loc) 2.62 kB
import { Config, GenerateContentRequest, GenerateContentResponse, Tool, Content } from '../types'; import { StreamProcessor, StreamOptions } from '../strategies/stream/google.stream'; /** * * "generationConfig": { "temperature": 0.45, "thinkingConfig": { "thinkingBudget": -1, }, "responseMimeType": "text/plain", }, */ export declare class GeminiClient { private httpClient; private retryHandler; private streamProcessor; constructor(config: Config); generateContent(request: GenerateContentRequest): Promise<GenerateContentResponse>; private convertReadableToResponse; generateContentStream(request: GenerateContentRequest, options?: StreamOptions): Promise<GenerateContentResponse>; generateContentStreamAsync(request: GenerateContentRequest): AsyncGenerator<any>; chat(message: string, options?: { systemInstruction?: string; configs?: Config; tools?: Tool[]; sessionId?: string; }): Promise<GenerateContentResponse>; chatStream(message: string, options?: { systemInstruction?: string; configs?: Config; tools?: Tool[]; sessionId?: string; streamOptions?: StreamOptions; }): Promise<GenerateContentResponse>; continueConversation(contents: Content[], options?: { generationConfig?: Config['GenerationConfig']; tools?: Tool[]; }): Promise<GenerateContentResponse>; analyzeImage(base64Image: string, mimeType: string, prompt: string, options?: { generationConfig?: Config['GenerationConfig']; }): Promise<GenerateContentResponse>; analyzeDocument(base64Document: string, mimeType: string, prompt: string, options?: { generationConfig?: Config['GenerationConfig']; useCache?: boolean; cacheTtl?: string; }): Promise<GenerateContentResponse>; callFunction(message: string, tools: Tool[], options?: { generationConfig?: Config['GenerationConfig']; systemInstruction?: string; }): Promise<GenerateContentResponse>; generateWithThinking(message: string, thinkingBudget?: number, // -1 for dynamic thinking options?: { systemInstruction?: string; onThinking?: (thinking: string) => void; }): Promise<GenerateContentResponse>; get stream(): StreamProcessor; updateConfig(newConfig: Partial<Config>): void; getConfig(): Config; } export * from '../types'; export * from '../strategies/retry/expo'; export * from '../core/http-client'; export * from '../builder/ai.builder'; export * from '../strategies/stream/google.stream';