Skip to content

Commit 647c6e4

Browse files
committed
AIX: Gemini: replay code execution part IDs
1 parent 7bae710 commit 647c6e4

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/modules/aix/server/dispatch/chatGenerate/adapters/gemini.generateContent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ function _toGeminiContents(chatSequence: AixMessages_ChatMessage[], apiRequiresS
467467
case 'code_execution':
468468
if (invocation.language?.toLowerCase() !== 'python')
469469
console.warn('Gemini only supports Python code execution, but got:', invocation.language);
470-
parts.push(GeminiWire_ContentParts.ExecutableCodePart('PYTHON', invocation.code));
470+
parts.push(GeminiWire_ContentParts.ExecutableCodePart('PYTHON', invocation.code, part.id));
471471
break;
472472
default:
473473
const _exhaustiveCheck: never = invocation;
@@ -501,7 +501,7 @@ function _toGeminiContents(chatSequence: AixMessages_ChatMessage[], apiRequiresS
501501
parts.push(GeminiWire_ContentParts.FunctionResponsePart({ id: part.id, name: part.response.name, response: functionResponseResponse }));
502502
break;
503503
case 'code_execution':
504-
parts.push(GeminiWire_ContentParts.CodeExecutionResultPart(!part.error ? 'OUTCOME_OK' : 'OUTCOME_FAILED', toolErrorPrefix + part.response.result));
504+
parts.push(GeminiWire_ContentParts.CodeExecutionResultPart(!part.error ? 'OUTCOME_OK' : 'OUTCOME_FAILED', toolErrorPrefix + part.response.result, part.id));
505505
break;
506506
default:
507507
const _exhaustiveCheck: never = part.response;

src/modules/aix/server/dispatch/wiretypes/gemini.wiretypes.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,12 @@ export namespace GeminiWire_ContentParts {
300300
return { functionResponse: { ...(id !== undefined ? { id } : {}), name, ...(response !== undefined ? { response } : {}) } };
301301
}
302302

303-
export function ExecutableCodePart(language: 'PYTHON', code: string): z.infer<typeof ExecutableCodePart_schema> {
304-
return { executableCode: { language, code } };
303+
export function ExecutableCodePart(language: 'PYTHON', code: string, id?: string): z.infer<typeof ExecutableCodePart_schema> {
304+
return { executableCode: { ...(id !== undefined ? { id } : {}), language, code } };
305305
}
306306

307-
export function CodeExecutionResultPart(outcome: 'OUTCOME_OK' | 'OUTCOME_FAILED' | 'OUTCOME_DEADLINE_EXCEEDED', output?: string): z.infer<typeof CodeExecutionResultPart_schema> {
308-
return { codeExecutionResult: { outcome, output } };
307+
export function CodeExecutionResultPart(outcome: 'OUTCOME_OK' | 'OUTCOME_FAILED' | 'OUTCOME_DEADLINE_EXCEEDED', output?: string, id?: string): z.infer<typeof CodeExecutionResultPart_schema> {
308+
return { codeExecutionResult: { ...(id !== undefined ? { id } : {}), outcome, output } };
309309
}
310310

311311
}

0 commit comments

Comments
 (0)