@firebase/ai 2.2.1-canary.120a30838 → 2.2.1-canary.43276b041

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.
@@ -14,7 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { Role } from './enums';
17
+ import { Language, Outcome, Role } from './enums';
18
18
  /**
19
19
  * Content type for both prompts and response candidates.
20
20
  * @public
@@ -28,7 +28,7 @@ export interface Content {
28
28
  * part types.
29
29
  * @public
30
30
  */
31
- export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart;
31
+ export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart | ExecutableCodePart | CodeExecutionResultPart;
32
32
  /**
33
33
  * Content part interface if the part represents a text string.
34
34
  * @public
@@ -43,6 +43,8 @@ export interface TextPart {
43
43
  * @internal
44
44
  */
45
45
  thoughtSignature?: string;
46
+ executableCode?: never;
47
+ codeExecutionResult?: never;
46
48
  }
47
49
  /**
48
50
  * Content part interface if the part represents an image.
@@ -62,6 +64,8 @@ export interface InlineDataPart {
62
64
  * @internal
63
65
  */
64
66
  thoughtSignature?: never;
67
+ executableCode?: never;
68
+ codeExecutionResult?: never;
65
69
  }
66
70
  /**
67
71
  * Describes the input video content.
@@ -93,6 +97,8 @@ export interface FunctionCallPart {
93
97
  * @internal
94
98
  */
95
99
  thoughtSignature?: never;
100
+ executableCode?: never;
101
+ codeExecutionResult?: never;
96
102
  }
97
103
  /**
98
104
  * Content part interface if the part represents {@link FunctionResponse}.
@@ -108,6 +114,8 @@ export interface FunctionResponsePart {
108
114
  * @internal
109
115
  */
110
116
  thoughtSignature?: never;
117
+ executableCode?: never;
118
+ codeExecutionResult?: never;
111
119
  }
112
120
  /**
113
121
  * Content part interface if the part represents {@link FileData}
@@ -124,6 +132,77 @@ export interface FileDataPart {
124
132
  * @internal
125
133
  */
126
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;
127
206
  }
128
207
  /**
129
208
  * A predicted {@link FunctionCall} returned from the model
@@ -351,3 +351,35 @@ export declare const InferenceMode: {
351
351
  * @public
352
352
  */
353
353
  export type InferenceMode = (typeof InferenceMode)[keyof typeof InferenceMode];
354
+ /**
355
+ * Represents the result of the code execution.
356
+ *
357
+ * @public
358
+ */
359
+ export declare const Outcome: {
360
+ UNSPECIFIED: string;
361
+ OK: string;
362
+ FAILED: string;
363
+ DEADLINE_EXCEEDED: string;
364
+ };
365
+ /**
366
+ * Represents the result of the code execution.
367
+ *
368
+ * @public
369
+ */
370
+ export type Outcome = (typeof Outcome)[keyof typeof Outcome];
371
+ /**
372
+ * The programming language of the code.
373
+ *
374
+ * @public
375
+ */
376
+ export declare const Language: {
377
+ UNSPECIFIED: string;
378
+ PYTHON: string;
379
+ };
380
+ /**
381
+ * The programming language of the code.
382
+ *
383
+ * @public
384
+ */
385
+ export type Language = (typeof Language)[keyof typeof Language];
@@ -218,7 +218,7 @@ export interface RequestOptions {
218
218
  * Defines a tool that model can call to access external knowledge.
219
219
  * @public
220
220
  */
221
- export type Tool = FunctionDeclarationsTool | GoogleSearchTool;
221
+ export type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool;
222
222
  /**
223
223
  * Structured representation of a function declaration as defined by the
224
224
  * {@link https://spec.openapis.org/oas/v3.0.3 | OpenAPI 3.0 specification}.
@@ -262,8 +262,6 @@ export interface GoogleSearchTool {
262
262
  /**
263
263
  * Specifies the Google Search configuration.
264
264
  * Currently, this is an empty object, but it's reserved for future configuration options.
265
- * Specifies the Google Search configuration. Currently, this is an empty object, but it's
266
- * reserved for future configuration options.
267
265
  *
268
266
  * When using this feature, you are required to comply with the "Grounding with Google Search"
269
267
  * usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
@@ -272,6 +270,18 @@ export interface GoogleSearchTool {
272
270
  */
273
271
  googleSearch: GoogleSearch;
274
272
  }
273
+ /**
274
+ * A tool that enables the model to use code execution.
275
+ *
276
+ * @public
277
+ */
278
+ export interface CodeExecutionTool {
279
+ /**
280
+ * Specifies the Google Search configuration.
281
+ * Currently, this is an empty object, but it's reserved for future configuration options.
282
+ */
283
+ codeExecution: {};
284
+ }
275
285
  /**
276
286
  * Specifies the Google Search configuration.
277
287
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/ai",
3
- "version": "2.2.1-canary.120a30838",
3
+ "version": "2.2.1-canary.43276b041",
4
4
  "description": "The Firebase AI SDK",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "engines": {
@@ -48,19 +48,19 @@
48
48
  "trusted-type-check": "tsec -p tsconfig.json --noEmit"
49
49
  },
50
50
  "peerDependencies": {
51
- "@firebase/app": "0.14.2-canary.120a30838",
52
- "@firebase/app-types": "0.9.3-canary.120a30838"
51
+ "@firebase/app": "0.14.2-canary.43276b041",
52
+ "@firebase/app-types": "0.9.3-canary.43276b041"
53
53
  },
54
54
  "dependencies": {
55
- "@firebase/app-check-interop-types": "0.3.3-canary.120a30838",
56
- "@firebase/component": "0.7.0-canary.120a30838",
57
- "@firebase/logger": "0.5.0-canary.120a30838",
58
- "@firebase/util": "1.13.0-canary.120a30838",
55
+ "@firebase/app-check-interop-types": "0.3.3-canary.43276b041",
56
+ "@firebase/component": "0.7.0-canary.43276b041",
57
+ "@firebase/logger": "0.5.0-canary.43276b041",
58
+ "@firebase/util": "1.13.0-canary.43276b041",
59
59
  "tslib": "^2.1.0"
60
60
  },
61
61
  "license": "Apache-2.0",
62
62
  "devDependencies": {
63
- "@firebase/app": "0.14.2-canary.120a30838",
63
+ "@firebase/app": "0.14.2-canary.43276b041",
64
64
  "@rollup/plugin-json": "6.1.0",
65
65
  "rollup": "2.79.2",
66
66
  "rollup-plugin-replace": "2.2.0",