@firebase/ai 2.5.0 → 2.6.0-20251113021847
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 +102 -0
- package/dist/ai.d.ts +129 -0
- package/dist/esm/index.esm.js +324 -105
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/api.d.ts +23 -1
- package/dist/esm/src/backend.d.ts +24 -0
- package/dist/esm/src/constants.d.ts +1 -0
- package/dist/esm/src/factory-node.d.ts +19 -0
- package/dist/esm/src/methods/generate-content.d.ts +2 -0
- package/dist/esm/src/models/template-generative-model.d.ts +64 -0
- package/dist/esm/src/models/template-imagen-model.d.ts +51 -0
- package/dist/esm/src/models/utils.d.ts +26 -0
- package/dist/esm/src/requests/request.d.ts +33 -15
- package/dist/esm/src/service.d.ts +3 -4
- package/dist/esm/src/types/chrome-adapter.d.ts +5 -0
- package/dist/index.cjs.js +327 -104
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +429 -188
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +426 -189
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/api.d.ts +23 -1
- package/dist/src/backend.d.ts +24 -0
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/factory-node.d.ts +19 -0
- package/dist/src/methods/generate-content.d.ts +2 -0
- package/dist/src/models/template-generative-model.d.ts +64 -0
- package/dist/src/models/template-imagen-model.d.ts +51 -0
- package/dist/src/models/utils.d.ts +26 -0
- package/dist/src/requests/request.d.ts +33 -15
- package/dist/src/service.d.ts +3 -4
- package/dist/src/types/chrome-adapter.d.ts +5 -0
- package/package.json +1 -1
package/dist/ai-public.d.ts
CHANGED
|
@@ -216,6 +216,8 @@ export declare abstract class Backend {
|
|
|
216
216
|
* @param type - The backend type.
|
|
217
217
|
*/
|
|
218
218
|
protected constructor(type: BackendType);
|
|
219
|
+
/* Excluded from this release type: _getModelPath */
|
|
220
|
+
/* Excluded from this release type: _getTemplatePath */
|
|
219
221
|
}
|
|
220
222
|
|
|
221
223
|
/**
|
|
@@ -341,6 +343,7 @@ export declare class ChatSession {
|
|
|
341
343
|
* @beta
|
|
342
344
|
*/
|
|
343
345
|
export declare interface ChromeAdapter {
|
|
346
|
+
/* Excluded from this release type: mode */
|
|
344
347
|
/**
|
|
345
348
|
* Checks if the on-device model is capable of handling a given
|
|
346
349
|
* request.
|
|
@@ -1075,6 +1078,28 @@ export declare function getImagenModel(ai: AI, modelParams: ImagenModelParams, r
|
|
|
1075
1078
|
*/
|
|
1076
1079
|
export declare function getLiveGenerativeModel(ai: AI, modelParams: LiveModelParams): LiveGenerativeModel;
|
|
1077
1080
|
|
|
1081
|
+
/**
|
|
1082
|
+
* Returns a {@link TemplateGenerativeModel} class for executing server-side
|
|
1083
|
+
* templates.
|
|
1084
|
+
*
|
|
1085
|
+
* @param ai - An {@link AI} instance.
|
|
1086
|
+
* @param requestOptions - Additional options to use when making requests.
|
|
1087
|
+
*
|
|
1088
|
+
* @beta
|
|
1089
|
+
*/
|
|
1090
|
+
export declare function getTemplateGenerativeModel(ai: AI, requestOptions?: RequestOptions): TemplateGenerativeModel;
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Returns a {@link TemplateImagenModel} class for executing server-side
|
|
1094
|
+
* Imagen templates.
|
|
1095
|
+
*
|
|
1096
|
+
* @param ai - An {@link AI} instance.
|
|
1097
|
+
* @param requestOptions - Additional options to use when making requests.
|
|
1098
|
+
*
|
|
1099
|
+
* @beta
|
|
1100
|
+
*/
|
|
1101
|
+
export declare function getTemplateImagenModel(ai: AI, requestOptions?: RequestOptions): TemplateImagenModel;
|
|
1102
|
+
|
|
1078
1103
|
/**
|
|
1079
1104
|
* Configuration class for the Gemini Developer API.
|
|
1080
1105
|
*
|
|
@@ -1088,6 +1113,8 @@ export declare class GoogleAIBackend extends Backend {
|
|
|
1088
1113
|
* Creates a configuration object for the Gemini Developer API backend.
|
|
1089
1114
|
*/
|
|
1090
1115
|
constructor();
|
|
1116
|
+
/* Excluded from this release type: _getModelPath */
|
|
1117
|
+
/* Excluded from this release type: _getTemplatePath */
|
|
1091
1118
|
}
|
|
1092
1119
|
|
|
1093
1120
|
/* Excluded from this release type: GoogleAICitationMetadata */
|
|
@@ -2921,6 +2948,79 @@ export declare class StringSchema extends Schema {
|
|
|
2921
2948
|
/* Excluded from this release type: toJSON */
|
|
2922
2949
|
}
|
|
2923
2950
|
|
|
2951
|
+
/**
|
|
2952
|
+
* {@link GenerativeModel} APIs that execute on a server-side template.
|
|
2953
|
+
*
|
|
2954
|
+
* This class should only be instantiated with {@link getTemplateGenerativeModel}.
|
|
2955
|
+
*
|
|
2956
|
+
* @beta
|
|
2957
|
+
*/
|
|
2958
|
+
export declare class TemplateGenerativeModel {
|
|
2959
|
+
/* Excluded from this release type: _apiSettings */
|
|
2960
|
+
/**
|
|
2961
|
+
* Additional options to use when making requests.
|
|
2962
|
+
*/
|
|
2963
|
+
requestOptions?: RequestOptions;
|
|
2964
|
+
/**
|
|
2965
|
+
* @hideconstructor
|
|
2966
|
+
*/
|
|
2967
|
+
constructor(ai: AI, requestOptions?: RequestOptions);
|
|
2968
|
+
/**
|
|
2969
|
+
* Makes a single non-streaming call to the model and returns an object
|
|
2970
|
+
* containing a single {@link GenerateContentResponse}.
|
|
2971
|
+
*
|
|
2972
|
+
* @param templateId - The ID of the server-side template to execute.
|
|
2973
|
+
* @param templateVariables - A key-value map of variables to populate the
|
|
2974
|
+
* template with.
|
|
2975
|
+
*
|
|
2976
|
+
* @beta
|
|
2977
|
+
*/
|
|
2978
|
+
generateContent(templateId: string, templateVariables: object): Promise<GenerateContentResult>;
|
|
2979
|
+
/**
|
|
2980
|
+
* Makes a single streaming call to the model and returns an object
|
|
2981
|
+
* containing an iterable stream that iterates over all chunks in the
|
|
2982
|
+
* streaming response as well as a promise that returns the final aggregated
|
|
2983
|
+
* response.
|
|
2984
|
+
*
|
|
2985
|
+
* @param templateId - The ID of the server-side template to execute.
|
|
2986
|
+
* @param templateVariables - A key-value map of variables to populate the
|
|
2987
|
+
* template with.
|
|
2988
|
+
*
|
|
2989
|
+
* @beta
|
|
2990
|
+
*/
|
|
2991
|
+
generateContentStream(templateId: string, templateVariables: object): Promise<GenerateContentStreamResult>;
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
/**
|
|
2995
|
+
* Class for Imagen model APIs that execute on a server-side template.
|
|
2996
|
+
*
|
|
2997
|
+
* This class should only be instantiated with {@link getTemplateImagenModel}.
|
|
2998
|
+
*
|
|
2999
|
+
* @beta
|
|
3000
|
+
*/
|
|
3001
|
+
export declare class TemplateImagenModel {
|
|
3002
|
+
/* Excluded from this release type: _apiSettings */
|
|
3003
|
+
/**
|
|
3004
|
+
* Additional options to use when making requests.
|
|
3005
|
+
*/
|
|
3006
|
+
requestOptions?: RequestOptions;
|
|
3007
|
+
/**
|
|
3008
|
+
* @hideconstructor
|
|
3009
|
+
*/
|
|
3010
|
+
constructor(ai: AI, requestOptions?: RequestOptions);
|
|
3011
|
+
/**
|
|
3012
|
+
* Makes a single call to the model and returns an object containing a single
|
|
3013
|
+
* {@link ImagenGenerationResponse}.
|
|
3014
|
+
*
|
|
3015
|
+
* @param templateId - The ID of the server-side template to execute.
|
|
3016
|
+
* @param templateVariables - A key-value map of variables to populate the
|
|
3017
|
+
* template with.
|
|
3018
|
+
*
|
|
3019
|
+
* @beta
|
|
3020
|
+
*/
|
|
3021
|
+
generateImages(templateId: string, templateVariables: object): Promise<ImagenGenerationResponse<ImagenInlineImage>>;
|
|
3022
|
+
}
|
|
3023
|
+
|
|
2924
3024
|
/**
|
|
2925
3025
|
* Content part interface if the part represents a text string.
|
|
2926
3026
|
* @public
|
|
@@ -3161,6 +3261,8 @@ export declare class VertexAIBackend extends Backend {
|
|
|
3161
3261
|
* for a list of supported locations.
|
|
3162
3262
|
*/
|
|
3163
3263
|
constructor(location?: string);
|
|
3264
|
+
/* Excluded from this release type: _getModelPath */
|
|
3265
|
+
/* Excluded from this release type: _getTemplatePath */
|
|
3164
3266
|
}
|
|
3165
3267
|
|
|
3166
3268
|
/**
|
package/dist/ai.d.ts
CHANGED
|
@@ -256,6 +256,14 @@ export declare abstract class Backend {
|
|
|
256
256
|
* @param type - The backend type.
|
|
257
257
|
*/
|
|
258
258
|
protected constructor(type: BackendType);
|
|
259
|
+
/**
|
|
260
|
+
* @internal
|
|
261
|
+
*/
|
|
262
|
+
abstract _getModelPath(project: string, model: string): string;
|
|
263
|
+
/**
|
|
264
|
+
* @internal
|
|
265
|
+
*/
|
|
266
|
+
abstract _getTemplatePath(project: string, templateId: string): string;
|
|
259
267
|
}
|
|
260
268
|
|
|
261
269
|
/**
|
|
@@ -381,6 +389,10 @@ export declare class ChatSession {
|
|
|
381
389
|
* @beta
|
|
382
390
|
*/
|
|
383
391
|
export declare interface ChromeAdapter {
|
|
392
|
+
/**
|
|
393
|
+
* @internal
|
|
394
|
+
*/
|
|
395
|
+
mode: InferenceMode;
|
|
384
396
|
/**
|
|
385
397
|
* Checks if the on-device model is capable of handling a given
|
|
386
398
|
* request.
|
|
@@ -1133,6 +1145,28 @@ export declare function getImagenModel(ai: AI, modelParams: ImagenModelParams, r
|
|
|
1133
1145
|
*/
|
|
1134
1146
|
export declare function getLiveGenerativeModel(ai: AI, modelParams: LiveModelParams): LiveGenerativeModel;
|
|
1135
1147
|
|
|
1148
|
+
/**
|
|
1149
|
+
* Returns a {@link TemplateGenerativeModel} class for executing server-side
|
|
1150
|
+
* templates.
|
|
1151
|
+
*
|
|
1152
|
+
* @param ai - An {@link AI} instance.
|
|
1153
|
+
* @param requestOptions - Additional options to use when making requests.
|
|
1154
|
+
*
|
|
1155
|
+
* @beta
|
|
1156
|
+
*/
|
|
1157
|
+
export declare function getTemplateGenerativeModel(ai: AI, requestOptions?: RequestOptions): TemplateGenerativeModel;
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* Returns a {@link TemplateImagenModel} class for executing server-side
|
|
1161
|
+
* Imagen templates.
|
|
1162
|
+
*
|
|
1163
|
+
* @param ai - An {@link AI} instance.
|
|
1164
|
+
* @param requestOptions - Additional options to use when making requests.
|
|
1165
|
+
*
|
|
1166
|
+
* @beta
|
|
1167
|
+
*/
|
|
1168
|
+
export declare function getTemplateImagenModel(ai: AI, requestOptions?: RequestOptions): TemplateImagenModel;
|
|
1169
|
+
|
|
1136
1170
|
/**
|
|
1137
1171
|
* Configuration class for the Gemini Developer API.
|
|
1138
1172
|
*
|
|
@@ -1146,6 +1180,14 @@ export declare class GoogleAIBackend extends Backend {
|
|
|
1146
1180
|
* Creates a configuration object for the Gemini Developer API backend.
|
|
1147
1181
|
*/
|
|
1148
1182
|
constructor();
|
|
1183
|
+
/**
|
|
1184
|
+
* @internal
|
|
1185
|
+
*/
|
|
1186
|
+
_getModelPath(project: string, model: string): string;
|
|
1187
|
+
/**
|
|
1188
|
+
* @internal
|
|
1189
|
+
*/
|
|
1190
|
+
_getTemplatePath(project: string, templateId: string): string;
|
|
1149
1191
|
}
|
|
1150
1192
|
|
|
1151
1193
|
/**
|
|
@@ -3060,6 +3102,85 @@ export declare class StringSchema extends Schema {
|
|
|
3060
3102
|
toJSON(): SchemaRequest;
|
|
3061
3103
|
}
|
|
3062
3104
|
|
|
3105
|
+
/**
|
|
3106
|
+
* {@link GenerativeModel} APIs that execute on a server-side template.
|
|
3107
|
+
*
|
|
3108
|
+
* This class should only be instantiated with {@link getTemplateGenerativeModel}.
|
|
3109
|
+
*
|
|
3110
|
+
* @beta
|
|
3111
|
+
*/
|
|
3112
|
+
export declare class TemplateGenerativeModel {
|
|
3113
|
+
/**
|
|
3114
|
+
* @internal
|
|
3115
|
+
*/
|
|
3116
|
+
_apiSettings: ApiSettings;
|
|
3117
|
+
/**
|
|
3118
|
+
* Additional options to use when making requests.
|
|
3119
|
+
*/
|
|
3120
|
+
requestOptions?: RequestOptions;
|
|
3121
|
+
/**
|
|
3122
|
+
* @hideconstructor
|
|
3123
|
+
*/
|
|
3124
|
+
constructor(ai: AI, requestOptions?: RequestOptions);
|
|
3125
|
+
/**
|
|
3126
|
+
* Makes a single non-streaming call to the model and returns an object
|
|
3127
|
+
* containing a single {@link GenerateContentResponse}.
|
|
3128
|
+
*
|
|
3129
|
+
* @param templateId - The ID of the server-side template to execute.
|
|
3130
|
+
* @param templateVariables - A key-value map of variables to populate the
|
|
3131
|
+
* template with.
|
|
3132
|
+
*
|
|
3133
|
+
* @beta
|
|
3134
|
+
*/
|
|
3135
|
+
generateContent(templateId: string, templateVariables: object): Promise<GenerateContentResult>;
|
|
3136
|
+
/**
|
|
3137
|
+
* Makes a single streaming call to the model and returns an object
|
|
3138
|
+
* containing an iterable stream that iterates over all chunks in the
|
|
3139
|
+
* streaming response as well as a promise that returns the final aggregated
|
|
3140
|
+
* response.
|
|
3141
|
+
*
|
|
3142
|
+
* @param templateId - The ID of the server-side template to execute.
|
|
3143
|
+
* @param templateVariables - A key-value map of variables to populate the
|
|
3144
|
+
* template with.
|
|
3145
|
+
*
|
|
3146
|
+
* @beta
|
|
3147
|
+
*/
|
|
3148
|
+
generateContentStream(templateId: string, templateVariables: object): Promise<GenerateContentStreamResult>;
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
/**
|
|
3152
|
+
* Class for Imagen model APIs that execute on a server-side template.
|
|
3153
|
+
*
|
|
3154
|
+
* This class should only be instantiated with {@link getTemplateImagenModel}.
|
|
3155
|
+
*
|
|
3156
|
+
* @beta
|
|
3157
|
+
*/
|
|
3158
|
+
export declare class TemplateImagenModel {
|
|
3159
|
+
/**
|
|
3160
|
+
* @internal
|
|
3161
|
+
*/
|
|
3162
|
+
_apiSettings: ApiSettings;
|
|
3163
|
+
/**
|
|
3164
|
+
* Additional options to use when making requests.
|
|
3165
|
+
*/
|
|
3166
|
+
requestOptions?: RequestOptions;
|
|
3167
|
+
/**
|
|
3168
|
+
* @hideconstructor
|
|
3169
|
+
*/
|
|
3170
|
+
constructor(ai: AI, requestOptions?: RequestOptions);
|
|
3171
|
+
/**
|
|
3172
|
+
* Makes a single call to the model and returns an object containing a single
|
|
3173
|
+
* {@link ImagenGenerationResponse}.
|
|
3174
|
+
*
|
|
3175
|
+
* @param templateId - The ID of the server-side template to execute.
|
|
3176
|
+
* @param templateVariables - A key-value map of variables to populate the
|
|
3177
|
+
* template with.
|
|
3178
|
+
*
|
|
3179
|
+
* @beta
|
|
3180
|
+
*/
|
|
3181
|
+
generateImages(templateId: string, templateVariables: object): Promise<ImagenGenerationResponse<ImagenInlineImage>>;
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3063
3184
|
/**
|
|
3064
3185
|
* Content part interface if the part represents a text string.
|
|
3065
3186
|
* @public
|
|
@@ -3303,6 +3424,14 @@ export declare class VertexAIBackend extends Backend {
|
|
|
3303
3424
|
* for a list of supported locations.
|
|
3304
3425
|
*/
|
|
3305
3426
|
constructor(location?: string);
|
|
3427
|
+
/**
|
|
3428
|
+
* @internal
|
|
3429
|
+
*/
|
|
3430
|
+
_getModelPath(project: string, model: string): string;
|
|
3431
|
+
/**
|
|
3432
|
+
* @internal
|
|
3433
|
+
*/
|
|
3434
|
+
_getTemplatePath(project: string, templateId: string): string;
|
|
3306
3435
|
}
|
|
3307
3436
|
|
|
3308
3437
|
/**
|