Class VertexAiCodeExecutor
java.lang.Object
com.google.adk.JsonBaseModel
com.google.adk.codeexecutors.BaseCodeExecutor
com.google.adk.codeexecutors.VertexAiCodeExecutor
A code executor that uses Vertex Code Interpreter Extension to execute code.
Attributes: resourceName: If set, load the existing resource name of the code interpreter extension instead of creating a new one. Format: projects/123/locations/us-central1/extensions/456
Follow https://cloud.google.com/vertex-ai/generative-ai/docs/extensions/code-interpreter for setup.
-
Constructor Summary
ConstructorsConstructorDescriptionVertexAiCodeExecutor(String resourceName) Initializes the VertexAiCodeExecutor. -
Method Summary
Modifier and TypeMethodDescriptionexecuteCode(InvocationContext invocationContext, CodeExecutionUtils.CodeExecutionInput codeExecutionInput) Executes code and return the code execution result.Methods inherited from class BaseCodeExecutor
codeBlockDelimiters, errorRetryAttempts, executionResultDelimiters, optimizeDataFile, statefulMethods inherited from class JsonBaseModel
fromJsonNode, fromJsonString, getMapper, toJson, toJsonNode, toJsonString
-
Constructor Details
-
VertexAiCodeExecutor
Initializes the VertexAiCodeExecutor.- Parameters:
resourceName- If set, load the existing resource name of the code interpreter extension instead of creating a new one. Format: projects/123/locations/us-central1/extensions/456
-
-
Method Details
-
executeCode
public CodeExecutionUtils.CodeExecutionResult executeCode(InvocationContext invocationContext, CodeExecutionUtils.CodeExecutionInput codeExecutionInput) Description copied from class:BaseCodeExecutorExecutes code and return the code execution result.This method may perform blocking operations.
- Specified by:
executeCodein classBaseCodeExecutor- Parameters:
invocationContext- The invocation context of the code execution.codeExecutionInput- The code execution input.- Returns:
- The code execution result.
-