@depup/firebase__ai 2.9.0-depup.0

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.
Files changed (119) hide show
  1. package/README.md +31 -0
  2. package/changes.json +10 -0
  3. package/dist/ai-public.d.ts +3472 -0
  4. package/dist/ai.d.ts +3712 -0
  5. package/dist/esm/index.esm.js +4765 -0
  6. package/dist/esm/index.esm.js.map +1 -0
  7. package/dist/esm/package.json +1 -0
  8. package/dist/esm/src/api.d.ts +121 -0
  9. package/dist/esm/src/backend.d.ts +98 -0
  10. package/dist/esm/src/constants.d.ts +29 -0
  11. package/dist/esm/src/errors.d.ts +35 -0
  12. package/dist/esm/src/factory-browser.d.ts +19 -0
  13. package/dist/esm/src/factory-node.d.ts +19 -0
  14. package/dist/esm/src/googleai-mappers.d.ts +73 -0
  15. package/dist/esm/src/helpers.d.ts +30 -0
  16. package/dist/esm/src/index.d.ts +13 -0
  17. package/dist/esm/src/index.node.d.ts +7 -0
  18. package/dist/esm/src/logger.d.ts +18 -0
  19. package/dist/esm/src/methods/chat-session-helpers.d.ts +18 -0
  20. package/dist/esm/src/methods/chat-session.d.ts +77 -0
  21. package/dist/esm/src/methods/chrome-adapter.d.ts +124 -0
  22. package/dist/esm/src/methods/count-tokens.d.ts +21 -0
  23. package/dist/esm/src/methods/generate-content.d.ts +25 -0
  24. package/dist/esm/src/methods/live-session-helpers.d.ts +154 -0
  25. package/dist/esm/src/methods/live-session.d.ts +154 -0
  26. package/dist/esm/src/models/ai-model.d.ts +72 -0
  27. package/dist/esm/src/models/generative-model.d.ts +56 -0
  28. package/dist/esm/src/models/imagen-model.d.ts +102 -0
  29. package/dist/esm/src/models/index.d.ts +20 -0
  30. package/dist/esm/src/models/live-generative-model.d.ts +55 -0
  31. package/dist/esm/src/models/template-generative-model.d.ts +64 -0
  32. package/dist/esm/src/models/template-imagen-model.d.ts +51 -0
  33. package/dist/esm/src/models/utils.d.ts +26 -0
  34. package/dist/esm/src/public-types.d.ts +97 -0
  35. package/dist/esm/src/requests/hybrid-helpers.d.ts +33 -0
  36. package/dist/esm/src/requests/imagen-image-format.d.ts +61 -0
  37. package/dist/esm/src/requests/request-helpers.d.ts +28 -0
  38. package/dist/esm/src/requests/request.d.ts +69 -0
  39. package/dist/esm/src/requests/response-helpers.d.ts +57 -0
  40. package/dist/esm/src/requests/schema-builder.d.ts +170 -0
  41. package/dist/esm/src/requests/stream-reader.d.ts +39 -0
  42. package/dist/esm/src/service.d.ts +35 -0
  43. package/dist/esm/src/types/chrome-adapter.d.ts +61 -0
  44. package/dist/esm/src/types/content.d.ts +266 -0
  45. package/dist/esm/src/types/enums.d.ts +419 -0
  46. package/dist/esm/src/types/error.d.ts +89 -0
  47. package/dist/esm/src/types/googleai.d.ts +57 -0
  48. package/dist/esm/src/types/imagen/index.d.ts +18 -0
  49. package/dist/esm/src/types/imagen/internal.d.ts +134 -0
  50. package/dist/esm/src/types/imagen/requests.d.ts +245 -0
  51. package/dist/esm/src/types/imagen/responses.d.ts +79 -0
  52. package/dist/esm/src/types/index.d.ts +26 -0
  53. package/dist/esm/src/types/internal.d.ts +35 -0
  54. package/dist/esm/src/types/language-model.d.ts +107 -0
  55. package/dist/esm/src/types/live-responses.d.ts +79 -0
  56. package/dist/esm/src/types/requests.d.ts +543 -0
  57. package/dist/esm/src/types/responses.d.ts +607 -0
  58. package/dist/esm/src/types/schema.d.ts +139 -0
  59. package/dist/esm/src/websocket.d.ts +67 -0
  60. package/dist/index.cjs.js +4820 -0
  61. package/dist/index.cjs.js.map +1 -0
  62. package/dist/index.node.cjs.js +4512 -0
  63. package/dist/index.node.cjs.js.map +1 -0
  64. package/dist/index.node.mjs +4457 -0
  65. package/dist/index.node.mjs.map +1 -0
  66. package/dist/src/api.d.ts +121 -0
  67. package/dist/src/backend.d.ts +98 -0
  68. package/dist/src/constants.d.ts +29 -0
  69. package/dist/src/errors.d.ts +35 -0
  70. package/dist/src/factory-browser.d.ts +19 -0
  71. package/dist/src/factory-node.d.ts +19 -0
  72. package/dist/src/googleai-mappers.d.ts +73 -0
  73. package/dist/src/helpers.d.ts +30 -0
  74. package/dist/src/index.d.ts +13 -0
  75. package/dist/src/index.node.d.ts +7 -0
  76. package/dist/src/logger.d.ts +18 -0
  77. package/dist/src/methods/chat-session-helpers.d.ts +18 -0
  78. package/dist/src/methods/chat-session.d.ts +77 -0
  79. package/dist/src/methods/chrome-adapter.d.ts +124 -0
  80. package/dist/src/methods/count-tokens.d.ts +21 -0
  81. package/dist/src/methods/generate-content.d.ts +25 -0
  82. package/dist/src/methods/live-session-helpers.d.ts +154 -0
  83. package/dist/src/methods/live-session.d.ts +154 -0
  84. package/dist/src/models/ai-model.d.ts +72 -0
  85. package/dist/src/models/generative-model.d.ts +56 -0
  86. package/dist/src/models/imagen-model.d.ts +102 -0
  87. package/dist/src/models/index.d.ts +20 -0
  88. package/dist/src/models/live-generative-model.d.ts +55 -0
  89. package/dist/src/models/template-generative-model.d.ts +64 -0
  90. package/dist/src/models/template-imagen-model.d.ts +51 -0
  91. package/dist/src/models/utils.d.ts +26 -0
  92. package/dist/src/public-types.d.ts +97 -0
  93. package/dist/src/requests/hybrid-helpers.d.ts +33 -0
  94. package/dist/src/requests/imagen-image-format.d.ts +61 -0
  95. package/dist/src/requests/request-helpers.d.ts +28 -0
  96. package/dist/src/requests/request.d.ts +69 -0
  97. package/dist/src/requests/response-helpers.d.ts +57 -0
  98. package/dist/src/requests/schema-builder.d.ts +170 -0
  99. package/dist/src/requests/stream-reader.d.ts +39 -0
  100. package/dist/src/service.d.ts +35 -0
  101. package/dist/src/tsdoc-metadata.json +11 -0
  102. package/dist/src/types/chrome-adapter.d.ts +61 -0
  103. package/dist/src/types/content.d.ts +266 -0
  104. package/dist/src/types/enums.d.ts +419 -0
  105. package/dist/src/types/error.d.ts +89 -0
  106. package/dist/src/types/googleai.d.ts +57 -0
  107. package/dist/src/types/imagen/index.d.ts +18 -0
  108. package/dist/src/types/imagen/internal.d.ts +134 -0
  109. package/dist/src/types/imagen/requests.d.ts +245 -0
  110. package/dist/src/types/imagen/responses.d.ts +79 -0
  111. package/dist/src/types/index.d.ts +26 -0
  112. package/dist/src/types/internal.d.ts +35 -0
  113. package/dist/src/types/language-model.d.ts +107 -0
  114. package/dist/src/types/live-responses.d.ts +79 -0
  115. package/dist/src/types/requests.d.ts +543 -0
  116. package/dist/src/types/responses.d.ts +607 -0
  117. package/dist/src/types/schema.d.ts +139 -0
  118. package/dist/src/websocket.d.ts +67 -0
  119. package/package.json +106 -0
@@ -0,0 +1,170 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { SchemaInterface, SchemaType, SchemaParams, SchemaRequest } from '../types/schema';
18
+ /**
19
+ * Parent class encompassing all Schema types, with static methods that
20
+ * allow building specific Schema types. This class can be converted with
21
+ * `JSON.stringify()` into a JSON string accepted by Vertex AI REST endpoints.
22
+ * (This string conversion is automatically done when calling SDK methods.)
23
+ * @public
24
+ */
25
+ export declare abstract class Schema implements SchemaInterface {
26
+ /**
27
+ * Optional. The type of the property.
28
+ * This can only be undefined when using `anyOf` schemas, which do not have an
29
+ * explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI specification}.
30
+ */
31
+ type?: SchemaType;
32
+ /** Optional. The format of the property.
33
+ * Supported formats:<br/>
34
+ * <ul>
35
+ * <li>for NUMBER type: "float", "double"</li>
36
+ * <li>for INTEGER type: "int32", "int64"</li>
37
+ * <li>for STRING type: "email", "byte", etc</li>
38
+ * </ul>
39
+ */
40
+ format?: string;
41
+ /** Optional. The description of the property. */
42
+ description?: string;
43
+ /** Optional. The items of the property. */
44
+ items?: SchemaInterface;
45
+ /** The minimum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
46
+ minItems?: number;
47
+ /** The maximum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
48
+ maxItems?: number;
49
+ /** Optional. Whether the property is nullable. Defaults to false. */
50
+ nullable: boolean;
51
+ /** Optional. The example of the property. */
52
+ example?: unknown;
53
+ /**
54
+ * Allows user to add other schema properties that have not yet
55
+ * been officially added to the SDK.
56
+ */
57
+ [key: string]: unknown;
58
+ constructor(schemaParams: SchemaInterface);
59
+ /**
60
+ * Defines how this Schema should be serialized as JSON.
61
+ * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#tojson_behavior
62
+ * @internal
63
+ */
64
+ toJSON(): SchemaRequest;
65
+ static array(arrayParams: SchemaParams & {
66
+ items: Schema;
67
+ }): ArraySchema;
68
+ static object(objectParams: SchemaParams & {
69
+ properties: {
70
+ [k: string]: Schema;
71
+ };
72
+ optionalProperties?: string[];
73
+ }): ObjectSchema;
74
+ static string(stringParams?: SchemaParams): StringSchema;
75
+ static enumString(stringParams: SchemaParams & {
76
+ enum: string[];
77
+ }): StringSchema;
78
+ static integer(integerParams?: SchemaParams): IntegerSchema;
79
+ static number(numberParams?: SchemaParams): NumberSchema;
80
+ static boolean(booleanParams?: SchemaParams): BooleanSchema;
81
+ static anyOf(anyOfParams: SchemaParams & {
82
+ anyOf: TypedSchema[];
83
+ }): AnyOfSchema;
84
+ }
85
+ /**
86
+ * A type that includes all specific Schema types.
87
+ * @public
88
+ */
89
+ export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;
90
+ /**
91
+ * Schema class for "integer" types.
92
+ * @public
93
+ */
94
+ export declare class IntegerSchema extends Schema {
95
+ constructor(schemaParams?: SchemaParams);
96
+ }
97
+ /**
98
+ * Schema class for "number" types.
99
+ * @public
100
+ */
101
+ export declare class NumberSchema extends Schema {
102
+ constructor(schemaParams?: SchemaParams);
103
+ }
104
+ /**
105
+ * Schema class for "boolean" types.
106
+ * @public
107
+ */
108
+ export declare class BooleanSchema extends Schema {
109
+ constructor(schemaParams?: SchemaParams);
110
+ }
111
+ /**
112
+ * Schema class for "string" types. Can be used with or without
113
+ * enum values.
114
+ * @public
115
+ */
116
+ export declare class StringSchema extends Schema {
117
+ enum?: string[];
118
+ constructor(schemaParams?: SchemaParams, enumValues?: string[]);
119
+ /**
120
+ * @internal
121
+ */
122
+ toJSON(): SchemaRequest;
123
+ }
124
+ /**
125
+ * Schema class for "array" types.
126
+ * The `items` param should refer to the type of item that can be a member
127
+ * of the array.
128
+ * @public
129
+ */
130
+ export declare class ArraySchema extends Schema {
131
+ items: TypedSchema;
132
+ constructor(schemaParams: SchemaParams, items: TypedSchema);
133
+ /**
134
+ * @internal
135
+ */
136
+ toJSON(): SchemaRequest;
137
+ }
138
+ /**
139
+ * Schema class for "object" types.
140
+ * The `properties` param must be a map of `Schema` objects.
141
+ * @public
142
+ */
143
+ export declare class ObjectSchema extends Schema {
144
+ properties: {
145
+ [k: string]: TypedSchema;
146
+ };
147
+ optionalProperties: string[];
148
+ constructor(schemaParams: SchemaParams, properties: {
149
+ [k: string]: TypedSchema;
150
+ }, optionalProperties?: string[]);
151
+ /**
152
+ * @internal
153
+ */
154
+ toJSON(): SchemaRequest;
155
+ }
156
+ /**
157
+ * Schema class representing a value that can conform to any of the provided sub-schemas. This is
158
+ * useful when a field can accept multiple distinct types or structures.
159
+ * @public
160
+ */
161
+ export declare class AnyOfSchema extends Schema {
162
+ anyOf: TypedSchema[];
163
+ constructor(schemaParams: SchemaParams & {
164
+ anyOf: TypedSchema[];
165
+ });
166
+ /**
167
+ * @internal
168
+ */
169
+ toJSON(): SchemaRequest;
170
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { GenerateContentResponse, GenerateContentStreamResult } from '../types';
18
+ import { ApiSettings } from '../types/internal';
19
+ import { InferenceSource } from '../public-types';
20
+ /**
21
+ * Process a response.body stream from the backend and return an
22
+ * iterator that provides one complete GenerateContentResponse at a time
23
+ * and a promise that resolves with a single aggregated
24
+ * GenerateContentResponse.
25
+ *
26
+ * @param response - Response from a fetch call
27
+ */
28
+ export declare function processStream(response: Response, apiSettings: ApiSettings, inferenceSource?: InferenceSource): Promise<GenerateContentStreamResult & {
29
+ firstValue?: GenerateContentResponse;
30
+ }>;
31
+ /**
32
+ * Reads a raw string stream, buffers incomplete chunks, and yields parsed JSON objects.
33
+ */
34
+ export declare function getResponseStream<T>(inputStream: ReadableStream<string>): ReadableStream<T>;
35
+ /**
36
+ * Aggregates an array of `GenerateContentResponse`s into a single
37
+ * GenerateContentResponse.
38
+ */
39
+ export declare function aggregateResponses(responses: GenerateContentResponse[]): GenerateContentResponse;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseApp, _FirebaseService } from '@firebase/app';
18
+ import { AI, AIOptions, ChromeAdapter, InferenceMode, OnDeviceParams } from './public-types';
19
+ import { AppCheckInternalComponentName, FirebaseAppCheckInternal } from '@firebase/app-check-interop-types';
20
+ import { Provider } from '@firebase/component';
21
+ import { FirebaseAuthInternal, FirebaseAuthInternalName } from '@firebase/auth-interop-types';
22
+ import { Backend } from './backend';
23
+ export declare class AIService implements AI, _FirebaseService {
24
+ app: FirebaseApp;
25
+ backend: Backend;
26
+ chromeAdapterFactory?: ((mode: InferenceMode, window?: Window, params?: OnDeviceParams) => ChromeAdapter | undefined) | undefined;
27
+ auth: FirebaseAuthInternal | null;
28
+ appCheck: FirebaseAppCheckInternal | null;
29
+ _options?: Omit<AIOptions, 'backend'>;
30
+ location: string;
31
+ constructor(app: FirebaseApp, backend: Backend, authProvider?: Provider<FirebaseAuthInternalName>, appCheckProvider?: Provider<AppCheckInternalComponentName>, chromeAdapterFactory?: ((mode: InferenceMode, window?: Window, params?: OnDeviceParams) => ChromeAdapter | undefined) | undefined);
32
+ _delete(): Promise<void>;
33
+ set options(optionsToSet: AIOptions);
34
+ get options(): AIOptions | undefined;
35
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { InferenceMode } from './enums';
18
+ import { CountTokensRequest, GenerateContentRequest } from './requests';
19
+ /**
20
+ * Defines an inference "backend" that uses Chrome's on-device model,
21
+ * and encapsulates logic for detecting when on-device inference is
22
+ * possible.
23
+ *
24
+ * These methods should not be called directly by the user.
25
+ *
26
+ * @beta
27
+ */
28
+ export interface ChromeAdapter {
29
+ /**
30
+ * @internal
31
+ */
32
+ mode: InferenceMode;
33
+ /**
34
+ * Checks if the on-device model is capable of handling a given
35
+ * request.
36
+ * @param request - A potential request to be passed to the model.
37
+ */
38
+ isAvailable(request: GenerateContentRequest): Promise<boolean>;
39
+ /**
40
+ * Generates content using on-device inference.
41
+ *
42
+ * @remarks
43
+ * This is comparable to {@link GenerativeModel.generateContent} for generating
44
+ * content using in-cloud inference.
45
+ * @param request - a standard Firebase AI {@link GenerateContentRequest}
46
+ */
47
+ generateContent(request: GenerateContentRequest): Promise<Response>;
48
+ /**
49
+ * Generates a content stream using on-device inference.
50
+ *
51
+ * @remarks
52
+ * This is comparable to {@link GenerativeModel.generateContentStream} for generating
53
+ * a content stream using in-cloud inference.
54
+ * @param request - a standard Firebase AI {@link GenerateContentRequest}
55
+ */
56
+ generateContentStream(request: GenerateContentRequest): Promise<Response>;
57
+ /**
58
+ * @internal
59
+ */
60
+ countTokens(request: CountTokensRequest): Promise<Response>;
61
+ }
@@ -0,0 +1,266 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Language, Outcome, Role } from './enums';
18
+ /**
19
+ * Content type for both prompts and response candidates.
20
+ * @public
21
+ */
22
+ export interface Content {
23
+ role: Role;
24
+ parts: Part[];
25
+ }
26
+ /**
27
+ * Content part - includes text, image/video, or function call/response
28
+ * part types.
29
+ * @public
30
+ */
31
+ export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart | ExecutableCodePart | CodeExecutionResultPart;
32
+ /**
33
+ * Content part interface if the part represents a text string.
34
+ * @public
35
+ */
36
+ export interface TextPart {
37
+ text: string;
38
+ inlineData?: never;
39
+ functionCall?: never;
40
+ functionResponse?: never;
41
+ thought?: boolean;
42
+ /**
43
+ * @internal
44
+ */
45
+ thoughtSignature?: string;
46
+ executableCode?: never;
47
+ codeExecutionResult?: never;
48
+ }
49
+ /**
50
+ * Content part interface if the part represents an image.
51
+ * @public
52
+ */
53
+ export interface InlineDataPart {
54
+ text?: never;
55
+ inlineData: GenerativeContentBlob;
56
+ functionCall?: never;
57
+ functionResponse?: never;
58
+ /**
59
+ * Applicable if `inlineData` is a video.
60
+ */
61
+ videoMetadata?: VideoMetadata;
62
+ thought?: boolean;
63
+ /**
64
+ * @internal
65
+ */
66
+ thoughtSignature?: never;
67
+ executableCode?: never;
68
+ codeExecutionResult?: never;
69
+ }
70
+ /**
71
+ * Describes the input video content.
72
+ * @public
73
+ */
74
+ export interface VideoMetadata {
75
+ /**
76
+ * The start offset of the video in
77
+ * protobuf {@link https://cloud.google.com/ruby/docs/reference/google-cloud-workflows-v1/latest/Google-Protobuf-Duration#json-mapping | Duration} format.
78
+ */
79
+ startOffset: string;
80
+ /**
81
+ * The end offset of the video in
82
+ * protobuf {@link https://cloud.google.com/ruby/docs/reference/google-cloud-workflows-v1/latest/Google-Protobuf-Duration#json-mapping | Duration} format.
83
+ */
84
+ endOffset: string;
85
+ }
86
+ /**
87
+ * Content part interface if the part represents a {@link FunctionCall}.
88
+ * @public
89
+ */
90
+ export interface FunctionCallPart {
91
+ text?: never;
92
+ inlineData?: never;
93
+ functionCall: FunctionCall;
94
+ functionResponse?: never;
95
+ thought?: boolean;
96
+ /**
97
+ * @internal
98
+ */
99
+ thoughtSignature?: never;
100
+ executableCode?: never;
101
+ codeExecutionResult?: never;
102
+ }
103
+ /**
104
+ * Content part interface if the part represents {@link FunctionResponse}.
105
+ * @public
106
+ */
107
+ export interface FunctionResponsePart {
108
+ text?: never;
109
+ inlineData?: never;
110
+ functionCall?: never;
111
+ functionResponse: FunctionResponse;
112
+ thought?: boolean;
113
+ /**
114
+ * @internal
115
+ */
116
+ thoughtSignature?: never;
117
+ executableCode?: never;
118
+ codeExecutionResult?: never;
119
+ }
120
+ /**
121
+ * Content part interface if the part represents {@link FileData}
122
+ * @public
123
+ */
124
+ export interface FileDataPart {
125
+ text?: never;
126
+ inlineData?: never;
127
+ functionCall?: never;
128
+ functionResponse?: never;
129
+ fileData: FileData;
130
+ thought?: boolean;
131
+ /**
132
+ * @internal
133
+ */
134
+ thoughtSignature?: never;
135
+ executableCode?: never;
136
+ codeExecutionResult?: never;
137
+ }
138
+ /**
139
+ * Represents the code that is executed by the model.
140
+ *
141
+ * @public
142
+ */
143
+ export interface ExecutableCodePart {
144
+ text?: never;
145
+ inlineData?: never;
146
+ functionCall?: never;
147
+ functionResponse?: never;
148
+ fileData: never;
149
+ thought?: never;
150
+ /**
151
+ * @internal
152
+ */
153
+ thoughtSignature?: never;
154
+ executableCode?: ExecutableCode;
155
+ codeExecutionResult?: never;
156
+ }
157
+ /**
158
+ * Represents the code execution result from the model.
159
+ *
160
+ * @public
161
+ */
162
+ export interface CodeExecutionResultPart {
163
+ text?: never;
164
+ inlineData?: never;
165
+ functionCall?: never;
166
+ functionResponse?: never;
167
+ fileData: never;
168
+ thought?: never;
169
+ /**
170
+ * @internal
171
+ */
172
+ thoughtSignature?: never;
173
+ executableCode?: never;
174
+ codeExecutionResult?: CodeExecutionResult;
175
+ }
176
+ /**
177
+ * An interface for executable code returned by the model.
178
+ *
179
+ * @public
180
+ */
181
+ export interface ExecutableCode {
182
+ /**
183
+ * The programming language of the code.
184
+ */
185
+ language?: Language;
186
+ /**
187
+ * The source code to be executed.
188
+ */
189
+ code?: string;
190
+ }
191
+ /**
192
+ * The results of code execution run by the model.
193
+ *
194
+ * @public
195
+ */
196
+ export interface CodeExecutionResult {
197
+ /**
198
+ * The result of the code execution.
199
+ */
200
+ outcome?: Outcome;
201
+ /**
202
+ * The output from the code execution, or an error message
203
+ * if it failed.
204
+ */
205
+ output?: string;
206
+ }
207
+ /**
208
+ * A predicted {@link FunctionCall} returned from the model
209
+ * that contains a string representing the {@link FunctionDeclaration.name}
210
+ * and a structured JSON object containing the parameters and their values.
211
+ * @public
212
+ */
213
+ export interface FunctionCall {
214
+ /**
215
+ * The id of the function call. This must be sent back in the associated {@link FunctionResponse}.
216
+ *
217
+ *
218
+ * @remarks This property is only supported in the Gemini Developer API ({@link GoogleAIBackend}).
219
+ * When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be
220
+ * `undefined`.
221
+ */
222
+ id?: string;
223
+ name: string;
224
+ args: object;
225
+ }
226
+ /**
227
+ * The result output from a {@link FunctionCall} that contains a string
228
+ * representing the {@link FunctionDeclaration.name}
229
+ * and a structured JSON object containing any output
230
+ * from the function is used as context to the model.
231
+ * This should contain the result of a {@link FunctionCall}
232
+ * made based on model prediction.
233
+ * @public
234
+ */
235
+ export interface FunctionResponse {
236
+ /**
237
+ * The id of the {@link FunctionCall}.
238
+ *
239
+ * @remarks This property is only supported in the Gemini Developer API ({@link GoogleAIBackend}).
240
+ * When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be
241
+ * `undefined`.
242
+ */
243
+ id?: string;
244
+ name: string;
245
+ response: object;
246
+ parts?: Part[];
247
+ }
248
+ /**
249
+ * Interface for sending an image.
250
+ * @public
251
+ */
252
+ export interface GenerativeContentBlob {
253
+ mimeType: string;
254
+ /**
255
+ * Image as a base64 string.
256
+ */
257
+ data: string;
258
+ }
259
+ /**
260
+ * Data pointing to a file uploaded on Google Cloud Storage.
261
+ * @public
262
+ */
263
+ export interface FileData {
264
+ mimeType: string;
265
+ fileUri: string;
266
+ }