@firebase/ai 1.4.0-canary.c0617a341 → 1.4.0-canary.ec5f37403
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 +225 -71
- package/dist/ai.d.ts +225 -71
- package/dist/esm/index.esm2017.js +5 -46
- package/dist/esm/index.esm2017.js.map +1 -1
- package/dist/esm/src/api.d.ts +2 -38
- package/dist/esm/src/public-types.d.ts +0 -18
- package/dist/esm/src/types/requests.d.ts +68 -6
- package/dist/esm/src/types/responses.d.ts +148 -11
- package/dist/esm/src/types/schema.d.ts +11 -3
- package/dist/index.cjs.js +4 -48
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +4 -48
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +5 -46
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/api.d.ts +2 -38
- package/dist/src/public-types.d.ts +0 -18
- package/dist/src/types/requests.d.ts +68 -6
- package/dist/src/types/responses.d.ts +148 -11
- package/dist/src/types/schema.d.ts +11 -3
- package/package.json +8 -8
package/dist/ai.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare class AIError extends FirebaseError {
|
|
|
58
58
|
*
|
|
59
59
|
* @public
|
|
60
60
|
*/
|
|
61
|
-
declare const enum AIErrorCode {
|
|
61
|
+
export declare const enum AIErrorCode {
|
|
62
62
|
/** A generic error occurred. */
|
|
63
63
|
ERROR = "error",
|
|
64
64
|
/** An error occurred in a request. */
|
|
@@ -86,8 +86,6 @@ declare const enum AIErrorCode {
|
|
|
86
86
|
/** An error occurred due an attempt to use an unsupported feature. */
|
|
87
87
|
UNSUPPORTED = "unsupported"
|
|
88
88
|
}
|
|
89
|
-
export { AIErrorCode }
|
|
90
|
-
export { AIErrorCode as VertexAIErrorCode }
|
|
91
89
|
|
|
92
90
|
/**
|
|
93
91
|
* Base class for Firebase AI model APIs.
|
|
@@ -383,11 +381,10 @@ export declare interface CountTokensResponse {
|
|
|
383
381
|
*/
|
|
384
382
|
totalTokens: number;
|
|
385
383
|
/**
|
|
384
|
+
* @deprecated Use `totalTokens` instead. This property is undefined when using models greater than `gemini-1.5-*`.
|
|
385
|
+
*
|
|
386
386
|
* The total number of billable characters counted across all instances
|
|
387
387
|
* from the request.
|
|
388
|
-
*
|
|
389
|
-
* This property is only supported when using the Vertex AI Gemini API ({@link VertexAIBackend}).
|
|
390
|
-
* When using the Gemini Developer API ({@link GoogleAIBackend}), this property is not supported and will default to 0.
|
|
391
388
|
*/
|
|
392
389
|
totalBillableCharacters?: number;
|
|
393
390
|
/**
|
|
@@ -606,7 +603,7 @@ export declare interface FunctionDeclaration {
|
|
|
606
603
|
* format. Reflects the Open API 3.03 Parameter Object. Parameter names are
|
|
607
604
|
* case-sensitive. For a function with no parameters, this can be left unset.
|
|
608
605
|
*/
|
|
609
|
-
parameters?:
|
|
606
|
+
parameters?: ObjectSchema | ObjectSchemaRequest;
|
|
610
607
|
}
|
|
611
608
|
|
|
612
609
|
/**
|
|
@@ -753,6 +750,10 @@ export declare interface GenerationConfig {
|
|
|
753
750
|
* @beta
|
|
754
751
|
*/
|
|
755
752
|
responseModalities?: ResponseModality[];
|
|
753
|
+
/**
|
|
754
|
+
* Configuration for "thinking" behavior of compatible Gemini models.
|
|
755
|
+
*/
|
|
756
|
+
thinkingConfig?: ThinkingConfig;
|
|
756
757
|
}
|
|
757
758
|
|
|
758
759
|
/**
|
|
@@ -856,22 +857,6 @@ export declare function getGenerativeModel(ai: AI, modelParams: ModelParams, req
|
|
|
856
857
|
*/
|
|
857
858
|
export declare function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
|
|
858
859
|
|
|
859
|
-
/**
|
|
860
|
-
* @deprecated Use the new {@link getAI | getAI()} instead. The Vertex AI in Firebase SDK has been
|
|
861
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
862
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
863
|
-
*
|
|
864
|
-
* Returns a {@link VertexAI} instance for the given app, configured to use the
|
|
865
|
-
* Vertex AI Gemini API. This instance will be
|
|
866
|
-
* configured to use the Vertex AI Gemini API.
|
|
867
|
-
*
|
|
868
|
-
* @param app - The {@link @firebase/app#FirebaseApp} to use.
|
|
869
|
-
* @param options - Options to configure the Vertex AI instance, including the location.
|
|
870
|
-
*
|
|
871
|
-
* @public
|
|
872
|
-
*/
|
|
873
|
-
export declare function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
|
|
874
|
-
|
|
875
860
|
/**
|
|
876
861
|
* Configuration class for the Gemini Developer API.
|
|
877
862
|
*
|
|
@@ -929,6 +914,42 @@ export declare interface GoogleAIGenerateContentResponse {
|
|
|
929
914
|
usageMetadata?: UsageMetadata;
|
|
930
915
|
}
|
|
931
916
|
|
|
917
|
+
/**
|
|
918
|
+
* Specifies the Google Search configuration.
|
|
919
|
+
*
|
|
920
|
+
* @remarks Currently, this is an empty object, but it's reserved for future configuration options.
|
|
921
|
+
*
|
|
922
|
+
* @public
|
|
923
|
+
*/
|
|
924
|
+
export declare interface GoogleSearch {
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* A tool that allows a Gemini model to connect to Google Search to access and incorporate
|
|
929
|
+
* up-to-date information from the web into its responses.
|
|
930
|
+
*
|
|
931
|
+
* Important: If using Grounding with Google Search, you are required to comply with the
|
|
932
|
+
* "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}
|
|
933
|
+
* or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
|
|
934
|
+
* section within the Service Specific Terms).
|
|
935
|
+
*
|
|
936
|
+
* @public
|
|
937
|
+
*/
|
|
938
|
+
export declare interface GoogleSearchTool {
|
|
939
|
+
/**
|
|
940
|
+
* Specifies the Google Search configuration.
|
|
941
|
+
* Currently, this is an empty object, but it's reserved for future configuration options.
|
|
942
|
+
* Specifies the Google Search configuration. Currently, this is an empty object, but it's
|
|
943
|
+
* reserved for future configuration options.
|
|
944
|
+
*
|
|
945
|
+
* When using this feature, you are required to comply with the "Grounding with Google Search"
|
|
946
|
+
* 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
|
+
googleSearch: GoogleSearch;
|
|
951
|
+
}
|
|
952
|
+
|
|
932
953
|
/**
|
|
933
954
|
* @deprecated
|
|
934
955
|
* @public
|
|
@@ -941,18 +962,83 @@ export declare interface GroundingAttribution {
|
|
|
941
962
|
}
|
|
942
963
|
|
|
943
964
|
/**
|
|
944
|
-
*
|
|
965
|
+
* Represents a chunk of retrieved data that supports a claim in the model's response. This is part
|
|
966
|
+
* of the grounding information provided when grounding is enabled.
|
|
967
|
+
*
|
|
968
|
+
* @public
|
|
969
|
+
*/
|
|
970
|
+
export declare interface GroundingChunk {
|
|
971
|
+
/**
|
|
972
|
+
* Contains details if the grounding chunk is from a web source.
|
|
973
|
+
*/
|
|
974
|
+
web?: WebGroundingChunk;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Metadata returned when grounding is enabled.
|
|
979
|
+
*
|
|
980
|
+
* Currently, only Grounding with Google Search is supported (see {@link GoogleSearchTool}).
|
|
981
|
+
*
|
|
982
|
+
* Important: If using Grounding with Google Search, you are required to comply with the
|
|
983
|
+
* "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}
|
|
984
|
+
* or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
|
|
985
|
+
* section within the Service Specific Terms).
|
|
986
|
+
*
|
|
945
987
|
* @public
|
|
946
988
|
*/
|
|
947
989
|
export declare interface GroundingMetadata {
|
|
990
|
+
/**
|
|
991
|
+
* Google Search entry point for web searches. This contains an HTML/CSS snippet that must be
|
|
992
|
+
* embedded in an app to display a Google Search entry point for follow-up web searches related to
|
|
993
|
+
* a model's “Grounded Response”.
|
|
994
|
+
*/
|
|
995
|
+
searchEntryPoint?: SearchEntrypoint;
|
|
996
|
+
/**
|
|
997
|
+
* A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content
|
|
998
|
+
* (for example, from a web page). that the model used to ground its response.
|
|
999
|
+
*/
|
|
1000
|
+
groundingChunks?: GroundingChunk[];
|
|
1001
|
+
/**
|
|
1002
|
+
* A list of {@link GroundingSupport} objects. Each object details how specific segments of the
|
|
1003
|
+
* model's response are supported by the `groundingChunks`.
|
|
1004
|
+
*/
|
|
1005
|
+
groundingSupports?: GroundingSupport[];
|
|
1006
|
+
/**
|
|
1007
|
+
* A list of web search queries that the model performed to gather the grounding information.
|
|
1008
|
+
* These can be used to allow users to explore the search results themselves.
|
|
1009
|
+
*/
|
|
948
1010
|
webSearchQueries?: string[];
|
|
1011
|
+
/**
|
|
1012
|
+
* @deprecated Use {@link GroundingSupport} instead.
|
|
1013
|
+
*/
|
|
949
1014
|
retrievalQueries?: string[];
|
|
950
1015
|
/**
|
|
951
|
-
* @deprecated
|
|
1016
|
+
* @deprecated Use {@link GroundingChunk} instead.
|
|
952
1017
|
*/
|
|
953
1018
|
groundingAttributions: GroundingAttribution[];
|
|
954
1019
|
}
|
|
955
1020
|
|
|
1021
|
+
/**
|
|
1022
|
+
* Provides information about how a specific segment of the model's response is supported by the
|
|
1023
|
+
* retrieved grounding chunks.
|
|
1024
|
+
*
|
|
1025
|
+
* @public
|
|
1026
|
+
*/
|
|
1027
|
+
export declare interface GroundingSupport {
|
|
1028
|
+
/**
|
|
1029
|
+
* Specifies the segment of the model's response content that this grounding support pertains to.
|
|
1030
|
+
*/
|
|
1031
|
+
segment?: Segment;
|
|
1032
|
+
/**
|
|
1033
|
+
* A list of indices that refer to specific {@link GroundingChunk} objects within the
|
|
1034
|
+
* {@link GroundingMetadata.groundingChunks} array. These referenced chunks
|
|
1035
|
+
* are the sources that support the claim made in the associated `segment` of the response.
|
|
1036
|
+
* For example, an array `[1, 3, 4]` means that `groundingChunks[1]`, `groundingChunks[3]`,
|
|
1037
|
+
* and `groundingChunks[4]` are the retrieved content supporting this part of the response.
|
|
1038
|
+
*/
|
|
1039
|
+
groundingChunkIndices?: number[];
|
|
1040
|
+
}
|
|
1041
|
+
|
|
956
1042
|
/**
|
|
957
1043
|
* This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
|
|
958
1044
|
*
|
|
@@ -1593,12 +1679,20 @@ export declare class ObjectSchema extends Schema {
|
|
|
1593
1679
|
}
|
|
1594
1680
|
|
|
1595
1681
|
/**
|
|
1596
|
-
* Interface for {@link
|
|
1682
|
+
* Interface for JSON parameters in {@link SchemaType.OBJECT} format when
|
|
1683
|
+
* not using the {@link ObjectSchema} helper.
|
|
1597
1684
|
* @public
|
|
1598
1685
|
*/
|
|
1599
|
-
export declare interface
|
|
1686
|
+
export declare interface ObjectSchemaRequest extends SchemaRequest {
|
|
1600
1687
|
type: SchemaType.OBJECT;
|
|
1601
|
-
|
|
1688
|
+
/**
|
|
1689
|
+
* This is not a property accepted in the final request to the backend, but is
|
|
1690
|
+
* a client-side convenience property that is only usable by constructing
|
|
1691
|
+
* a schema through the `Schema.object()` helper method. Populating this
|
|
1692
|
+
* property will cause response errors if the object is not wrapped with
|
|
1693
|
+
* `Schema.object()`.
|
|
1694
|
+
*/
|
|
1695
|
+
optionalProperties?: never;
|
|
1602
1696
|
}
|
|
1603
1697
|
|
|
1604
1698
|
/**
|
|
@@ -1928,12 +2022,58 @@ export declare enum SchemaType {
|
|
|
1928
2022
|
}
|
|
1929
2023
|
|
|
1930
2024
|
/**
|
|
2025
|
+
* Google search entry point.
|
|
2026
|
+
*
|
|
2027
|
+
* @public
|
|
2028
|
+
*/
|
|
2029
|
+
export declare interface SearchEntrypoint {
|
|
2030
|
+
/**
|
|
2031
|
+
* HTML/CSS snippet that must be embedded in a web page. The snippet is designed to avoid
|
|
2032
|
+
* undesired interaction with the rest of the page's CSS.
|
|
2033
|
+
*
|
|
2034
|
+
* To ensure proper rendering and prevent CSS conflicts, it is recommended
|
|
2035
|
+
* to encapsulate this `renderedContent` within a shadow DOM when embedding it
|
|
2036
|
+
* into a webpage. See {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM | MDN: Using shadow DOM}.
|
|
2037
|
+
*
|
|
2038
|
+
* @example
|
|
2039
|
+
* ```javascript
|
|
2040
|
+
* const container = document.createElement('div');
|
|
2041
|
+
* document.body.appendChild(container);
|
|
2042
|
+
* container.attachShadow({ mode: 'open' }).innerHTML = renderedContent;
|
|
2043
|
+
* ```
|
|
2044
|
+
*/
|
|
2045
|
+
renderedContent?: string;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
/**
|
|
2049
|
+
* Represents a specific segment within a {@link Content} object, often used to
|
|
2050
|
+
* pinpoint the exact location of text or data that grounding information refers to.
|
|
2051
|
+
*
|
|
1931
2052
|
* @public
|
|
1932
2053
|
*/
|
|
1933
2054
|
export declare interface Segment {
|
|
2055
|
+
/**
|
|
2056
|
+
* The zero-based index of the {@link Part} object within the `parts` array
|
|
2057
|
+
* of its parent {@link Content} object. This identifies which part of the
|
|
2058
|
+
* content the segment belongs to.
|
|
2059
|
+
*/
|
|
1934
2060
|
partIndex: number;
|
|
2061
|
+
/**
|
|
2062
|
+
* The zero-based start index of the segment within the specified `Part`,
|
|
2063
|
+
* measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the
|
|
2064
|
+
* beginning of the part's content (e.g., `Part.text`).
|
|
2065
|
+
*/
|
|
1935
2066
|
startIndex: number;
|
|
2067
|
+
/**
|
|
2068
|
+
* The zero-based end index of the segment within the specified `Part`,
|
|
2069
|
+
* measured in UTF-8 bytes. This offset is exclusive, meaning the character
|
|
2070
|
+
* at this index is not included in the segment.
|
|
2071
|
+
*/
|
|
1936
2072
|
endIndex: number;
|
|
2073
|
+
/**
|
|
2074
|
+
* The text corresponding to the segment from the response.
|
|
2075
|
+
*/
|
|
2076
|
+
text: string;
|
|
1937
2077
|
}
|
|
1938
2078
|
|
|
1939
2079
|
/**
|
|
@@ -1972,11 +2112,36 @@ export declare interface TextPart {
|
|
|
1972
2112
|
functionResponse?: never;
|
|
1973
2113
|
}
|
|
1974
2114
|
|
|
2115
|
+
/**
|
|
2116
|
+
* Configuration for "thinking" behavior of compatible Gemini models.
|
|
2117
|
+
*
|
|
2118
|
+
* Certain models utilize a thinking process before generating a response. This allows them to
|
|
2119
|
+
* reason through complex problems and plan a more coherent and accurate answer.
|
|
2120
|
+
*
|
|
2121
|
+
* @public
|
|
2122
|
+
*/
|
|
2123
|
+
export declare interface ThinkingConfig {
|
|
2124
|
+
/**
|
|
2125
|
+
* The thinking budget, in tokens.
|
|
2126
|
+
*
|
|
2127
|
+
* This parameter sets an upper limit on the number of tokens the model can use for its internal
|
|
2128
|
+
* "thinking" process. A higher budget may result in higher quality responses for complex tasks
|
|
2129
|
+
* but can also increase latency and cost.
|
|
2130
|
+
*
|
|
2131
|
+
* If you don't specify a budget, the model will determine the appropriate amount
|
|
2132
|
+
* of thinking based on the complexity of the prompt.
|
|
2133
|
+
*
|
|
2134
|
+
* An error will be thrown if you set a thinking budget for a model that does not support this
|
|
2135
|
+
* feature or if the specified budget is not within the model's supported range.
|
|
2136
|
+
*/
|
|
2137
|
+
thinkingBudget?: number;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
1975
2140
|
/**
|
|
1976
2141
|
* Defines a tool that model can call to access external knowledge.
|
|
1977
2142
|
* @public
|
|
1978
2143
|
*/
|
|
1979
|
-
export declare type Tool = FunctionDeclarationsTool;
|
|
2144
|
+
export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool;
|
|
1980
2145
|
|
|
1981
2146
|
/**
|
|
1982
2147
|
* Tool config. This config is shared for all tools provided in the request.
|
|
@@ -2000,22 +2165,15 @@ export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema |
|
|
|
2000
2165
|
export declare interface UsageMetadata {
|
|
2001
2166
|
promptTokenCount: number;
|
|
2002
2167
|
candidatesTokenCount: number;
|
|
2168
|
+
/**
|
|
2169
|
+
* The number of tokens used by the model's internal "thinking" process.
|
|
2170
|
+
*/
|
|
2171
|
+
thoughtsTokenCount?: number;
|
|
2003
2172
|
totalTokenCount: number;
|
|
2004
2173
|
promptTokensDetails?: ModalityTokenCount[];
|
|
2005
2174
|
candidatesTokensDetails?: ModalityTokenCount[];
|
|
2006
2175
|
}
|
|
2007
2176
|
|
|
2008
|
-
/**
|
|
2009
|
-
* @deprecated Use the new {@link AI | AI} instead. The Vertex AI in Firebase SDK has been
|
|
2010
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
2011
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
2012
|
-
*
|
|
2013
|
-
* An instance of the Firebase AI SDK.
|
|
2014
|
-
*
|
|
2015
|
-
* @public
|
|
2016
|
-
*/
|
|
2017
|
-
export declare type VertexAI = AI;
|
|
2018
|
-
|
|
2019
2177
|
/**
|
|
2020
2178
|
* Configuration class for the Vertex AI Gemini API.
|
|
2021
2179
|
*
|
|
@@ -2041,37 +2199,6 @@ export declare class VertexAIBackend extends Backend {
|
|
|
2041
2199
|
constructor(location?: string);
|
|
2042
2200
|
}
|
|
2043
2201
|
|
|
2044
|
-
/**
|
|
2045
|
-
* @deprecated Use the new {@link AIError} instead. The Vertex AI in Firebase SDK has been
|
|
2046
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
2047
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
2048
|
-
*
|
|
2049
|
-
* Error class for the Firebase AI SDK.
|
|
2050
|
-
*
|
|
2051
|
-
* @public
|
|
2052
|
-
*/
|
|
2053
|
-
export declare const VertexAIError: typeof AIError;
|
|
2054
|
-
|
|
2055
|
-
/**
|
|
2056
|
-
* @deprecated Use the new {@link AIModel} instead. The Vertex AI in Firebase SDK has been
|
|
2057
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
2058
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
2059
|
-
*
|
|
2060
|
-
* Base class for Firebase AI model APIs.
|
|
2061
|
-
*
|
|
2062
|
-
* @public
|
|
2063
|
-
*/
|
|
2064
|
-
export declare const VertexAIModel: typeof AIModel;
|
|
2065
|
-
|
|
2066
|
-
/**
|
|
2067
|
-
* Options when initializing the Firebase AI SDK.
|
|
2068
|
-
*
|
|
2069
|
-
* @public
|
|
2070
|
-
*/
|
|
2071
|
-
export declare interface VertexAIOptions {
|
|
2072
|
-
location?: string;
|
|
2073
|
-
}
|
|
2074
|
-
|
|
2075
2202
|
/**
|
|
2076
2203
|
* Describes the input video content.
|
|
2077
2204
|
* @public
|
|
@@ -2097,4 +2224,31 @@ export declare interface WebAttribution {
|
|
|
2097
2224
|
title: string;
|
|
2098
2225
|
}
|
|
2099
2226
|
|
|
2227
|
+
/**
|
|
2228
|
+
* A grounding chunk from the web.
|
|
2229
|
+
*
|
|
2230
|
+
* Important: If using Grounding with Google Search, you are required to comply with the
|
|
2231
|
+
* {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search".
|
|
2232
|
+
*
|
|
2233
|
+
* @public
|
|
2234
|
+
*/
|
|
2235
|
+
export declare interface WebGroundingChunk {
|
|
2236
|
+
/**
|
|
2237
|
+
* The URI of the retrieved web page.
|
|
2238
|
+
*/
|
|
2239
|
+
uri?: string;
|
|
2240
|
+
/**
|
|
2241
|
+
* The title of the retrieved web page.
|
|
2242
|
+
*/
|
|
2243
|
+
title?: string;
|
|
2244
|
+
/**
|
|
2245
|
+
* The domain of the original URI from which the content was retrieved.
|
|
2246
|
+
*
|
|
2247
|
+
* This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}).
|
|
2248
|
+
* When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be
|
|
2249
|
+
* `undefined`.
|
|
2250
|
+
*/
|
|
2251
|
+
domain?: string;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2100
2254
|
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.
|
|
8
|
+
var version = "1.4.0-canary.ec5f37403";
|
|
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.
|
|
@@ -2488,50 +2491,6 @@ class ImagenImageFormat {
|
|
|
2488
2491
|
* See the License for the specific language governing permissions and
|
|
2489
2492
|
* limitations under the License.
|
|
2490
2493
|
*/
|
|
2491
|
-
/**
|
|
2492
|
-
* @deprecated Use the new {@link AIModel} instead. The Vertex AI in Firebase SDK has been
|
|
2493
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
2494
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
2495
|
-
*
|
|
2496
|
-
* Base class for Firebase AI model APIs.
|
|
2497
|
-
*
|
|
2498
|
-
* @public
|
|
2499
|
-
*/
|
|
2500
|
-
const VertexAIModel = AIModel;
|
|
2501
|
-
/**
|
|
2502
|
-
* @deprecated Use the new {@link AIError} instead. The Vertex AI in Firebase SDK has been
|
|
2503
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
2504
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
2505
|
-
*
|
|
2506
|
-
* Error class for the Firebase AI SDK.
|
|
2507
|
-
*
|
|
2508
|
-
* @public
|
|
2509
|
-
*/
|
|
2510
|
-
const VertexAIError = AIError;
|
|
2511
|
-
/**
|
|
2512
|
-
* @deprecated Use the new {@link getAI | getAI()} instead. The Vertex AI in Firebase SDK has been
|
|
2513
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
2514
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
2515
|
-
*
|
|
2516
|
-
* Returns a {@link VertexAI} instance for the given app, configured to use the
|
|
2517
|
-
* Vertex AI Gemini API. This instance will be
|
|
2518
|
-
* configured to use the Vertex AI Gemini API.
|
|
2519
|
-
*
|
|
2520
|
-
* @param app - The {@link @firebase/app#FirebaseApp} to use.
|
|
2521
|
-
* @param options - Options to configure the Vertex AI instance, including the location.
|
|
2522
|
-
*
|
|
2523
|
-
* @public
|
|
2524
|
-
*/
|
|
2525
|
-
function getVertexAI(app = getApp(), options) {
|
|
2526
|
-
app = getModularInstance(app);
|
|
2527
|
-
// Dependencies
|
|
2528
|
-
const AIProvider = _getProvider(app, AI_TYPE);
|
|
2529
|
-
const backend = new VertexAIBackend(options === null || options === void 0 ? void 0 : options.location);
|
|
2530
|
-
const identifier = encodeInstanceIdentifier(backend);
|
|
2531
|
-
return AIProvider.getImmediate({
|
|
2532
|
-
identifier
|
|
2533
|
-
});
|
|
2534
|
-
}
|
|
2535
2494
|
/**
|
|
2536
2495
|
* Returns the default {@link AI} instance that is associated with the provided
|
|
2537
2496
|
* {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new instance with the
|
|
@@ -2625,5 +2584,5 @@ function registerAI() {
|
|
|
2625
2584
|
}
|
|
2626
2585
|
registerAI();
|
|
2627
2586
|
|
|
2628
|
-
export { AIError, AIModel, ArraySchema, Backend, BackendType, BlockReason, BooleanSchema, ChatSession, FinishReason, FunctionCallingMode, GenerativeModel, GoogleAIBackend, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, ImagenAspectRatio, ImagenImageFormat, ImagenModel, ImagenPersonFilterLevel, ImagenSafetyFilterLevel, IntegerSchema, Modality, NumberSchema, ObjectSchema, POSSIBLE_ROLES, ResponseModality, Schema, SchemaType, StringSchema, VertexAIBackend,
|
|
2587
|
+
export { AIError, AIModel, ArraySchema, Backend, BackendType, BlockReason, BooleanSchema, ChatSession, FinishReason, FunctionCallingMode, GenerativeModel, GoogleAIBackend, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, ImagenAspectRatio, ImagenImageFormat, ImagenModel, ImagenPersonFilterLevel, ImagenSafetyFilterLevel, IntegerSchema, Modality, NumberSchema, ObjectSchema, POSSIBLE_ROLES, ResponseModality, Schema, SchemaType, StringSchema, VertexAIBackend, getAI, getGenerativeModel, getImagenModel };
|
|
2629
2588
|
//# sourceMappingURL=index.esm2017.js.map
|