Package com.google.genai.types
Class EvaluationParserConfigCustomCodeParserConfig
java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.EvaluationParserConfigCustomCodeParserConfig
Configuration for parsing the LLM response using custom code. This data type is not supported in
Gemini API.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for EvaluationParserConfigCustomCodeParserConfig. -
Field Summary
Fields inherited from class com.google.genai.JsonSerializable
MAX_READ_LENGTH_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Instantiates a builder for EvaluationParserConfigCustomCodeParserConfig.Deserializes a JSON string to a EvaluationParserConfigCustomCodeParserConfig object.Required.Creates a builder with the same values as this instance.Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString
-
Constructor Details
-
EvaluationParserConfigCustomCodeParserConfig
public EvaluationParserConfigCustomCodeParserConfig()
-
-
Method Details
-
parsingFunction
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 -
builder
Instantiates a builder for EvaluationParserConfigCustomCodeParserConfig. -
toBuilder
Creates a builder with the same values as this instance. -
fromJson
Deserializes a JSON string to a EvaluationParserConfigCustomCodeParserConfig object.
-