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.
59 lines (58 loc) • 2.29 kB
TypeScript
import { LLMConfig, GenerateContentRequest, GenerateContentResponse, Tool, Content } from '../types';
import { GoogleStreamProcessor, 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;
private endpoint;
constructor(config: LLMConfig);
private convertFromGeminiResponse;
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?: LLMConfig;
tools?: Tool[];
sessionId?: string;
}): Promise<GenerateContentResponse>;
chatStream(message: string, options?: {
systemInstruction?: string;
configs?: LLMConfig;
tools?: Tool[];
sessionId?: string;
streamOptions?: StreamOptions;
}): 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>;
generateWithThinking(message: string, thinkingBudget?: number, // -1 for dynamic thinking
options?: {
systemInstruction?: string;
onThinking?: (thinking: string) => void;
}): Promise<GenerateContentResponse>;
get stream(): GoogleStreamProcessor;
updateConfig(newConfig: Partial<LLMConfig>): void;
getConfig(): LLMConfig;
}
export * from '../types';
export * from '../strategies/retry/expo';
export * from '../core/http-client';
export * from '../builder/ai.builder';
export * from '../strategies/stream/google.stream';