/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import type { CountTokensResponse, GenerateContentResponse, GenerateContentParameters, CountTokensParameters, EmbedContentResponse, EmbedContentParameters } from '@google/genai'; import type { Config } from '../config/config.js'; import type { UserTierId } from '../code_assist/types.js'; import type { LlmRole } from '../telemetry/llmRole.js'; /** * Interface abstracting the core functionalities for generating content and counting tokens. */ export interface ContentGenerator { generateContent(request: GenerateContentParameters, userPromptId: string, role: LlmRole): Promise; generateContentStream(request: GenerateContentParameters, userPromptId: string, role: LlmRole): Promise>; countTokens(request: CountTokensParameters): Promise; embedContent(request: EmbedContentParameters): Promise; userTier?: UserTierId; userTierName?: string; } export declare enum AuthType { LOGIN_WITH_GOOGLE = "oauth-personal", USE_GEMINI = "gemini-api-key", USE_VERTEX_AI = "vertex-ai", LEGACY_CLOUD_SHELL = "cloud-shell", COMPUTE_ADC = "compute-default-credentials", USE_OPENAI = "openai", USE_ANTHROPIC = "anthropic", USE_BEDROCK = "bedrock" } /** * Detects the best authentication type based on environment variables. * * Checks in order: * 1. GOOGLE_GENAI_USE_GCA=true -> LOGIN_WITH_GOOGLE * 2. GOOGLE_GENAI_USE_VERTEXAI=true -> USE_VERTEX_AI * 3. GEMINI_API_KEY -> USE_GEMINI */ export declare function getAuthTypeFromEnv(): AuthType | undefined; export type ContentGeneratorConfig = { model?: string; apiKey?: string; vertexai?: boolean; authType?: AuthType | undefined; timeout?: number; maxRetries?: number; samplingParams?: { top_p?: number; top_k?: number; repetition_penalty?: number; presence_penalty?: number; frequency_penalty?: number; temperature?: number; max_tokens?: number; }; proxy?: string | undefined; awsRegion?: string; }; export declare function createContentGeneratorConfig(config: Config, authType: AuthType | undefined): Promise; export declare function createContentGenerator(config: ContentGeneratorConfig, gcConfig: Config, sessionId?: string): Promise;