UNPKG

adk-typescript

Version:

TypeScript port of Google's Agent Development Kit (ADK)

76 lines (75 loc) 2.3 kB
import { BaseLlm } from './BaseLlm'; import { BaseLlmConnection } from './BaseLlmConnection'; import { LlmRequest } from './LlmRequest'; import { LlmResponse } from './LlmResponse'; /** * Integration for Gemini models. */ export declare class Gemini extends BaseLlm { private apiClientCache; private liveApiClientCache; private readonly NEW_LINE; private readonly EXCLUDED_PART_FIELD; /** * Constructor * @param model The name of the Gemini model, defaults to 'gemini-2.0-flash' */ constructor(model?: string); /** * List of supported models * @returns An array of regex patterns for supported model names */ static supportedModels(): string[]; /** * Generate content asynchronously * @param llmRequest The request to send to the Gemini model * @param stream Whether to use streaming mode * @returns AsyncGenerator yielding LlmResponse objects */ generateContentAsync(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>; /** * Get the API client */ private get apiClient(); /** * Get the API backend type */ private get _apiBackend(); /** * Get tracking headers for API requests */ private get _trackingHeaders(); /** * Get the live API client */ private get _liveApiClient(); /** * Connect to the Gemini model and create a connection * This implementation is synchronous to match the BaseLlm interface * The implementation itself uses async/await internally */ connect(llmRequest: LlmRequest): BaseLlmConnection; /** * Appends a user content if needed * @param llmRequest The request to modify */ private _maybeAppendUserContent; /** * Build a log string for a function declaration * @param funcDecl The function declaration * @returns A string representation */ private _buildFunctionDeclarationLog; /** * Build a log string for an LlmRequest * @param req The request * @returns A formatted log string */ private _buildRequestLog; /** * Build a log string for a response * @param resp The response * @returns A formatted log string */ private _buildResponseLog; }