/**
 * @license
 * Copyright 2025 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { CountTokensRequest, GenerateContentRequest, InferenceMode, OnDeviceParams } from '../types';
import { ChromeAdapter } from '../types/chrome-adapter';
import { LanguageModel } from '../types/language-model';
/**
 * Defines an inference "backend" that uses Chrome's on-device model,
 * and encapsulates logic for detecting when on-device inference is
 * possible.
 */
export declare class ChromeAdapterImpl implements ChromeAdapter {
    private languageModelProvider;
    private mode;
    private onDeviceParams;
    static SUPPORTED_MIME_TYPES: string[];
    private isDownloading;
    private downloadPromise;
    private oldSession;
    constructor(languageModelProvider: LanguageModel, mode: InferenceMode, onDeviceParams?: OnDeviceParams);
    /**
     * Checks if a given request can be made on-device.
     *
     * <ol>Encapsulates a few concerns:
     *   <li>the mode</li>
     *   <li>API existence</li>
     *   <li>prompt formatting</li>
     *   <li>model availability, including triggering download if necessary</li>
     * </ol>
     *
     * <p>Pros: callers needn't be concerned with details of on-device availability.</p>
     * <p>Cons: this method spans a few concerns and splits request validation from usage.
     * If instance variables weren't already part of the API, we could consider a better
     * separation of concerns.</p>
     */
    isAvailable(request: GenerateContentRequest): Promise<boolean>;
    /**
     * Generates content on device.
     *
     * <p>This is comparable to {@link GenerativeModel.generateContent} for generating content in
     * Cloud.</p>
     * @param request - a standard Firebase AI {@link GenerateContentRequest}
     * @returns {@link Response}, so we can reuse common response formatting.
     */
    generateContent(request: GenerateContentRequest): Promise<Response>;
    /**
     * Generates content stream on device.
     *
     * <p>This is comparable to {@link GenerativeModel.generateContentStream} for generating content in
     * Cloud.</p>
     * @param request - a standard Firebase AI {@link GenerateContentRequest}
     * @returns {@link Response}, so we can reuse common response formatting.
     */
    generateContentStream(request: GenerateContentRequest): Promise<Response>;
    countTokens(_request: CountTokensRequest): Promise<Response>;
    /**
     * Asserts inference for the given request can be performed by an on-device model.
     */
    private static isOnDeviceRequest;
    /**
     * Encapsulates logic to get availability and download a model if one is downloadable.
     */
    private downloadIfAvailable;
    /**
     * Triggers out-of-band download of an on-device model.
     *
     * <p>Chrome only downloads models as needed. Chrome knows a model is needed when code calls
     * LanguageModel.create.</p>
     *
     * <p>Since Chrome manages the download, the SDK can only avoid redundant download requests by
     * tracking if a download has previously been requested.</p>
     */
    private download;
    /**
     * Converts Firebase AI {@link Content} object to a Chrome {@link LanguageModelMessage} object.
     */
    private static toLanguageModelMessage;
    /**
     * Converts a Firebase AI Part object to a Chrome LanguageModelMessageContent object.
     */
    private static toLanguageModelMessageContent;
    /**
     * Converts a Firebase AI {@link Role} string to a {@link LanguageModelMessageRole} string.
     */
    private static toLanguageModelMessageRole;
    /**
     * Abstracts Chrome session creation.
     *
     * <p>Chrome uses a multi-turn session for all inference. Firebase AI uses single-turn for all
     * inference. To map the Firebase AI API to Chrome's API, the SDK creates a new session for all
     * inference.</p>
     *
     * <p>Chrome will remove a model from memory if it's no longer in use, so this method ensures a
     * new session is created before an old session is destroyed.</p>
     */
    private createSession;
    /**
     * Formats string returned by Chrome as a {@link Response} returned by Firebase AI.
     */
    private static toResponse;
    /**
     * Formats string stream returned by Chrome as SSE returned by Firebase AI.
     */
    private static toStreamResponse;
}
