Class EvaluationParserConfigCustomCodeParserConfig.Builder

java.lang.Object
com.google.genai.types.EvaluationParserConfigCustomCodeParserConfig.Builder
Enclosing class:
EvaluationParserConfigCustomCodeParserConfig

public abstract static class EvaluationParserConfigCustomCodeParserConfig.Builder extends Object
Builder for EvaluationParserConfigCustomCodeParserConfig.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • parsingFunction

      public abstract EvaluationParserConfigCustomCodeParserConfig.Builder parsingFunction(String parsingFunction)
      Setter for parsingFunction.

      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

    • clearParsingFunction

      @CanIgnoreReturnValue public EvaluationParserConfigCustomCodeParserConfig.Builder clearParsingFunction()
      Clears the value of parsingFunction field.
    • codeExecutionRegion

      public abstract EvaluationParserConfigCustomCodeParserConfig.Builder codeExecutionRegion(String codeExecutionRegion)
      Setter for codeExecutionRegion.

      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. For the current list of [supported regions](https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/locations). If unset, the request's originating region is used.

    • clearCodeExecutionRegion

      @CanIgnoreReturnValue public EvaluationParserConfigCustomCodeParserConfig.Builder clearCodeExecutionRegion()
      Clears the value of codeExecutionRegion field.
    • build