@firebase/ai 2.1.0-canary.9b63cd60e → 2.1.0-canary.cbef6c6e5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,9 +5,10 @@
5
5
  */
6
6
  import { AIService } from './service';
7
7
  import { ComponentContainer, InstanceFactoryOptions } from '@firebase/component';
8
+ import { LanguageModel } from './types/language-model';
8
9
  declare global {
9
10
  interface Window {
10
- [key: string]: unknown;
11
+ LanguageModel: LanguageModel;
11
12
  }
12
13
  }
13
14
  export declare function factory(container: ComponentContainer, { instanceIdentifier }: InstanceFactoryOptions): AIService;
@@ -23,9 +23,9 @@ import { LanguageModel } from '../types/language-model';
23
23
  * possible.
24
24
  */
25
25
  export declare class ChromeAdapterImpl implements ChromeAdapter {
26
- private languageModelProvider;
27
- private mode;
28
- private onDeviceParams;
26
+ languageModelProvider: LanguageModel;
27
+ mode: InferenceMode;
28
+ onDeviceParams: OnDeviceParams;
29
29
  static SUPPORTED_MIME_TYPES: string[];
30
30
  private isDownloading;
31
31
  private downloadPromise;
@@ -118,3 +118,7 @@ export declare class ChromeAdapterImpl implements ChromeAdapter {
118
118
  */
119
119
  private static toStreamResponse;
120
120
  }
121
+ /**
122
+ * Creates a ChromeAdapterImpl on demand.
123
+ */
124
+ export declare function chromeAdapterFactory(mode: InferenceMode, window?: Window, params?: OnDeviceParams): ChromeAdapterImpl | undefined;
@@ -15,19 +15,21 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { FirebaseApp, _FirebaseService } from '@firebase/app';
18
- import { AI, AIOptions } from './public-types';
18
+ import { AI, AIOptions, InferenceMode, OnDeviceParams } from './public-types';
19
19
  import { AppCheckInternalComponentName, FirebaseAppCheckInternal } from '@firebase/app-check-interop-types';
20
20
  import { Provider } from '@firebase/component';
21
21
  import { FirebaseAuthInternal, FirebaseAuthInternalName } from '@firebase/auth-interop-types';
22
22
  import { Backend } from './backend';
23
+ import { ChromeAdapterImpl } from './methods/chrome-adapter';
23
24
  export declare class AIService implements AI, _FirebaseService {
24
25
  app: FirebaseApp;
25
26
  backend: Backend;
27
+ chromeAdapterFactory?: ((mode: InferenceMode, window?: Window, params?: OnDeviceParams) => ChromeAdapterImpl | undefined) | undefined;
26
28
  auth: FirebaseAuthInternal | null;
27
29
  appCheck: FirebaseAppCheckInternal | null;
28
30
  _options?: Omit<AIOptions, 'backend'>;
29
31
  location: string;
30
- constructor(app: FirebaseApp, backend: Backend, authProvider?: Provider<FirebaseAuthInternalName>, appCheckProvider?: Provider<AppCheckInternalComponentName>);
32
+ constructor(app: FirebaseApp, backend: Backend, authProvider?: Provider<FirebaseAuthInternalName>, appCheckProvider?: Provider<AppCheckInternalComponentName>, chromeAdapterFactory?: ((mode: InferenceMode, window?: Window, params?: OnDeviceParams) => ChromeAdapterImpl | undefined) | undefined);
31
33
  _delete(): Promise<void>;
32
34
  set options(optionsToSet: AIOptions);
33
35
  get options(): AIOptions | undefined;
@@ -59,6 +59,14 @@ export interface ImagenResponseInternal {
59
59
  * The reason why the image was filtered.
60
60
  */
61
61
  raiFilteredReason?: string;
62
+ /**
63
+ * The safety attributes.
64
+ *
65
+ * This type is currently unused in the SDK. It is sent back because our requests set
66
+ * `includeSafetyAttributes`. This property is currently only used to avoid throwing an error
67
+ * when encountering this unsupported prediction type.
68
+ */
69
+ safetyAttributes?: unknown;
62
70
  }>;
63
71
  }
64
72
  /**
@@ -81,6 +89,7 @@ export interface ImagenResponseInternal {
81
89
  * "personGeneration": "allow_all",
82
90
  * "sampleCount": 2,
83
91
  * "includeRaiReason": true,
92
+ * "includeSafetyAttributes": true,
84
93
  * "aspectRatio": "9:16"
85
94
  * }
86
95
  * }
@@ -108,6 +117,7 @@ export interface PredictRequestBody {
108
117
  safetyFilterLevel?: string;
109
118
  personGeneration?: string;
110
119
  includeRaiReason: boolean;
120
+ includeSafetyAttributes: boolean;
111
121
  };
112
122
  }
113
123
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/ai",
3
- "version": "2.1.0-canary.9b63cd60e",
3
+ "version": "2.1.0-canary.cbef6c6e5",
4
4
  "description": "The Firebase AI SDK",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "engines": {
@@ -39,25 +39,27 @@
39
39
  "test:ci": "yarn testsetup && node ../../scripts/run_tests_in_ci.js -s test",
40
40
  "test:skip-clone": "karma start",
41
41
  "test:browser": "yarn testsetup && karma start",
42
+ "test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha --require ts-node/register --require src/index.node.ts 'src/**/!(*-browser)*.test.ts' --config ../../config/mocharc.node.js",
42
43
  "test:integration": "karma start --integration",
44
+ "test:integration:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha integration/**/*.test.ts --config ../../config/mocharc.node.js",
43
45
  "api-report": "api-extractor run --local --verbose",
44
46
  "typings:public": "node ../../scripts/build/use_typings.js ./dist/ai-public.d.ts",
45
47
  "trusted-type-check": "tsec -p tsconfig.json --noEmit"
46
48
  },
47
49
  "peerDependencies": {
48
- "@firebase/app": "0.14.1-canary.9b63cd60e",
49
- "@firebase/app-types": "0.9.3-canary.9b63cd60e"
50
+ "@firebase/app": "0.14.1-canary.cbef6c6e5",
51
+ "@firebase/app-types": "0.9.3-canary.cbef6c6e5"
50
52
  },
51
53
  "dependencies": {
52
- "@firebase/app-check-interop-types": "0.3.3-canary.9b63cd60e",
53
- "@firebase/component": "0.7.0-canary.9b63cd60e",
54
- "@firebase/logger": "0.5.0-canary.9b63cd60e",
55
- "@firebase/util": "1.13.0-canary.9b63cd60e",
54
+ "@firebase/app-check-interop-types": "0.3.3-canary.cbef6c6e5",
55
+ "@firebase/component": "0.7.0-canary.cbef6c6e5",
56
+ "@firebase/logger": "0.5.0-canary.cbef6c6e5",
57
+ "@firebase/util": "1.13.0-canary.cbef6c6e5",
56
58
  "tslib": "^2.1.0"
57
59
  },
58
60
  "license": "Apache-2.0",
59
61
  "devDependencies": {
60
- "@firebase/app": "0.14.1-canary.9b63cd60e",
62
+ "@firebase/app": "0.14.1-canary.cbef6c6e5",
61
63
  "@rollup/plugin-json": "6.1.0",
62
64
  "rollup": "2.79.2",
63
65
  "rollup-plugin-replace": "2.2.0",