Class CodeExecutionResult

java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.CodeExecutionResult

public abstract class CodeExecutionResult extends JsonSerializable
Result of executing the `ExecutableCode`.

Generated only when the `CodeExecution` tool is used.

  • Constructor Details

    • CodeExecutionResult

      public CodeExecutionResult()
  • Method Details

    • outcome

      public abstract Optional<Outcome> outcome()
      Required. Outcome of the code execution.
    • output

      public abstract Optional<String> output()
      Optional. Contains stdout when code execution is successful, stderr or other description otherwise.
    • id

      public abstract Optional<String> id()
      The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id.
    • builder

      public static CodeExecutionResult.Builder builder()
      Instantiates a builder for CodeExecutionResult.
    • toBuilder

      public abstract CodeExecutionResult.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static CodeExecutionResult fromJson(String jsonString)
      Deserializes a JSON string to a CodeExecutionResult object.