Skip to content

Commit 06216be

Browse files
authoredJun 27, 2024··
Add code execution feature (#185)
1 parent fb1c0f2 commit 06216be

File tree

101 files changed

+1432
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+1432
-62
lines changed
 

‎.changeset/cool-rivers-carry.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@google/generative-ai": minor
3+
---
4+
5+
Add code execution feature.

‎common/api-review/generative-ai-server.api.md

+88-8
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,45 @@ export interface CachedContentUpdateParams {
5050
updateMask?: string[];
5151
}
5252

53-
// Warning: (ae-internal-missing-underscore) The name "CachedContentUpdateRequest" should be prefixed with an underscore because the declaration is marked as @internal
54-
//
5553
// @internal
56-
export interface CachedContentUpdateRequest {
54+
export interface _CachedContentUpdateRequest {
5755
// (undocumented)
58-
cachedContent: CachedContentUpdateRequestFields;
56+
cachedContent: _CachedContentUpdateRequestFields;
5957
updateMask?: string[];
6058
}
6159

62-
// Warning: (ae-internal-missing-underscore) The name "CachedContentUpdateRequestFields" should be prefixed with an underscore because the declaration is marked as @internal
63-
//
6460
// @internal
65-
export interface CachedContentUpdateRequestFields {
61+
export interface _CachedContentUpdateRequestFields {
6662
// (undocumented)
6763
expireTime?: string;
6864
// (undocumented)
6965
ttl?: string;
7066
}
7167

68+
// @public
69+
export interface CodeExecutionResult {
70+
outcome: Outcome;
71+
output: string;
72+
}
73+
74+
// @public
75+
export interface CodeExecutionResultPart {
76+
// (undocumented)
77+
codeExecutionResult: CodeExecutionResult;
78+
// (undocumented)
79+
executableCode?: never;
80+
// (undocumented)
81+
fileData?: never;
82+
// (undocumented)
83+
functionCall?: never;
84+
// (undocumented)
85+
functionResponse?: never;
86+
// (undocumented)
87+
inlineData?: never;
88+
// (undocumented)
89+
text?: never;
90+
}
91+
7292
// @public
7393
export interface Content {
7494
// (undocumented)
@@ -91,6 +111,38 @@ export interface ErrorDetails {
91111
reason?: string;
92112
}
93113

114+
// @public
115+
export interface ExecutableCode {
116+
code: string;
117+
language: ExecutableCodeLanguage;
118+
}
119+
120+
// @public (undocumented)
121+
export enum ExecutableCodeLanguage {
122+
// (undocumented)
123+
LANGUAGE_UNSPECIFIED = "language_unspecified",
124+
// (undocumented)
125+
PYTHON = "python"
126+
}
127+
128+
// @public
129+
export interface ExecutableCodePart {
130+
// (undocumented)
131+
codeExecutionResult?: never;
132+
// (undocumented)
133+
executableCode: ExecutableCode;
134+
// (undocumented)
135+
fileData?: never;
136+
// (undocumented)
137+
functionCall?: never;
138+
// (undocumented)
139+
functionResponse?: never;
140+
// (undocumented)
141+
inlineData?: never;
142+
// (undocumented)
143+
text?: never;
144+
}
145+
94146
// @public
95147
export interface FileData {
96148
// (undocumented)
@@ -101,6 +153,10 @@ export interface FileData {
101153

102154
// @public
103155
export interface FileDataPart {
156+
// (undocumented)
157+
codeExecutionResult?: never;
158+
// (undocumented)
159+
executableCode?: never;
104160
// (undocumented)
105161
fileData: FileData;
106162
// (undocumented)
@@ -191,6 +247,10 @@ export enum FunctionCallingMode {
191247

192248
// @public
193249
export interface FunctionCallPart {
250+
// (undocumented)
251+
codeExecutionResult?: never;
252+
// (undocumented)
253+
executableCode?: never;
194254
// (undocumented)
195255
fileData?: never;
196256
// (undocumented)
@@ -249,6 +309,10 @@ export interface FunctionResponse {
249309

250310
// @public
251311
export interface FunctionResponsePart {
312+
// (undocumented)
313+
codeExecutionResult?: never;
314+
// (undocumented)
315+
executableCode?: never;
252316
// (undocumented)
253317
fileData?: never;
254318
// (undocumented)
@@ -293,6 +357,10 @@ export class GoogleAIFileManager {
293357

294358
// @public
295359
export interface InlineDataPart {
360+
// (undocumented)
361+
codeExecutionResult?: never;
362+
// (undocumented)
363+
executableCode?: never;
296364
// (undocumented)
297365
fileData?: never;
298366
// (undocumented)
@@ -330,7 +398,15 @@ export interface ListParams {
330398
}
331399

332400
// @public
333-
export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart;
401+
export enum Outcome {
402+
OUTCOME_DEADLINE_EXCEEDED = "outcome_deadline_exceeded",
403+
OUTCOME_FAILED = "outcome_failed",
404+
OUTCOME_OK = "outcome_ok",
405+
OUTCOME_UNSPECIFIED = "outcome_unspecified"
406+
}
407+
408+
// @public
409+
export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart | ExecutableCodePart | CodeExecutionResultPart;
334410

335411
// @public
336412
export interface RequestOptions {
@@ -369,6 +445,10 @@ export interface Schema {
369445

370446
// @public
371447
export interface TextPart {
448+
// (undocumented)
449+
codeExecutionResult?: never;
450+
// (undocumented)
451+
executableCode?: never;
372452
// (undocumented)
373453
fileData?: never;
374454
// (undocumented)

0 commit comments

Comments
 (0)
Please sign in to comment.