Class: Google::Apis::AiplatformV1::GoogleCloudAiplatformV1CustomCodeExecutionSpec
- Inherits:
-
Object
- Object
- Google::Apis::AiplatformV1::GoogleCloudAiplatformV1CustomCodeExecutionSpec
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/aiplatform_v1/classes.rb,
lib/google/apis/aiplatform_v1/representations.rb,
lib/google/apis/aiplatform_v1/representations.rb
Overview
Specificies a metric that is populated by evaluating user-defined Python code.
Instance Attribute Summary collapse
-
#evaluation_function ⇒ String
Required.
Instance Method Summary collapse
-
#initialize(**args) ⇒ GoogleCloudAiplatformV1CustomCodeExecutionSpec
constructor
A new instance of GoogleCloudAiplatformV1CustomCodeExecutionSpec.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ GoogleCloudAiplatformV1CustomCodeExecutionSpec
Returns a new instance of GoogleCloudAiplatformV1CustomCodeExecutionSpec.
5344 5345 5346 |
# File 'lib/google/apis/aiplatform_v1/classes.rb', line 5344 def initialize(**args) update!(**args) end |
Instance Attribute Details
#evaluation_function ⇒ String
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
5342 5343 5344 |
# File 'lib/google/apis/aiplatform_v1/classes.rb', line 5342 def evaluation_function @evaluation_function end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
5349 5350 5351 |
# File 'lib/google/apis/aiplatform_v1/classes.rb', line 5349 def update!(**args) @evaluation_function = args[:evaluation_function] if args.key?(:evaluation_function) end |