Class: Google::Apis::AiplatformV1::GoogleCloudAiplatformV1EvaluationParserConfigCustomCodeParserConfig

Inherits:
Object
  • Object
show all
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

Configuration for parsing the LLM response using custom code.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleCloudAiplatformV1EvaluationParserConfigCustomCodeParserConfig

Returns a new instance of GoogleCloudAiplatformV1EvaluationParserConfigCustomCodeParserConfig.



9993
9994
9995
# File 'lib/google/apis/aiplatform_v1/classes.rb', line 9993

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)


9991
9992
9993
# File 'lib/google/apis/aiplatform_v1/classes.rb', line 9991

def parsing_function
  @parsing_function
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



9998
9999
10000
# File 'lib/google/apis/aiplatform_v1/classes.rb', line 9998

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