/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */
import { CountTokensResponse, GenerateContentResponse, GenerateContentParameters, CountTokensParameters, EmbedContentResponse, EmbedContentParameters } from '@google/genai';
import { ContentGenerator, ContentGeneratorConfig } from './contentGenerator.js';
import OpenAI from 'openai';
import { Config } from '../config/config.js';
export declare class OpenAIContentGenerator implements ContentGenerator {
    protected client: OpenAI;
    private model;
    private contentGeneratorConfig;
    private config;
    private streamingToolCalls;
    constructor(contentGeneratorConfig: ContentGeneratorConfig, gcConfig: Config);
    /**
     * Hook for subclasses to customize error handling behavior
     * @param error The error that occurred
     * @param request The original request
     * @returns true if error logging should be suppressed, false otherwise
     */
    protected shouldSuppressErrorLogging(_error: unknown, _request: GenerateContentParameters): boolean;
    /**
     * Check if an error is a timeout error
     */
    private isTimeoutError;
    private isOpenRouterProvider;
    /**
     * Determine if this is a DashScope provider.
     * DashScope providers include QWEN_OAUTH auth type or specific DashScope base URLs.
     *
     * @returns true if this is a DashScope provider, false otherwise
     */
    private isDashScopeProvider;
    /**
     * Build metadata object for OpenAI API requests.
     *
     * @param userPromptId The user prompt ID to include in metadata
     * @returns metadata object if shouldIncludeMetadata() returns true, undefined otherwise
     */
    private buildMetadata;
    private buildCreateParams;
    generateContent(request: GenerateContentParameters, userPromptId: string): Promise<GenerateContentResponse>;
    generateContentStream(request: GenerateContentParameters, userPromptId: string): Promise<AsyncGenerator<GenerateContentResponse>>;
    private streamGenerator;
    /**
     * Combine streaming responses for logging purposes
     */
    private combineStreamResponsesForLogging;
    countTokens(request: CountTokensParameters): Promise<CountTokensResponse>;
    embedContent(request: EmbedContentParameters): Promise<EmbedContentResponse>;
    private convertGeminiParametersToOpenAI;
    /**
     * Converts Gemini tools to OpenAI format for API compatibility.
     * Handles both Gemini tools (using 'parameters' field) and MCP tools (using 'parametersJsonSchema' field).
     *
     * Gemini tools use a custom parameter format that needs conversion to OpenAI JSON Schema format.
     * MCP tools already use JSON Schema format in the parametersJsonSchema field and can be used directly.
     *
     * @param geminiTools - Array of Gemini tools to convert
     * @returns Promise resolving to array of OpenAI-compatible tools
     */
    private convertGeminiToolsToOpenAI;
    private convertToOpenAIFormat;
    /**
     * Add cache control flag to specified message(s) for DashScope providers
     */
    private addCacheControlFlag;
    /**
     * Helper method to add cache control to a specific message
     */
    private addCacheControlToMessage;
    /**
     * Clean up orphaned tool calls from message history to prevent OpenAI API errors
     */
    private cleanOrphanedToolCalls;
    /**
     * Merge consecutive assistant messages to combine split text and tool calls
     */
    private mergeConsecutiveAssistantMessages;
    private convertToGeminiFormat;
    private convertStreamChunkToGeminiFormat;
    /**
     * Build sampling parameters with clear priority:
     * 1. Config-level sampling parameters (highest priority)
     * 2. Request-level parameters (medium priority)
     * 3. Default values (lowest priority)
     */
    private buildSamplingParameters;
    private mapFinishReason;
    /**
     * Convert Gemini response format to OpenAI chat completion format for logging
     */
    private convertGeminiResponseToOpenAI;
    /**
     * Map Gemini finish reasons to OpenAI finish reasons
     */
    private mapGeminiFinishReasonToOpenAI;
}
