Class ExecutableCode

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

public abstract class ExecutableCode extends JsonSerializable
Code generated by the model that is meant to be executed, and the result returned to the model. Generated when using the `CodeExecution` tool, in which the code will be automatically executed, and a corresponding CodeExecutionResult will also be generated.
  • Constructor Details

    • ExecutableCode

      public ExecutableCode()
  • Method Details

    • code

      public abstract Optional<String> code()
      Required. The code to be executed.
    • language

      public abstract Optional<Language> language()
      Required. Programming language of the `code`.
    • id

      public abstract Optional<String> id()
      Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`. This field is not supported in Vertex AI.
    • builder

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

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

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