@firebase/ai 2.3.0-canary.cb3bdd812 → 2.3.0-canary.ccbf7ba36

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.
@@ -396,7 +396,7 @@ export declare interface CitationMetadata {
396
396
  /**
397
397
  * The results of code execution run by the model.
398
398
  *
399
- * @public
399
+ * @beta
400
400
  */
401
401
  export declare interface CodeExecutionResult {
402
402
  /**
@@ -413,7 +413,7 @@ export declare interface CodeExecutionResult {
413
413
  /**
414
414
  * Represents the code execution result from the model.
415
415
  *
416
- * @public
416
+ * @beta
417
417
  */
418
418
  export declare interface CodeExecutionResultPart {
419
419
  text?: never;
@@ -430,7 +430,7 @@ export declare interface CodeExecutionResultPart {
430
430
  /**
431
431
  * A tool that enables the model to use code execution.
432
432
  *
433
- * @public
433
+ * @beta
434
434
  */
435
435
  export declare interface CodeExecutionTool {
436
436
  /**
@@ -580,7 +580,7 @@ export declare interface ErrorDetails {
580
580
  /**
581
581
  * An interface for executable code returned by the model.
582
582
  *
583
- * @public
583
+ * @beta
584
584
  */
585
585
  export declare interface ExecutableCode {
586
586
  /**
@@ -596,7 +596,7 @@ export declare interface ExecutableCode {
596
596
  /**
597
597
  * Represents the code that is executed by the model.
598
598
  *
599
- * @public
599
+ * @beta
600
600
  */
601
601
  export declare interface ExecutableCodePart {
602
602
  text?: never;
@@ -853,6 +853,7 @@ export declare interface GenerateContentCandidate {
853
853
  safetyRatings?: SafetyRating[];
854
854
  citationMetadata?: CitationMetadata;
855
855
  groundingMetadata?: GroundingMetadata;
856
+ urlContextMetadata?: URLContextMetadata;
856
857
  }
857
858
 
858
859
  /**
@@ -1862,7 +1863,7 @@ export declare class IntegerSchema extends Schema {
1862
1863
  /**
1863
1864
  * The programming language of the code.
1864
1865
  *
1865
- * @public
1866
+ * @beta
1866
1867
  */
1867
1868
  export declare const Language: {
1868
1869
  UNSPECIFIED: string;
@@ -1872,7 +1873,7 @@ export declare const Language: {
1872
1873
  /**
1873
1874
  * The programming language of the code.
1874
1875
  *
1875
- * @public
1876
+ * @beta
1876
1877
  */
1877
1878
  export declare type Language = (typeof Language)[keyof typeof Language];
1878
1879
 
@@ -2147,6 +2148,15 @@ export declare class LiveSession {
2147
2148
  * @beta
2148
2149
  */
2149
2150
  sendMediaChunks(mediaChunks: GenerativeContentBlob[]): Promise<void>;
2151
+ /**
2152
+ * Sends function responses to the server.
2153
+ *
2154
+ * @param functionResponses - The function responses to send.
2155
+ * @throws If this session has been closed.
2156
+ *
2157
+ * @beta
2158
+ */
2159
+ sendFunctionResponses(functionResponses: FunctionResponse[]): Promise<void>;
2150
2160
  /**
2151
2161
  * Sends a stream of {@link GenerativeContentBlob}.
2152
2162
  *
@@ -2289,7 +2299,7 @@ export declare interface OnDeviceParams {
2289
2299
  /**
2290
2300
  * Represents the result of the code execution.
2291
2301
  *
2292
- * @public
2302
+ * @beta
2293
2303
  */
2294
2304
  export declare const Outcome: {
2295
2305
  UNSPECIFIED: string;
@@ -2301,7 +2311,7 @@ export declare const Outcome: {
2301
2311
  /**
2302
2312
  * Represents the result of the code execution.
2303
2313
  *
2304
- * @public
2314
+ * @beta
2305
2315
  */
2306
2316
  export declare type Outcome = (typeof Outcome)[keyof typeof Outcome];
2307
2317
 
@@ -2776,7 +2786,7 @@ export declare interface StartAudioConversationOptions {
2776
2786
  * The handler should perform the function call and return the result as a `Part`,
2777
2787
  * which will then be sent back to the model.
2778
2788
  */
2779
- functionCallingHandler?: (functionCalls: LiveServerToolCall['functionCalls']) => Promise<Part>;
2789
+ functionCallingHandler?: (functionCalls: FunctionCall[]) => Promise<FunctionResponse>;
2780
2790
  }
2781
2791
 
2782
2792
  /**
@@ -2854,7 +2864,7 @@ export declare interface ThinkingConfig {
2854
2864
  * Defines a tool that model can call to access external knowledge.
2855
2865
  * @public
2856
2866
  */
2857
- export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool;
2867
+ export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool | URLContextTool;
2858
2868
 
2859
2869
  /**
2860
2870
  * Tool config. This config is shared for all tools provided in the request.
@@ -2870,6 +2880,115 @@ export declare interface ToolConfig {
2870
2880
  */
2871
2881
  export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;
2872
2882
 
2883
+ /**
2884
+ * Specifies the URL Context configuration.
2885
+ *
2886
+ * @beta
2887
+ */
2888
+ export declare interface URLContext {
2889
+ }
2890
+
2891
+ /**
2892
+ * Metadata related to {@link URLContextTool}.
2893
+ *
2894
+ * @beta
2895
+ */
2896
+ export declare interface URLContextMetadata {
2897
+ /**
2898
+ * List of URL metadata used to provide context to the Gemini model.
2899
+ */
2900
+ urlMetadata: URLMetadata[];
2901
+ }
2902
+
2903
+ /**
2904
+ * A tool that allows you to provide additional context to the models in the form of public web
2905
+ * URLs. By including URLs in your request, the Gemini model will access the content from those
2906
+ * pages to inform and enhance its response.
2907
+ *
2908
+ * @beta
2909
+ */
2910
+ export declare interface URLContextTool {
2911
+ /**
2912
+ * Specifies the URL Context configuration.
2913
+ */
2914
+ urlContext: URLContext;
2915
+ }
2916
+
2917
+ /**
2918
+ * Metadata for a single URL retrieved by the {@link URLContextTool} tool.
2919
+ *
2920
+ * @beta
2921
+ */
2922
+ export declare interface URLMetadata {
2923
+ /**
2924
+ * The retrieved URL.
2925
+ */
2926
+ retrievedUrl?: string;
2927
+ /**
2928
+ * The status of the URL retrieval.
2929
+ */
2930
+ urlRetrievalStatus?: URLRetrievalStatus;
2931
+ }
2932
+
2933
+ /**
2934
+ * The status of a URL retrieval.
2935
+ *
2936
+ * @remarks
2937
+ * <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
2938
+ * <br/>
2939
+ * <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
2940
+ * <br/>
2941
+ * <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
2942
+ * <br/>
2943
+ * <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
2944
+ * <br/>
2945
+ * <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
2946
+ * <br/>
2947
+ *
2948
+ * @beta
2949
+ */
2950
+ export declare const URLRetrievalStatus: {
2951
+ /**
2952
+ * Unspecified retrieval status.
2953
+ */
2954
+ URL_RETRIEVAL_STATUS_UNSPECIFIED: string;
2955
+ /**
2956
+ * The URL retrieval was successful.
2957
+ */
2958
+ URL_RETRIEVAL_STATUS_SUCCESS: string;
2959
+ /**
2960
+ * The URL retrieval failed.
2961
+ */
2962
+ URL_RETRIEVAL_STATUS_ERROR: string;
2963
+ /**
2964
+ * The URL retrieval failed because the content is behind a paywall.
2965
+ */
2966
+ URL_RETRIEVAL_STATUS_PAYWALL: string;
2967
+ /**
2968
+ * The URL retrieval failed because the content is unsafe.
2969
+ */
2970
+ URL_RETRIEVAL_STATUS_UNSAFE: string;
2971
+ };
2972
+
2973
+ /**
2974
+ * The status of a URL retrieval.
2975
+ *
2976
+ * @remarks
2977
+ * <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
2978
+ * <br/>
2979
+ * <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
2980
+ * <br/>
2981
+ * <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
2982
+ * <br/>
2983
+ * <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
2984
+ * <br/>
2985
+ * <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
2986
+ * <br/>
2987
+ *
2988
+ * @beta
2989
+ */
2990
+ export declare type URLRetrievalStatus = (typeof URLRetrievalStatus)[keyof typeof URLRetrievalStatus];
2991
+
2873
2992
  /**
2874
2993
  * Usage metadata about a {@link GenerateContentResponse}.
2875
2994
  *
@@ -2883,8 +3002,16 @@ export declare interface UsageMetadata {
2883
3002
  */
2884
3003
  thoughtsTokenCount?: number;
2885
3004
  totalTokenCount: number;
3005
+ /**
3006
+ * The number of tokens used by tools.
3007
+ */
3008
+ toolUsePromptTokenCount?: number;
2886
3009
  promptTokensDetails?: ModalityTokenCount[];
2887
3010
  candidatesTokensDetails?: ModalityTokenCount[];
3011
+ /**
3012
+ * A list of tokens used by tools, broken down by modality.
3013
+ */
3014
+ toolUsePromptTokensDetails?: ModalityTokenCount[];
2888
3015
  }
2889
3016
 
2890
3017
  /**
package/dist/ai.d.ts CHANGED
@@ -439,7 +439,7 @@ export declare interface CitationMetadata {
439
439
  /**
440
440
  * The results of code execution run by the model.
441
441
  *
442
- * @public
442
+ * @beta
443
443
  */
444
444
  export declare interface CodeExecutionResult {
445
445
  /**
@@ -456,7 +456,7 @@ export declare interface CodeExecutionResult {
456
456
  /**
457
457
  * Represents the code execution result from the model.
458
458
  *
459
- * @public
459
+ * @beta
460
460
  */
461
461
  export declare interface CodeExecutionResultPart {
462
462
  text?: never;
@@ -476,7 +476,7 @@ export declare interface CodeExecutionResultPart {
476
476
  /**
477
477
  * A tool that enables the model to use code execution.
478
478
  *
479
- * @public
479
+ * @beta
480
480
  */
481
481
  export declare interface CodeExecutionTool {
482
482
  /**
@@ -626,7 +626,7 @@ export declare interface ErrorDetails {
626
626
  /**
627
627
  * An interface for executable code returned by the model.
628
628
  *
629
- * @public
629
+ * @beta
630
630
  */
631
631
  export declare interface ExecutableCode {
632
632
  /**
@@ -642,7 +642,7 @@ export declare interface ExecutableCode {
642
642
  /**
643
643
  * Represents the code that is executed by the model.
644
644
  *
645
- * @public
645
+ * @beta
646
646
  */
647
647
  export declare interface ExecutableCodePart {
648
648
  text?: never;
@@ -911,6 +911,7 @@ export declare interface GenerateContentCandidate {
911
911
  safetyRatings?: SafetyRating[];
912
912
  citationMetadata?: CitationMetadata;
913
913
  groundingMetadata?: GroundingMetadata;
914
+ urlContextMetadata?: URLContextMetadata;
914
915
  }
915
916
 
916
917
  /**
@@ -1166,6 +1167,7 @@ export declare interface GoogleAIGenerateContentCandidate {
1166
1167
  safetyRatings?: SafetyRating[];
1167
1168
  citationMetadata?: GoogleAICitationMetadata;
1168
1169
  groundingMetadata?: GroundingMetadata;
1170
+ urlContextMetadata?: URLContextMetadata;
1169
1171
  }
1170
1172
 
1171
1173
  /**
@@ -1976,7 +1978,7 @@ export declare class IntegerSchema extends Schema {
1976
1978
  /**
1977
1979
  * The programming language of the code.
1978
1980
  *
1979
- * @public
1981
+ * @beta
1980
1982
  */
1981
1983
  export declare const Language: {
1982
1984
  UNSPECIFIED: string;
@@ -1986,7 +1988,7 @@ export declare const Language: {
1986
1988
  /**
1987
1989
  * The programming language of the code.
1988
1990
  *
1989
- * @public
1991
+ * @beta
1990
1992
  */
1991
1993
  export declare type Language = (typeof Language)[keyof typeof Language];
1992
1994
 
@@ -2274,6 +2276,15 @@ export declare class LiveSession {
2274
2276
  * @beta
2275
2277
  */
2276
2278
  sendMediaChunks(mediaChunks: GenerativeContentBlob[]): Promise<void>;
2279
+ /**
2280
+ * Sends function responses to the server.
2281
+ *
2282
+ * @param functionResponses - The function responses to send.
2283
+ * @throws If this session has been closed.
2284
+ *
2285
+ * @beta
2286
+ */
2287
+ sendFunctionResponses(functionResponses: FunctionResponse[]): Promise<void>;
2277
2288
  /**
2278
2289
  * Sends a stream of {@link GenerativeContentBlob}.
2279
2290
  *
@@ -2419,7 +2430,7 @@ export declare interface OnDeviceParams {
2419
2430
  /**
2420
2431
  * Represents the result of the code execution.
2421
2432
  *
2422
- * @public
2433
+ * @beta
2423
2434
  */
2424
2435
  export declare const Outcome: {
2425
2436
  UNSPECIFIED: string;
@@ -2431,7 +2442,7 @@ export declare const Outcome: {
2431
2442
  /**
2432
2443
  * Represents the result of the code execution.
2433
2444
  *
2434
- * @public
2445
+ * @beta
2435
2446
  */
2436
2447
  export declare type Outcome = (typeof Outcome)[keyof typeof Outcome];
2437
2448
 
@@ -2911,7 +2922,7 @@ export declare interface StartAudioConversationOptions {
2911
2922
  * The handler should perform the function call and return the result as a `Part`,
2912
2923
  * which will then be sent back to the model.
2913
2924
  */
2914
- functionCallingHandler?: (functionCalls: LiveServerToolCall['functionCalls']) => Promise<Part>;
2925
+ functionCallingHandler?: (functionCalls: FunctionCall[]) => Promise<FunctionResponse>;
2915
2926
  }
2916
2927
 
2917
2928
  /**
@@ -2995,7 +3006,7 @@ export declare interface ThinkingConfig {
2995
3006
  * Defines a tool that model can call to access external knowledge.
2996
3007
  * @public
2997
3008
  */
2998
- export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool;
3009
+ export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool | URLContextTool;
2999
3010
 
3000
3011
  /**
3001
3012
  * Tool config. This config is shared for all tools provided in the request.
@@ -3011,6 +3022,115 @@ export declare interface ToolConfig {
3011
3022
  */
3012
3023
  export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;
3013
3024
 
3025
+ /**
3026
+ * Specifies the URL Context configuration.
3027
+ *
3028
+ * @beta
3029
+ */
3030
+ export declare interface URLContext {
3031
+ }
3032
+
3033
+ /**
3034
+ * Metadata related to {@link URLContextTool}.
3035
+ *
3036
+ * @beta
3037
+ */
3038
+ export declare interface URLContextMetadata {
3039
+ /**
3040
+ * List of URL metadata used to provide context to the Gemini model.
3041
+ */
3042
+ urlMetadata: URLMetadata[];
3043
+ }
3044
+
3045
+ /**
3046
+ * A tool that allows you to provide additional context to the models in the form of public web
3047
+ * URLs. By including URLs in your request, the Gemini model will access the content from those
3048
+ * pages to inform and enhance its response.
3049
+ *
3050
+ * @beta
3051
+ */
3052
+ export declare interface URLContextTool {
3053
+ /**
3054
+ * Specifies the URL Context configuration.
3055
+ */
3056
+ urlContext: URLContext;
3057
+ }
3058
+
3059
+ /**
3060
+ * Metadata for a single URL retrieved by the {@link URLContextTool} tool.
3061
+ *
3062
+ * @beta
3063
+ */
3064
+ export declare interface URLMetadata {
3065
+ /**
3066
+ * The retrieved URL.
3067
+ */
3068
+ retrievedUrl?: string;
3069
+ /**
3070
+ * The status of the URL retrieval.
3071
+ */
3072
+ urlRetrievalStatus?: URLRetrievalStatus;
3073
+ }
3074
+
3075
+ /**
3076
+ * The status of a URL retrieval.
3077
+ *
3078
+ * @remarks
3079
+ * <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
3080
+ * <br/>
3081
+ * <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
3082
+ * <br/>
3083
+ * <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
3084
+ * <br/>
3085
+ * <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
3086
+ * <br/>
3087
+ * <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
3088
+ * <br/>
3089
+ *
3090
+ * @beta
3091
+ */
3092
+ export declare const URLRetrievalStatus: {
3093
+ /**
3094
+ * Unspecified retrieval status.
3095
+ */
3096
+ URL_RETRIEVAL_STATUS_UNSPECIFIED: string;
3097
+ /**
3098
+ * The URL retrieval was successful.
3099
+ */
3100
+ URL_RETRIEVAL_STATUS_SUCCESS: string;
3101
+ /**
3102
+ * The URL retrieval failed.
3103
+ */
3104
+ URL_RETRIEVAL_STATUS_ERROR: string;
3105
+ /**
3106
+ * The URL retrieval failed because the content is behind a paywall.
3107
+ */
3108
+ URL_RETRIEVAL_STATUS_PAYWALL: string;
3109
+ /**
3110
+ * The URL retrieval failed because the content is unsafe.
3111
+ */
3112
+ URL_RETRIEVAL_STATUS_UNSAFE: string;
3113
+ };
3114
+
3115
+ /**
3116
+ * The status of a URL retrieval.
3117
+ *
3118
+ * @remarks
3119
+ * <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
3120
+ * <br/>
3121
+ * <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
3122
+ * <br/>
3123
+ * <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
3124
+ * <br/>
3125
+ * <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
3126
+ * <br/>
3127
+ * <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
3128
+ * <br/>
3129
+ *
3130
+ * @beta
3131
+ */
3132
+ export declare type URLRetrievalStatus = (typeof URLRetrievalStatus)[keyof typeof URLRetrievalStatus];
3133
+
3014
3134
  /**
3015
3135
  * Usage metadata about a {@link GenerateContentResponse}.
3016
3136
  *
@@ -3024,8 +3144,16 @@ export declare interface UsageMetadata {
3024
3144
  */
3025
3145
  thoughtsTokenCount?: number;
3026
3146
  totalTokenCount: number;
3147
+ /**
3148
+ * The number of tokens used by tools.
3149
+ */
3150
+ toolUsePromptTokenCount?: number;
3027
3151
  promptTokensDetails?: ModalityTokenCount[];
3028
3152
  candidatesTokensDetails?: ModalityTokenCount[];
3153
+ /**
3154
+ * A list of tokens used by tools, broken down by modality.
3155
+ */
3156
+ toolUsePromptTokensDetails?: ModalityTokenCount[];
3029
3157
  }
3030
3158
 
3031
3159
  /**