Class: Google::Apis::AiplatformV1beta1::GoogleCloudAiplatformV1beta1EvaluationParserConfigCustomCodeParserConfig

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

Configuration for parsing the LLM response using custom code.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleCloudAiplatformV1beta1EvaluationParserConfigCustomCodeParserConfig

Returns a new instance of GoogleCloudAiplatformV1beta1EvaluationParserConfigCustomCodeParserConfig.



11430
11431
11432
# File 'lib/google/apis/aiplatform_v1beta1/classes.rb', line 11430

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

Instance Attribute Details

#parsing_functionString

Required. Python function for parsing results. The function should be defined within this string. The function takes a list of strings (LLM responses) and should return either a list of dictionaries (for rubrics) or a single dictionary (for a metric result). Example function signature: def parse( responses: list[str]) -> list[dict[str, Any]] | dict[str, Any]: When parsing rubrics, return a list of dictionaries, where each dictionary represents a Rubric. Example for rubrics: [ "content":"property": "description": "The response is factual.", "type": "FACTUALITY", "importance": "HIGH", " content":"property": "description": "The response is fluent.", "type": " FLUENCY", "importance": "MEDIUM" ] When parsing critique results, return a dictionary representing a MetricResult. Example for a metric result: "score": 0.8, "explanation": "The model followed most instructions.", "rubric_verdicts" : [...] ... code for result extraction and aggregation Corresponds to the JSON property parsingFunction

Returns:

  • (String)


11428
11429
11430
# File 'lib/google/apis/aiplatform_v1beta1/classes.rb', line 11428

def parsing_function
  @parsing_function
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



11435
11436
11437
# File 'lib/google/apis/aiplatform_v1beta1/classes.rb', line 11435

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