Class: Google::Apis::AiplatformV1beta1::GoogleCloudAiplatformV1beta1CustomCodeExecutionSpec

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/aiplatform_v1beta1/classes.rb,
lib/google/apis/aiplatform_v1beta1/representations.rb,
lib/google/apis/aiplatform_v1beta1/representations.rb

Overview

Specificies a metric that is populated by evaluating user-defined Python code.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleCloudAiplatformV1beta1CustomCodeExecutionSpec

Returns a new instance of GoogleCloudAiplatformV1beta1CustomCodeExecutionSpec.



6600
6601
6602
# File 'lib/google/apis/aiplatform_v1beta1/classes.rb', line 6600

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#evaluation_functionString

Required. Python function. 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]. Example: Example input: instance= EvaluationInstance( response=EvaluationInstance.InstanceData(text="The answer is 4."), reference= EvaluationInstance.InstanceData(text="4") ) Example converted input: ` 'response': `'text': 'The answer is 4.'`, 'reference': `'text': '4'` ` Example python function: def evaluate(instance: dict[str, Any]) -> float: if instance'response' == instance'reference': return 1.0 return 0.0 CustomCodeExecutionSpec is also supported in Batch Evaluation (EvalDataset RPC) and Tuning Evaluation. Each line in the input jsonl file will be converted to dict[str, Any] and passed to the evaluation function. Corresponds to the JSON property evaluationFunction

Returns:

  • (String)


6598
6599
6600
# File 'lib/google/apis/aiplatform_v1beta1/classes.rb', line 6598

def evaluation_function
  @evaluation_function
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



6605
6606
6607
# File 'lib/google/apis/aiplatform_v1beta1/classes.rb', line 6605

def update!(**args)
  @evaluation_function = args[:evaluation_function] if args.key?(:evaluation_function)
end