@firebase/ai 1.4.0-canary.5d13166dc → 1.4.0-canary.6ab4e13a1

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.
@@ -568,7 +568,7 @@ export declare interface FunctionDeclaration {
568
568
  * format. Reflects the Open API 3.03 Parameter Object. Parameter names are
569
569
  * case-sensitive. For a function with no parameters, this can be left unset.
570
570
  */
571
- parameters?: ObjectSchemaInterface;
571
+ parameters?: ObjectSchema | ObjectSchemaRequest;
572
572
  }
573
573
 
574
574
  /**
@@ -715,6 +715,10 @@ export declare interface GenerationConfig {
715
715
  * @beta
716
716
  */
717
717
  responseModalities?: ResponseModality[];
718
+ /**
719
+ * Configuration for "thinking" behavior of compatible Gemini models.
720
+ */
721
+ thinkingConfig?: ThinkingConfig;
718
722
  }
719
723
 
720
724
  /**
@@ -857,6 +861,42 @@ export declare class GoogleAIBackend extends Backend {
857
861
 
858
862
  /* Excluded from this release type: GoogleAIGenerateContentResponse */
859
863
 
864
+ /**
865
+ * Specifies the Google Search configuration.
866
+ *
867
+ * @remarks Currently, this is an empty object, but it's reserved for future configuration options.
868
+ *
869
+ * @public
870
+ */
871
+ export declare interface GoogleSearch {
872
+ }
873
+
874
+ /**
875
+ * A tool that allows a Gemini model to connect to Google Search to access and incorporate
876
+ * up-to-date information from the web into its responses.
877
+ *
878
+ * Important: If using Grounding with Google Search, you are required to comply with the
879
+ * "Grounding with Google Search" usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
880
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
881
+ * section within the Service Specific Terms).
882
+ *
883
+ * @public
884
+ */
885
+ export declare interface GoogleSearchTool {
886
+ /**
887
+ * Specifies the Google Search configuration.
888
+ * Currently, this is an empty object, but it's reserved for future configuration options.
889
+ * Specifies the Google Search configuration. Currently, this is an empty object, but it's
890
+ * reserved for future configuration options.
891
+ *
892
+ * When using this feature, you are required to comply with the "Grounding with Google Search"
893
+ * usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
894
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
895
+ * section within the Service Specific Terms).
896
+ */
897
+ googleSearch: GoogleSearch;
898
+ }
899
+
860
900
  /**
861
901
  * @deprecated
862
902
  * @public
@@ -869,18 +909,83 @@ export declare interface GroundingAttribution {
869
909
  }
870
910
 
871
911
  /**
872
- * Metadata returned to client when grounding is enabled.
912
+ * Represents a chunk of retrieved data that supports a claim in the model's response. This is part
913
+ * of the grounding information provided when grounding is enabled.
914
+ *
915
+ * @public
916
+ */
917
+ export declare interface GroundingChunk {
918
+ /**
919
+ * Contains details if the grounding chunk is from a web source.
920
+ */
921
+ web?: WebGroundingChunk;
922
+ }
923
+
924
+ /**
925
+ * Metadata returned when grounding is enabled.
926
+ *
927
+ * Currently, only Grounding with Google Search is supported (see {@link GoogleSearchTool}).
928
+ *
929
+ * Important: If using Grounding with Google Search, you are required to comply with the
930
+ * "Grounding with Google Search" usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
931
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
932
+ * section within the Service Specific Terms).
933
+ *
873
934
  * @public
874
935
  */
875
936
  export declare interface GroundingMetadata {
937
+ /**
938
+ * Google Search entry point for web searches. This contains an HTML/CSS snippet that must be
939
+ * embedded in an app to display a Google Search entry point for follow-up web searches related to
940
+ * a model's “Grounded Response”.
941
+ */
942
+ searchEntryPoint?: SearchEntrypoint;
943
+ /**
944
+ * A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content
945
+ * (for example, from a web page). that the model used to ground its response.
946
+ */
947
+ groundingChunks?: GroundingChunk[];
948
+ /**
949
+ * A list of {@link GroundingSupport} objects. Each object details how specific segments of the
950
+ * model's response are supported by the `groundingChunks`.
951
+ */
952
+ groundingSupports?: GroundingSupport[];
953
+ /**
954
+ * A list of web search queries that the model performed to gather the grounding information.
955
+ * These can be used to allow users to explore the search results themselves.
956
+ */
876
957
  webSearchQueries?: string[];
958
+ /**
959
+ * @deprecated Use {@link GroundingSupport} instead.
960
+ */
877
961
  retrievalQueries?: string[];
878
962
  /**
879
- * @deprecated
963
+ * @deprecated Use {@link GroundingChunk} instead.
880
964
  */
881
965
  groundingAttributions: GroundingAttribution[];
882
966
  }
883
967
 
968
+ /**
969
+ * Provides information about how a specific segment of the model's response is supported by the
970
+ * retrieved grounding chunks.
971
+ *
972
+ * @public
973
+ */
974
+ export declare interface GroundingSupport {
975
+ /**
976
+ * Specifies the segment of the model's response content that this grounding support pertains to.
977
+ */
978
+ segment?: Segment;
979
+ /**
980
+ * A list of indices that refer to specific {@link GroundingChunk} objects within the
981
+ * {@link GroundingMetadata.groundingChunks} array. These referenced chunks
982
+ * are the sources that support the claim made in the associated `segment` of the response.
983
+ * For example, an array `[1, 3, 4]` means that `groundingChunks[1]`, `groundingChunks[3]`,
984
+ * and `groundingChunks[4]` are the retrieved content supporting this part of the response.
985
+ */
986
+ groundingChunkIndices?: number[];
987
+ }
988
+
884
989
  /**
885
990
  * This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
886
991
  *
@@ -1499,12 +1604,20 @@ export declare class ObjectSchema extends Schema {
1499
1604
  }
1500
1605
 
1501
1606
  /**
1502
- * Interface for {@link ObjectSchema} class.
1607
+ * Interface for JSON parameters in {@link SchemaType.OBJECT} format when
1608
+ * not using the {@link ObjectSchema} helper.
1503
1609
  * @public
1504
1610
  */
1505
- export declare interface ObjectSchemaInterface extends SchemaInterface {
1611
+ export declare interface ObjectSchemaRequest extends SchemaRequest {
1506
1612
  type: SchemaType.OBJECT;
1507
- optionalProperties?: string[];
1613
+ /**
1614
+ * This is not a property accepted in the final request to the backend, but is
1615
+ * a client-side convenience property that is only usable by constructing
1616
+ * a schema through the `Schema.object()` helper method. Populating this
1617
+ * property will cause response errors if the object is not wrapped with
1618
+ * `Schema.object()`.
1619
+ */
1620
+ optionalProperties?: never;
1508
1621
  }
1509
1622
 
1510
1623
  /**
@@ -1829,12 +1942,58 @@ export declare enum SchemaType {
1829
1942
  }
1830
1943
 
1831
1944
  /**
1945
+ * Google search entry point.
1946
+ *
1947
+ * @public
1948
+ */
1949
+ export declare interface SearchEntrypoint {
1950
+ /**
1951
+ * HTML/CSS snippet that must be embedded in a web page. The snippet is designed to avoid
1952
+ * undesired interaction with the rest of the page's CSS.
1953
+ *
1954
+ * To ensure proper rendering and prevent CSS conflicts, it is recommended
1955
+ * to encapsulate this `renderedContent` within a shadow DOM when embedding it
1956
+ * into a webpage. See {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM | MDN: Using shadow DOM}.
1957
+ *
1958
+ * @example
1959
+ * ```javascript
1960
+ * const container = document.createElement('div');
1961
+ * document.body.appendChild(container);
1962
+ * container.attachShadow({ mode: 'open' }).innerHTML = renderedContent;
1963
+ * ```
1964
+ */
1965
+ renderedContent?: string;
1966
+ }
1967
+
1968
+ /**
1969
+ * Represents a specific segment within a {@link Content} object, often used to
1970
+ * pinpoint the exact location of text or data that grounding information refers to.
1971
+ *
1832
1972
  * @public
1833
1973
  */
1834
1974
  export declare interface Segment {
1975
+ /**
1976
+ * The zero-based index of the {@link Part} object within the `parts` array
1977
+ * of its parent {@link Content} object. This identifies which part of the
1978
+ * content the segment belongs to.
1979
+ */
1835
1980
  partIndex: number;
1981
+ /**
1982
+ * The zero-based start index of the segment within the specified `Part`,
1983
+ * measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the
1984
+ * beginning of the part's content (e.g., `Part.text`).
1985
+ */
1836
1986
  startIndex: number;
1987
+ /**
1988
+ * The zero-based end index of the segment within the specified `Part`,
1989
+ * measured in UTF-8 bytes. This offset is exclusive, meaning the character
1990
+ * at this index is not included in the segment.
1991
+ */
1837
1992
  endIndex: number;
1993
+ /**
1994
+ * The text corresponding to the segment from the response.
1995
+ */
1996
+ text: string;
1838
1997
  }
1839
1998
 
1840
1999
  /**
@@ -1870,11 +2029,36 @@ export declare interface TextPart {
1870
2029
  functionResponse?: never;
1871
2030
  }
1872
2031
 
2032
+ /**
2033
+ * Configuration for "thinking" behavior of compatible Gemini models.
2034
+ *
2035
+ * Certain models utilize a thinking process before generating a response. This allows them to
2036
+ * reason through complex problems and plan a more coherent and accurate answer.
2037
+ *
2038
+ * @public
2039
+ */
2040
+ export declare interface ThinkingConfig {
2041
+ /**
2042
+ * The thinking budget, in tokens.
2043
+ *
2044
+ * This parameter sets an upper limit on the number of tokens the model can use for its internal
2045
+ * "thinking" process. A higher budget may result in higher quality responses for complex tasks
2046
+ * but can also increase latency and cost.
2047
+ *
2048
+ * If you don't specify a budget, the model will determine the appropriate amount
2049
+ * of thinking based on the complexity of the prompt.
2050
+ *
2051
+ * An error will be thrown if you set a thinking budget for a model that does not support this
2052
+ * feature or if the specified budget is not within the model's supported range.
2053
+ */
2054
+ thinkingBudget?: number;
2055
+ }
2056
+
1873
2057
  /**
1874
2058
  * Defines a tool that model can call to access external knowledge.
1875
2059
  * @public
1876
2060
  */
1877
- export declare type Tool = FunctionDeclarationsTool;
2061
+ export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool;
1878
2062
 
1879
2063
  /**
1880
2064
  * Tool config. This config is shared for all tools provided in the request.
@@ -1898,6 +2082,10 @@ export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema |
1898
2082
  export declare interface UsageMetadata {
1899
2083
  promptTokenCount: number;
1900
2084
  candidatesTokenCount: number;
2085
+ /**
2086
+ * The number of tokens used by the model's internal "thinking" process.
2087
+ */
2088
+ thoughtsTokenCount?: number;
1901
2089
  totalTokenCount: number;
1902
2090
  promptTokensDetails?: ModalityTokenCount[];
1903
2091
  candidatesTokensDetails?: ModalityTokenCount[];
@@ -1995,4 +2183,31 @@ export declare interface WebAttribution {
1995
2183
  title: string;
1996
2184
  }
1997
2185
 
2186
+ /**
2187
+ * A grounding chunk from the web.
2188
+ *
2189
+ * Important: If using Grounding with Google Search, you are required to comply with the
2190
+ * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search".
2191
+ *
2192
+ * @public
2193
+ */
2194
+ export declare interface WebGroundingChunk {
2195
+ /**
2196
+ * The URI of the retrieved web page.
2197
+ */
2198
+ uri?: string;
2199
+ /**
2200
+ * The title of the retrieved web page.
2201
+ */
2202
+ title?: string;
2203
+ /**
2204
+ * The domain of the original URI from which the content was retrieved.
2205
+ *
2206
+ * This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}).
2207
+ * When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be
2208
+ * `undefined`.
2209
+ */
2210
+ domain?: string;
2211
+ }
2212
+
1998
2213
  export { }
package/dist/ai.d.ts CHANGED
@@ -605,7 +605,7 @@ export declare interface FunctionDeclaration {
605
605
  * format. Reflects the Open API 3.03 Parameter Object. Parameter names are
606
606
  * case-sensitive. For a function with no parameters, this can be left unset.
607
607
  */
608
- parameters?: ObjectSchemaInterface;
608
+ parameters?: ObjectSchema | ObjectSchemaRequest;
609
609
  }
610
610
 
611
611
  /**
@@ -752,6 +752,10 @@ export declare interface GenerationConfig {
752
752
  * @beta
753
753
  */
754
754
  responseModalities?: ResponseModality[];
755
+ /**
756
+ * Configuration for "thinking" behavior of compatible Gemini models.
757
+ */
758
+ thinkingConfig?: ThinkingConfig;
755
759
  }
756
760
 
757
761
  /**
@@ -928,6 +932,42 @@ export declare interface GoogleAIGenerateContentResponse {
928
932
  usageMetadata?: UsageMetadata;
929
933
  }
930
934
 
935
+ /**
936
+ * Specifies the Google Search configuration.
937
+ *
938
+ * @remarks Currently, this is an empty object, but it's reserved for future configuration options.
939
+ *
940
+ * @public
941
+ */
942
+ export declare interface GoogleSearch {
943
+ }
944
+
945
+ /**
946
+ * A tool that allows a Gemini model to connect to Google Search to access and incorporate
947
+ * up-to-date information from the web into its responses.
948
+ *
949
+ * Important: If using Grounding with Google Search, you are required to comply with the
950
+ * "Grounding with Google Search" usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
951
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
952
+ * section within the Service Specific Terms).
953
+ *
954
+ * @public
955
+ */
956
+ export declare interface GoogleSearchTool {
957
+ /**
958
+ * Specifies the Google Search configuration.
959
+ * Currently, this is an empty object, but it's reserved for future configuration options.
960
+ * Specifies the Google Search configuration. Currently, this is an empty object, but it's
961
+ * reserved for future configuration options.
962
+ *
963
+ * When using this feature, you are required to comply with the "Grounding with Google Search"
964
+ * usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
965
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
966
+ * section within the Service Specific Terms).
967
+ */
968
+ googleSearch: GoogleSearch;
969
+ }
970
+
931
971
  /**
932
972
  * @deprecated
933
973
  * @public
@@ -940,18 +980,83 @@ export declare interface GroundingAttribution {
940
980
  }
941
981
 
942
982
  /**
943
- * Metadata returned to client when grounding is enabled.
983
+ * Represents a chunk of retrieved data that supports a claim in the model's response. This is part
984
+ * of the grounding information provided when grounding is enabled.
985
+ *
986
+ * @public
987
+ */
988
+ export declare interface GroundingChunk {
989
+ /**
990
+ * Contains details if the grounding chunk is from a web source.
991
+ */
992
+ web?: WebGroundingChunk;
993
+ }
994
+
995
+ /**
996
+ * Metadata returned when grounding is enabled.
997
+ *
998
+ * Currently, only Grounding with Google Search is supported (see {@link GoogleSearchTool}).
999
+ *
1000
+ * Important: If using Grounding with Google Search, you are required to comply with the
1001
+ * "Grounding with Google Search" usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
1002
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
1003
+ * section within the Service Specific Terms).
1004
+ *
944
1005
  * @public
945
1006
  */
946
1007
  export declare interface GroundingMetadata {
1008
+ /**
1009
+ * Google Search entry point for web searches. This contains an HTML/CSS snippet that must be
1010
+ * embedded in an app to display a Google Search entry point for follow-up web searches related to
1011
+ * a model's “Grounded Response”.
1012
+ */
1013
+ searchEntryPoint?: SearchEntrypoint;
1014
+ /**
1015
+ * A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content
1016
+ * (for example, from a web page). that the model used to ground its response.
1017
+ */
1018
+ groundingChunks?: GroundingChunk[];
1019
+ /**
1020
+ * A list of {@link GroundingSupport} objects. Each object details how specific segments of the
1021
+ * model's response are supported by the `groundingChunks`.
1022
+ */
1023
+ groundingSupports?: GroundingSupport[];
1024
+ /**
1025
+ * A list of web search queries that the model performed to gather the grounding information.
1026
+ * These can be used to allow users to explore the search results themselves.
1027
+ */
947
1028
  webSearchQueries?: string[];
1029
+ /**
1030
+ * @deprecated Use {@link GroundingSupport} instead.
1031
+ */
948
1032
  retrievalQueries?: string[];
949
1033
  /**
950
- * @deprecated
1034
+ * @deprecated Use {@link GroundingChunk} instead.
951
1035
  */
952
1036
  groundingAttributions: GroundingAttribution[];
953
1037
  }
954
1038
 
1039
+ /**
1040
+ * Provides information about how a specific segment of the model's response is supported by the
1041
+ * retrieved grounding chunks.
1042
+ *
1043
+ * @public
1044
+ */
1045
+ export declare interface GroundingSupport {
1046
+ /**
1047
+ * Specifies the segment of the model's response content that this grounding support pertains to.
1048
+ */
1049
+ segment?: Segment;
1050
+ /**
1051
+ * A list of indices that refer to specific {@link GroundingChunk} objects within the
1052
+ * {@link GroundingMetadata.groundingChunks} array. These referenced chunks
1053
+ * are the sources that support the claim made in the associated `segment` of the response.
1054
+ * For example, an array `[1, 3, 4]` means that `groundingChunks[1]`, `groundingChunks[3]`,
1055
+ * and `groundingChunks[4]` are the retrieved content supporting this part of the response.
1056
+ */
1057
+ groundingChunkIndices?: number[];
1058
+ }
1059
+
955
1060
  /**
956
1061
  * This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
957
1062
  *
@@ -1592,12 +1697,20 @@ export declare class ObjectSchema extends Schema {
1592
1697
  }
1593
1698
 
1594
1699
  /**
1595
- * Interface for {@link ObjectSchema} class.
1700
+ * Interface for JSON parameters in {@link SchemaType.OBJECT} format when
1701
+ * not using the {@link ObjectSchema} helper.
1596
1702
  * @public
1597
1703
  */
1598
- export declare interface ObjectSchemaInterface extends SchemaInterface {
1704
+ export declare interface ObjectSchemaRequest extends SchemaRequest {
1599
1705
  type: SchemaType.OBJECT;
1600
- optionalProperties?: string[];
1706
+ /**
1707
+ * This is not a property accepted in the final request to the backend, but is
1708
+ * a client-side convenience property that is only usable by constructing
1709
+ * a schema through the `Schema.object()` helper method. Populating this
1710
+ * property will cause response errors if the object is not wrapped with
1711
+ * `Schema.object()`.
1712
+ */
1713
+ optionalProperties?: never;
1601
1714
  }
1602
1715
 
1603
1716
  /**
@@ -1927,12 +2040,58 @@ export declare enum SchemaType {
1927
2040
  }
1928
2041
 
1929
2042
  /**
2043
+ * Google search entry point.
2044
+ *
2045
+ * @public
2046
+ */
2047
+ export declare interface SearchEntrypoint {
2048
+ /**
2049
+ * HTML/CSS snippet that must be embedded in a web page. The snippet is designed to avoid
2050
+ * undesired interaction with the rest of the page's CSS.
2051
+ *
2052
+ * To ensure proper rendering and prevent CSS conflicts, it is recommended
2053
+ * to encapsulate this `renderedContent` within a shadow DOM when embedding it
2054
+ * into a webpage. See {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM | MDN: Using shadow DOM}.
2055
+ *
2056
+ * @example
2057
+ * ```javascript
2058
+ * const container = document.createElement('div');
2059
+ * document.body.appendChild(container);
2060
+ * container.attachShadow({ mode: 'open' }).innerHTML = renderedContent;
2061
+ * ```
2062
+ */
2063
+ renderedContent?: string;
2064
+ }
2065
+
2066
+ /**
2067
+ * Represents a specific segment within a {@link Content} object, often used to
2068
+ * pinpoint the exact location of text or data that grounding information refers to.
2069
+ *
1930
2070
  * @public
1931
2071
  */
1932
2072
  export declare interface Segment {
2073
+ /**
2074
+ * The zero-based index of the {@link Part} object within the `parts` array
2075
+ * of its parent {@link Content} object. This identifies which part of the
2076
+ * content the segment belongs to.
2077
+ */
1933
2078
  partIndex: number;
2079
+ /**
2080
+ * The zero-based start index of the segment within the specified `Part`,
2081
+ * measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the
2082
+ * beginning of the part's content (e.g., `Part.text`).
2083
+ */
1934
2084
  startIndex: number;
2085
+ /**
2086
+ * The zero-based end index of the segment within the specified `Part`,
2087
+ * measured in UTF-8 bytes. This offset is exclusive, meaning the character
2088
+ * at this index is not included in the segment.
2089
+ */
1935
2090
  endIndex: number;
2091
+ /**
2092
+ * The text corresponding to the segment from the response.
2093
+ */
2094
+ text: string;
1936
2095
  }
1937
2096
 
1938
2097
  /**
@@ -1971,11 +2130,36 @@ export declare interface TextPart {
1971
2130
  functionResponse?: never;
1972
2131
  }
1973
2132
 
2133
+ /**
2134
+ * Configuration for "thinking" behavior of compatible Gemini models.
2135
+ *
2136
+ * Certain models utilize a thinking process before generating a response. This allows them to
2137
+ * reason through complex problems and plan a more coherent and accurate answer.
2138
+ *
2139
+ * @public
2140
+ */
2141
+ export declare interface ThinkingConfig {
2142
+ /**
2143
+ * The thinking budget, in tokens.
2144
+ *
2145
+ * This parameter sets an upper limit on the number of tokens the model can use for its internal
2146
+ * "thinking" process. A higher budget may result in higher quality responses for complex tasks
2147
+ * but can also increase latency and cost.
2148
+ *
2149
+ * If you don't specify a budget, the model will determine the appropriate amount
2150
+ * of thinking based on the complexity of the prompt.
2151
+ *
2152
+ * An error will be thrown if you set a thinking budget for a model that does not support this
2153
+ * feature or if the specified budget is not within the model's supported range.
2154
+ */
2155
+ thinkingBudget?: number;
2156
+ }
2157
+
1974
2158
  /**
1975
2159
  * Defines a tool that model can call to access external knowledge.
1976
2160
  * @public
1977
2161
  */
1978
- export declare type Tool = FunctionDeclarationsTool;
2162
+ export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool;
1979
2163
 
1980
2164
  /**
1981
2165
  * Tool config. This config is shared for all tools provided in the request.
@@ -1999,6 +2183,10 @@ export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema |
1999
2183
  export declare interface UsageMetadata {
2000
2184
  promptTokenCount: number;
2001
2185
  candidatesTokenCount: number;
2186
+ /**
2187
+ * The number of tokens used by the model's internal "thinking" process.
2188
+ */
2189
+ thoughtsTokenCount?: number;
2002
2190
  totalTokenCount: number;
2003
2191
  promptTokensDetails?: ModalityTokenCount[];
2004
2192
  candidatesTokensDetails?: ModalityTokenCount[];
@@ -2096,4 +2284,31 @@ export declare interface WebAttribution {
2096
2284
  title: string;
2097
2285
  }
2098
2286
 
2287
+ /**
2288
+ * A grounding chunk from the web.
2289
+ *
2290
+ * Important: If using Grounding with Google Search, you are required to comply with the
2291
+ * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search".
2292
+ *
2293
+ * @public
2294
+ */
2295
+ export declare interface WebGroundingChunk {
2296
+ /**
2297
+ * The URI of the retrieved web page.
2298
+ */
2299
+ uri?: string;
2300
+ /**
2301
+ * The title of the retrieved web page.
2302
+ */
2303
+ title?: string;
2304
+ /**
2305
+ * The domain of the original URI from which the content was retrieved.
2306
+ *
2307
+ * This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}).
2308
+ * When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be
2309
+ * `undefined`.
2310
+ */
2311
+ domain?: string;
2312
+ }
2313
+
2099
2314
  export { }
@@ -5,7 +5,7 @@ import { Logger } from '@firebase/logger';
5
5
  import { __asyncGenerator, __await } from 'tslib';
6
6
 
7
7
  var name = "@firebase/ai";
8
- var version = "1.4.0-canary.5d13166dc";
8
+ var version = "1.4.0-canary.6ab4e13a1";
9
9
 
10
10
  /**
11
11
  * @license
@@ -996,6 +996,7 @@ async function makeRequest(model, task, apiSettings, stream, body, requestOption
996
996
  // ignored
997
997
  }
998
998
  if (response.status === 403 &&
999
+ errorDetails &&
999
1000
  errorDetails.some((detail) => detail.reason === 'SERVICE_DISABLED') &&
1000
1001
  errorDetails.some((detail) => {
1001
1002
  var _a, _b;
@@ -1575,6 +1576,8 @@ function aggregateResponses(responses) {
1575
1576
  candidate.finishMessage;
1576
1577
  aggregatedResponse.candidates[i].safetyRatings =
1577
1578
  candidate.safetyRatings;
1579
+ aggregatedResponse.candidates[i].groundingMetadata =
1580
+ candidate.groundingMetadata;
1578
1581
  /**
1579
1582
  * Candidates should always have content and parts, but this handles
1580
1583
  * possible malformed responses.