summaryrefslogtreecommitdiff
path: root/frontend-old/node_modules/@firebase/ai/dist/src/methods/chrome-adapter.d.ts
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2025-11-16 19:08:29 +0800
committeraltaf-creator <dev@altafcreator.com>2025-11-16 19:08:29 +0800
commit434aa8343fdcbb4d5002f934979913c099489bee (patch)
tree55bab4ec5a6151be57797d34f61faf5ea744471b /frontend-old/node_modules/@firebase/ai/dist/src/methods/chrome-adapter.d.ts
parent893c388d4e99442a36005e5971a87730623f946e (diff)
sdk, del
Diffstat (limited to 'frontend-old/node_modules/@firebase/ai/dist/src/methods/chrome-adapter.d.ts')
-rw-r--r--frontend-old/node_modules/@firebase/ai/dist/src/methods/chrome-adapter.d.ts124
1 files changed, 0 insertions, 124 deletions
diff --git a/frontend-old/node_modules/@firebase/ai/dist/src/methods/chrome-adapter.d.ts b/frontend-old/node_modules/@firebase/ai/dist/src/methods/chrome-adapter.d.ts
deleted file mode 100644
index 5bd0a99..0000000
--- a/frontend-old/node_modules/@firebase/ai/dist/src/methods/chrome-adapter.d.ts
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * @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 {
- languageModelProvider: LanguageModel;
- mode: InferenceMode;
- static SUPPORTED_MIME_TYPES: string[];
- private isDownloading;
- private downloadPromise;
- private oldSession;
- onDeviceParams: OnDeviceParams;
- constructor(languageModelProvider: LanguageModel, mode: InferenceMode, onDeviceParams?: OnDeviceParams);
- /**
- * Checks if a given request can be made on-device.
- *
- * Encapsulates a few concerns:
- * the mode
- * API existence
- * prompt formatting
- * model availability, including triggering download if necessary
- *
- *
- * Pros: callers needn't be concerned with details of on-device availability.</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.
- */
- isAvailable(request: GenerateContentRequest): Promise<boolean>;
- /**
- * Generates content on device.
- *
- * @remarks
- * This is comparable to {@link GenerativeModel.generateContent} for generating content in
- * Cloud.
- * @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.
- *
- * @remarks
- * This is comparable to {@link GenerativeModel.generateContentStream} for generating content in
- * Cloud.
- * @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.
- *
- * Chrome only downloads models as needed. Chrome knows a model is needed when code calls
- * LanguageModel.create.
- *
- * Since Chrome manages the download, the SDK can only avoid redundant download requests by
- * tracking if a download has previously been requested.
- */
- 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.
- *
- * 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.
- *
- * 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.
- */
- 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;
-}
-/**
- * Creates a ChromeAdapterImpl on demand.
- */
-export declare function chromeAdapterFactory(mode: InferenceMode, window?: Window, params?: OnDeviceParams): ChromeAdapterImpl | undefined;