Class ExecutableCode

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

public abstract class ExecutableCode extends JsonSerializable
Model-generated code executed server-side, results returned to the model.

Only 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()
      Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`.
    • 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.