Class EvaluationParserConfigCustomCodeParserConfig

java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.EvaluationParserConfigCustomCodeParserConfig

public abstract class EvaluationParserConfigCustomCodeParserConfig extends JsonSerializable
Configuration for parsing the LLM response using custom code. This data type is not supported in Gemini API.
  • Constructor Details

    • EvaluationParserConfigCustomCodeParserConfig

      public EvaluationParserConfigCustomCodeParserConfig()
  • Method Details

    • parsingFunction

      public abstract Optional<String> 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
    • codeExecutionRegion

      public abstract Optional<String> codeExecutionRegion()
      Optional. The region to use for code execution. If set, the Code Execution Sandbox will be invoked in the specified region regardless of the request's originating region. Must be a region where the Code Execution Sandbox is available. Supported regions: northamerica-northeast1, southamerica-east1, us-central1, us-east1, us-east4, us-west1, us-west4, europe-central2, europe-north1, europe-southwest1, europe-west1, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-west1, asia-east1, asia-east2, asia-northeast1, asia-northeast3, asia-south1, asia-south2, asia-southeast1, australia-southeast2. If unset, the request's originating region is used.
    • builder

      Instantiates a builder for EvaluationParserConfigCustomCodeParserConfig.
    • toBuilder

      Creates a builder with the same values as this instance.
    • fromJson

      public static EvaluationParserConfigCustomCodeParserConfig fromJson(String jsonString)
      Deserializes a JSON string to a EvaluationParserConfigCustomCodeParserConfig object.