Class CodeExecutorContext
java.lang.Object
com.google.adk.codeexecutors.CodeExecutorContext
The persistent context used to configure the code executor.
-
Constructor Summary
ConstructorsConstructorDescriptionCodeExecutorContext(Map<String, Object> sessionState) Initializes the code executor context. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInputFiles(List<CodeExecutionUtils.File> inputFiles) Adds the input files to the code executor context.voidaddProcessedFileNames(List<String> fileNames) Adds the processed file name to the session state.voidRemoves the input files and processed file names to the code executor context.intgetErrorCount(String invocationId) Gets the error count from the session state.Gets the session ID for the code executor.Gets the code executor input file names from the session state.Gets the processed file names from the session state.Gets the state delta to update in the persistent session state.voidincrementErrorCount(String invocationId) Increments the error count from the session state.voidresetErrorCount(String invocationId) Resets the error count from the session state.voidsetExecutionId(String sessionId) Sets the session ID for the code executor.voidupdateCodeExecutionResult(String invocationId, String code, String resultStdout, String resultStderr) Updates the code execution result.
-
Constructor Details
-
CodeExecutorContext
-
-
Method Details
-
getStateDelta
-
getExecutionId
-
setExecutionId
Sets the session ID for the code executor.- Parameters:
sessionId- The session ID for the code executor.
-
getProcessedFileNames
-
addProcessedFileNames
-
getInputFiles
Gets the code executor input file names from the session state.- Returns:
- A list of input files in the code executor context.
-
addInputFiles
Adds the input files to the code executor context.- Parameters:
inputFiles- The input files to add to the code executor context.
-
clearInputFiles
public void clearInputFiles()Removes the input files and processed file names to the code executor context. -
getErrorCount
Gets the error count from the session state.- Parameters:
invocationId- The invocation ID to get the error count for.- Returns:
- The error count for the given invocation ID.
-
incrementErrorCount
Increments the error count from the session state.- Parameters:
invocationId- The invocation ID to increment the error count for.
-
resetErrorCount
Resets the error count from the session state.- Parameters:
invocationId- The invocation ID to reset the error count for.
-
updateCodeExecutionResult
public void updateCodeExecutionResult(String invocationId, String code, String resultStdout, String resultStderr) Updates the code execution result.- Parameters:
invocationId- The invocation ID to update the code execution result for.code- The code to execute.resultStdout- The standard output of the code execution.resultStderr- The standard error of the code execution.
-