Class CodeExecutorContext
java.lang.Object
com.google.adk.codeexecutors.CodeExecutorContext
用于配置代码执行器的持久性上下文(persistent context)。
-
构造函数概述
Constructors -
方法概述
Modifier and TypeMethodDescriptionvoidaddInputFiles(List<CodeExecutionUtils.File> inputFiles) 将这些输入文件添加到代码执行器的上下文中。voidaddProcessedFileNames(List<String> fileNames) 将处理后的文件名添加到会话状态中。void从代码执行器的上下文中删除输入文件及处理后的文件名。intgetErrorCount(String invocationId) 从会话状态中获取错误计数。获取代码执行器的会话 ID。从会话状态中获取代码执行器的输入文件名。从会话状态中获取已处理的文件名。获取需要在持久会话状态中更新的状态变化信息(即状态差异)。voidincrementErrorCount(String invocationId) 该操作会从会话状态中增加错误计数(即错误的数量)。voidresetErrorCount(String invocationId) 将错误计数重置为会话状态中的初始值。voidsetExecutionId(String sessionId) 为代码执行器设置会话 ID。voidupdateCodeExecutionResult(String invocationId, String code, String resultStdout, String resultStderr) 更新代码执行结果。
-
构造函数详细信息
-
CodeExecutorContext
-
-
方法详细信息(Method Details)
-
getStateDelta
-
getExecutionId
-
setExecutionId
为代码执行器设置会话 ID。- Parameters:
sessionId- The session ID for the code executor.
-
getProcessedFileNames
-
addProcessedFileNames
-
getInputFiles
从会话状态中获取代码执行器的输入文件名。- Returns:
- A list of input files in the code executor context.
-
addInputFiles
将这些输入文件添加到代码执行器的上下文中。- Parameters:
inputFiles- The input files to add to the code executor context.
-
clearInputFiles
public void clearInputFiles()从代码执行器的上下文中删除输入文件及处理后的文件名。 -
getErrorCount
从会话状态中获取错误计数。- Parameters:
invocationId- The invocation ID to get the error count for.- Returns:
- The error count for the given invocation ID.
-
incrementErrorCount
该操作会从会话状态中增加错误计数(即错误的数量)。- Parameters:
invocationId- The invocation ID to increment the error count for.
-
resetErrorCount
将错误计数重置为会话状态中的初始值。- Parameters:
invocationId- The invocation ID to reset the error count for.
-
updateCodeExecutionResult
public void updateCodeExecutionResult(String invocationId, String code, String resultStdout, String resultStderr) 更新代码执行结果。- 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.
-