@firebase/ai 2.9.0 → 2.10.0
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.
- package/dist/ai-public.d.ts +10 -0
- package/dist/ai.d.ts +10 -0
- package/dist/esm/index.esm.js +27 -1
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/types/requests.d.ts +10 -0
- package/dist/index.cjs.js +27 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +27 -1
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +27 -1
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/types/requests.d.ts +10 -0
- package/package.json +4 -4
package/dist/index.node.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var util = require('@firebase/util');
|
|
|
8
8
|
var logger$1 = require('@firebase/logger');
|
|
9
9
|
|
|
10
10
|
var name = "@firebase/ai";
|
|
11
|
-
var version = "2.
|
|
11
|
+
var version = "2.10.0";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -2830,6 +2830,17 @@ function validateGenerationConfig(generationConfig) {
|
|
|
2830
2830
|
generationConfig.thinkingConfig?.thinkingLevel) {
|
|
2831
2831
|
throw new AIError(AIErrorCode.UNSUPPORTED, `Cannot set both thinkingBudget and thinkingLevel in a config.`);
|
|
2832
2832
|
}
|
|
2833
|
+
if (
|
|
2834
|
+
// != allows for null and undefined.
|
|
2835
|
+
generationConfig.responseSchema != null &&
|
|
2836
|
+
generationConfig.responseJsonSchema != null) {
|
|
2837
|
+
throw new AIError(AIErrorCode.UNSUPPORTED, `Cannot set both responseSchema and responseJsonSchema in a config.`);
|
|
2838
|
+
}
|
|
2839
|
+
if ((generationConfig.responseSchema != null ||
|
|
2840
|
+
generationConfig.responseJsonSchema != null) &&
|
|
2841
|
+
generationConfig.responseMimeType) {
|
|
2842
|
+
throw new AIError(AIErrorCode.UNSUPPORTED, `responseMimeType must be set if responseSchema or responseJsonSchema are set.`);
|
|
2843
|
+
}
|
|
2833
2844
|
}
|
|
2834
2845
|
|
|
2835
2846
|
/**
|
|
@@ -4350,6 +4361,11 @@ function getAI(app$1 = app.getApp(), options) {
|
|
|
4350
4361
|
aiInstance.options = finalOptions;
|
|
4351
4362
|
return aiInstance;
|
|
4352
4363
|
}
|
|
4364
|
+
const hybridParamKeys = [
|
|
4365
|
+
'mode',
|
|
4366
|
+
'onDeviceParams',
|
|
4367
|
+
'inCloudParams'
|
|
4368
|
+
];
|
|
4353
4369
|
/**
|
|
4354
4370
|
* Returns a {@link GenerativeModel} class with methods for inference
|
|
4355
4371
|
* and other functionality.
|
|
@@ -4361,6 +4377,16 @@ function getGenerativeModel(ai, modelParams, requestOptions) {
|
|
|
4361
4377
|
const hybridParams = modelParams;
|
|
4362
4378
|
let inCloudParams;
|
|
4363
4379
|
if (hybridParams.mode) {
|
|
4380
|
+
for (const param of Object.keys(modelParams)) {
|
|
4381
|
+
if (!hybridParamKeys.includes(param)) {
|
|
4382
|
+
logger.warn(`When a hybrid inference mode is specified (mode is currently set` +
|
|
4383
|
+
` to ${hybridParams.mode}), "${param}" cannot be ` +
|
|
4384
|
+
`configured at the top level. Configuration for in-cloud and ` +
|
|
4385
|
+
`on-device must be done separately in inCloudParams and onDeviceParams. ` +
|
|
4386
|
+
`Configuration values set outside of inCloudParams and onDeviceParams will` +
|
|
4387
|
+
` be ignored.`);
|
|
4388
|
+
}
|
|
4389
|
+
}
|
|
4364
4390
|
inCloudParams = hybridParams.inCloudParams || {
|
|
4365
4391
|
model: DEFAULT_HYBRID_IN_CLOUD_MODEL
|
|
4366
4392
|
};
|