@firebase/ai 1.4.0-canary.a4ccd254d → 1.4.0-canary.ae976d029

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.
@@ -857,42 +857,6 @@ export declare class GoogleAIBackend extends Backend {
857
857
 
858
858
  /* Excluded from this release type: GoogleAIGenerateContentResponse */
859
859
 
860
- /**
861
- * Specifies the Google Search configuration.
862
- *
863
- * @remarks Currently, this is an empty object, but it's reserved for future configuration options.
864
- *
865
- * @public
866
- */
867
- export declare interface GoogleSearch {
868
- }
869
-
870
- /**
871
- * A tool that allows a Gemini model to connect to Google Search to access and incorporate
872
- * up-to-date information from the web into its responses.
873
- *
874
- * Important: If using Grounding with Google Search, you are required to comply with the
875
- * "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}
876
- * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
877
- * section within the Service Specific Terms).
878
- *
879
- * @public
880
- */
881
- export declare interface GoogleSearchTool {
882
- /**
883
- * Specifies the Google Search configuration.
884
- * Currently, this is an empty object, but it's reserved for future configuration options.
885
- * Specifies the Google Search configuration. Currently, this is an empty object, but it's
886
- * reserved for future configuration options.
887
- *
888
- * When using this feature, you are required to comply with the "Grounding with Google Search"
889
- * usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
890
- * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
891
- * section within the Service Specific Terms).
892
- */
893
- googleSearch: GoogleSearch;
894
- }
895
-
896
860
  /**
897
861
  * @deprecated
898
862
  * @public
@@ -905,83 +869,18 @@ export declare interface GroundingAttribution {
905
869
  }
906
870
 
907
871
  /**
908
- * Represents a chunk of retrieved data that supports a claim in the model's response. This is part
909
- * of the grounding information provided when grounding is enabled.
910
- *
911
- * @public
912
- */
913
- export declare interface GroundingChunk {
914
- /**
915
- * Contains details if the grounding chunk is from a web source.
916
- */
917
- web?: WebGroundingChunk;
918
- }
919
-
920
- /**
921
- * Metadata returned when grounding is enabled.
922
- *
923
- * Currently, only Grounding with Google Search is supported (see {@link GoogleSearchTool}).
924
- *
925
- * Important: If using Grounding with Google Search, you are required to comply with the
926
- * "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}
927
- * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
928
- * section within the Service Specific Terms).
929
- *
872
+ * Metadata returned to client when grounding is enabled.
930
873
  * @public
931
874
  */
932
875
  export declare interface GroundingMetadata {
933
- /**
934
- * Google Search entry point for web searches. This contains an HTML/CSS snippet that must be
935
- * embedded in an app to display a Google Search entry point for follow-up web searches related to
936
- * a model's “Grounded Response”.
937
- */
938
- searchEntryPoint?: SearchEntrypoint;
939
- /**
940
- * A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content
941
- * (for example, from a web page). that the model used to ground its response.
942
- */
943
- groundingChunks?: GroundingChunk[];
944
- /**
945
- * A list of {@link GroundingSupport} objects. Each object details how specific segments of the
946
- * model's response are supported by the `groundingChunks`.
947
- */
948
- groundingSupports?: GroundingSupport[];
949
- /**
950
- * A list of web search queries that the model performed to gather the grounding information.
951
- * These can be used to allow users to explore the search results themselves.
952
- */
953
876
  webSearchQueries?: string[];
954
- /**
955
- * @deprecated Use {@link GroundingSupport} instead.
956
- */
957
877
  retrievalQueries?: string[];
958
878
  /**
959
- * @deprecated Use {@link GroundingChunk} instead.
879
+ * @deprecated
960
880
  */
961
881
  groundingAttributions: GroundingAttribution[];
962
882
  }
963
883
 
964
- /**
965
- * Provides information about how a specific segment of the model's response is supported by the
966
- * retrieved grounding chunks.
967
- *
968
- * @public
969
- */
970
- export declare interface GroundingSupport {
971
- /**
972
- * Specifies the segment of the model's response content that this grounding support pertains to.
973
- */
974
- segment?: Segment;
975
- /**
976
- * A list of indices that refer to specific {@link GroundingChunk} objects within the
977
- * {@link GroundingMetadata.groundingChunks} array. These referenced chunks
978
- * are the sources that support the claim made in the associated `segment` of the response.
979
- * For example, an array `[1, 3, 4]` means that `groundingChunks[1]`, `groundingChunks[3]`,
980
- * and `groundingChunks[4]` are the retrieved content supporting this part of the response.
981
- */
982
- groundingChunkIndices?: number[];
983
- }
984
-
985
884
  /**
986
885
  * This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
987
886
  *
@@ -1938,58 +1837,12 @@ export declare enum SchemaType {
1938
1837
  }
1939
1838
 
1940
1839
  /**
1941
- * Google search entry point.
1942
- *
1943
- * @public
1944
- */
1945
- export declare interface SearchEntrypoint {
1946
- /**
1947
- * HTML/CSS snippet that must be embedded in a web page. The snippet is designed to avoid
1948
- * undesired interaction with the rest of the page's CSS.
1949
- *
1950
- * To ensure proper rendering and prevent CSS conflicts, it is recommended
1951
- * to encapsulate this `renderedContent` within a shadow DOM when embedding it
1952
- * into a webpage. See {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM | MDN: Using shadow DOM}.
1953
- *
1954
- * @example
1955
- * ```javascript
1956
- * const container = document.createElement('div');
1957
- * document.body.appendChild(container);
1958
- * container.attachShadow({ mode: 'open' }).innerHTML = renderedContent;
1959
- * ```
1960
- */
1961
- renderedContent?: string;
1962
- }
1963
-
1964
- /**
1965
- * Represents a specific segment within a {@link Content} object, often used to
1966
- * pinpoint the exact location of text or data that grounding information refers to.
1967
- *
1968
1840
  * @public
1969
1841
  */
1970
1842
  export declare interface Segment {
1971
- /**
1972
- * The zero-based index of the {@link Part} object within the `parts` array
1973
- * of its parent {@link Content} object. This identifies which part of the
1974
- * content the segment belongs to.
1975
- */
1976
1843
  partIndex: number;
1977
- /**
1978
- * The zero-based start index of the segment within the specified `Part`,
1979
- * measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the
1980
- * beginning of the part's content (e.g., `Part.text`).
1981
- */
1982
1844
  startIndex: number;
1983
- /**
1984
- * The zero-based end index of the segment within the specified `Part`,
1985
- * measured in UTF-8 bytes. This offset is exclusive, meaning the character
1986
- * at this index is not included in the segment.
1987
- */
1988
1845
  endIndex: number;
1989
- /**
1990
- * The text corresponding to the segment from the response.
1991
- */
1992
- text: string;
1993
1846
  }
1994
1847
 
1995
1848
  /**
@@ -2029,7 +1882,7 @@ export declare interface TextPart {
2029
1882
  * Defines a tool that model can call to access external knowledge.
2030
1883
  * @public
2031
1884
  */
2032
- export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool;
1885
+ export declare type Tool = FunctionDeclarationsTool;
2033
1886
 
2034
1887
  /**
2035
1888
  * Tool config. This config is shared for all tools provided in the request.
@@ -2150,31 +2003,4 @@ export declare interface WebAttribution {
2150
2003
  title: string;
2151
2004
  }
2152
2005
 
2153
- /**
2154
- * A grounding chunk from the web.
2155
- *
2156
- * Important: If using Grounding with Google Search, you are required to comply with the
2157
- * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search".
2158
- *
2159
- * @public
2160
- */
2161
- export declare interface WebGroundingChunk {
2162
- /**
2163
- * The URI of the retrieved web page.
2164
- */
2165
- uri?: string;
2166
- /**
2167
- * The title of the retrieved web page.
2168
- */
2169
- title?: string;
2170
- /**
2171
- * The domain of the original URI from which the content was retrieved.
2172
- *
2173
- * This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}).
2174
- * When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be
2175
- * `undefined`.
2176
- */
2177
- domain?: string;
2178
- }
2179
-
2180
2006
  export { }
package/dist/ai.d.ts CHANGED
@@ -928,42 +928,6 @@ export declare interface GoogleAIGenerateContentResponse {
928
928
  usageMetadata?: UsageMetadata;
929
929
  }
930
930
 
931
- /**
932
- * Specifies the Google Search configuration.
933
- *
934
- * @remarks Currently, this is an empty object, but it's reserved for future configuration options.
935
- *
936
- * @public
937
- */
938
- export declare interface GoogleSearch {
939
- }
940
-
941
- /**
942
- * A tool that allows a Gemini model to connect to Google Search to access and incorporate
943
- * up-to-date information from the web into its responses.
944
- *
945
- * Important: If using Grounding with Google Search, you are required to comply with the
946
- * "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}
947
- * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
948
- * section within the Service Specific Terms).
949
- *
950
- * @public
951
- */
952
- export declare interface GoogleSearchTool {
953
- /**
954
- * Specifies the Google Search configuration.
955
- * Currently, this is an empty object, but it's reserved for future configuration options.
956
- * Specifies the Google Search configuration. Currently, this is an empty object, but it's
957
- * reserved for future configuration options.
958
- *
959
- * When using this feature, you are required to comply with the "Grounding with Google Search"
960
- * usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
961
- * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
962
- * section within the Service Specific Terms).
963
- */
964
- googleSearch: GoogleSearch;
965
- }
966
-
967
931
  /**
968
932
  * @deprecated
969
933
  * @public
@@ -976,83 +940,18 @@ export declare interface GroundingAttribution {
976
940
  }
977
941
 
978
942
  /**
979
- * Represents a chunk of retrieved data that supports a claim in the model's response. This is part
980
- * of the grounding information provided when grounding is enabled.
981
- *
982
- * @public
983
- */
984
- export declare interface GroundingChunk {
985
- /**
986
- * Contains details if the grounding chunk is from a web source.
987
- */
988
- web?: WebGroundingChunk;
989
- }
990
-
991
- /**
992
- * Metadata returned when grounding is enabled.
993
- *
994
- * Currently, only Grounding with Google Search is supported (see {@link GoogleSearchTool}).
995
- *
996
- * Important: If using Grounding with Google Search, you are required to comply with the
997
- * "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}
998
- * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
999
- * section within the Service Specific Terms).
1000
- *
943
+ * Metadata returned to client when grounding is enabled.
1001
944
  * @public
1002
945
  */
1003
946
  export declare interface GroundingMetadata {
1004
- /**
1005
- * Google Search entry point for web searches. This contains an HTML/CSS snippet that must be
1006
- * embedded in an app to display a Google Search entry point for follow-up web searches related to
1007
- * a model's “Grounded Response”.
1008
- */
1009
- searchEntryPoint?: SearchEntrypoint;
1010
- /**
1011
- * A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content
1012
- * (for example, from a web page). that the model used to ground its response.
1013
- */
1014
- groundingChunks?: GroundingChunk[];
1015
- /**
1016
- * A list of {@link GroundingSupport} objects. Each object details how specific segments of the
1017
- * model's response are supported by the `groundingChunks`.
1018
- */
1019
- groundingSupports?: GroundingSupport[];
1020
- /**
1021
- * A list of web search queries that the model performed to gather the grounding information.
1022
- * These can be used to allow users to explore the search results themselves.
1023
- */
1024
947
  webSearchQueries?: string[];
1025
- /**
1026
- * @deprecated Use {@link GroundingSupport} instead.
1027
- */
1028
948
  retrievalQueries?: string[];
1029
949
  /**
1030
- * @deprecated Use {@link GroundingChunk} instead.
950
+ * @deprecated
1031
951
  */
1032
952
  groundingAttributions: GroundingAttribution[];
1033
953
  }
1034
954
 
1035
- /**
1036
- * Provides information about how a specific segment of the model's response is supported by the
1037
- * retrieved grounding chunks.
1038
- *
1039
- * @public
1040
- */
1041
- export declare interface GroundingSupport {
1042
- /**
1043
- * Specifies the segment of the model's response content that this grounding support pertains to.
1044
- */
1045
- segment?: Segment;
1046
- /**
1047
- * A list of indices that refer to specific {@link GroundingChunk} objects within the
1048
- * {@link GroundingMetadata.groundingChunks} array. These referenced chunks
1049
- * are the sources that support the claim made in the associated `segment` of the response.
1050
- * For example, an array `[1, 3, 4]` means that `groundingChunks[1]`, `groundingChunks[3]`,
1051
- * and `groundingChunks[4]` are the retrieved content supporting this part of the response.
1052
- */
1053
- groundingChunkIndices?: number[];
1054
- }
1055
-
1056
955
  /**
1057
956
  * This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
1058
957
  *
@@ -2036,58 +1935,12 @@ export declare enum SchemaType {
2036
1935
  }
2037
1936
 
2038
1937
  /**
2039
- * Google search entry point.
2040
- *
2041
- * @public
2042
- */
2043
- export declare interface SearchEntrypoint {
2044
- /**
2045
- * HTML/CSS snippet that must be embedded in a web page. The snippet is designed to avoid
2046
- * undesired interaction with the rest of the page's CSS.
2047
- *
2048
- * To ensure proper rendering and prevent CSS conflicts, it is recommended
2049
- * to encapsulate this `renderedContent` within a shadow DOM when embedding it
2050
- * into a webpage. See {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM | MDN: Using shadow DOM}.
2051
- *
2052
- * @example
2053
- * ```javascript
2054
- * const container = document.createElement('div');
2055
- * document.body.appendChild(container);
2056
- * container.attachShadow({ mode: 'open' }).innerHTML = renderedContent;
2057
- * ```
2058
- */
2059
- renderedContent?: string;
2060
- }
2061
-
2062
- /**
2063
- * Represents a specific segment within a {@link Content} object, often used to
2064
- * pinpoint the exact location of text or data that grounding information refers to.
2065
- *
2066
1938
  * @public
2067
1939
  */
2068
1940
  export declare interface Segment {
2069
- /**
2070
- * The zero-based index of the {@link Part} object within the `parts` array
2071
- * of its parent {@link Content} object. This identifies which part of the
2072
- * content the segment belongs to.
2073
- */
2074
1941
  partIndex: number;
2075
- /**
2076
- * The zero-based start index of the segment within the specified `Part`,
2077
- * measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the
2078
- * beginning of the part's content (e.g., `Part.text`).
2079
- */
2080
1942
  startIndex: number;
2081
- /**
2082
- * The zero-based end index of the segment within the specified `Part`,
2083
- * measured in UTF-8 bytes. This offset is exclusive, meaning the character
2084
- * at this index is not included in the segment.
2085
- */
2086
1943
  endIndex: number;
2087
- /**
2088
- * The text corresponding to the segment from the response.
2089
- */
2090
- text: string;
2091
1944
  }
2092
1945
 
2093
1946
  /**
@@ -2130,7 +1983,7 @@ export declare interface TextPart {
2130
1983
  * Defines a tool that model can call to access external knowledge.
2131
1984
  * @public
2132
1985
  */
2133
- export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool;
1986
+ export declare type Tool = FunctionDeclarationsTool;
2134
1987
 
2135
1988
  /**
2136
1989
  * Tool config. This config is shared for all tools provided in the request.
@@ -2251,31 +2104,4 @@ export declare interface WebAttribution {
2251
2104
  title: string;
2252
2105
  }
2253
2106
 
2254
- /**
2255
- * A grounding chunk from the web.
2256
- *
2257
- * Important: If using Grounding with Google Search, you are required to comply with the
2258
- * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search".
2259
- *
2260
- * @public
2261
- */
2262
- export declare interface WebGroundingChunk {
2263
- /**
2264
- * The URI of the retrieved web page.
2265
- */
2266
- uri?: string;
2267
- /**
2268
- * The title of the retrieved web page.
2269
- */
2270
- title?: string;
2271
- /**
2272
- * The domain of the original URI from which the content was retrieved.
2273
- *
2274
- * This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}).
2275
- * When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be
2276
- * `undefined`.
2277
- */
2278
- domain?: string;
2279
- }
2280
-
2281
2107
  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.a4ccd254d";
8
+ var version = "1.4.0-canary.ae976d029";
9
9
 
10
10
  /**
11
11
  * @license
@@ -996,7 +996,6 @@ async function makeRequest(model, task, apiSettings, stream, body, requestOption
996
996
  // ignored
997
997
  }
998
998
  if (response.status === 403 &&
999
- errorDetails &&
1000
999
  errorDetails.some((detail) => detail.reason === 'SERVICE_DISABLED') &&
1001
1000
  errorDetails.some((detail) => {
1002
1001
  var _a, _b;
@@ -1576,8 +1575,6 @@ function aggregateResponses(responses) {
1576
1575
  candidate.finishMessage;
1577
1576
  aggregatedResponse.candidates[i].safetyRatings =
1578
1577
  candidate.safetyRatings;
1579
- aggregatedResponse.candidates[i].groundingMetadata =
1580
- candidate.groundingMetadata;
1581
1578
  /**
1582
1579
  * Candidates should always have content and parts, but this handles
1583
1580
  * possible malformed responses.