Class CustomCodeExecutionSpec

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

public abstract class CustomCodeExecutionSpec extends JsonSerializable
Specifies a metric that is computed by running user-defined Python functions remotely.
  • Constructor Details

    • CustomCodeExecutionSpec

      public CustomCodeExecutionSpec()
  • Method Details

    • evaluationFunction

      public abstract Optional<String> evaluationFunction()
      A string representing a user-defined function for evaluation. Expected user to define the following function, e.g.: def evaluate(instance: dict[str, Any]) -> float: Please include this function signature in the code snippet. Instance is the evaluation instance, any fields populated in the instance are available to the function as instance[field_name].
    • codeExecutionRegion

      public abstract Optional<String> codeExecutionRegion()
      Optional. The region to use for code execution. If set, the Code Execution Sandbox will be invoked in the specified region regardless of the request's originating region. Must be a region where the Code Execution Sandbox is available. For the current list of [supported regions](https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/locations). If unset, the request's originating region is used; requests from regions where the sandbox is unavailable will fail with UNIMPLEMENTED.
    • builder

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

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

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