class_docstr: Processes a single example.
class_docstr_tok: ["Processes","a","single","example","."]
code: def process(self, request_state: RequestState) -> List[Stat]:
      request: Request = request_state.request
      stats: List[Stat] = []
  
      # Estimated cost in terms of number of tokens
      estimate_num_tokens_cost: int = (
          self.token_cost_estimator.estimate_tokens(
              request, self.metric_service
          )
      )
      # TODO: replace with "estimated_num_tokens" - is this for prompt or completion
      stats.append(
          Stat(MetricName("estimated_num_tokens_cost")).add(
              estimate_num_tokens_cost
          )
      )
  
      stats.append(
          Stat(MetricName("num_completions")).add(
              request.num_completions
          )
      )
  
      # Maximum number of tokens in the completions
      # This is an overestimate of the actual number of output tokens since sequences can early terminate
      stats.append(
          Stat(MetricName("max_num_completion_tokens")).add(
              request.num_completions * request.max_tokens
          )
      )
  
      # Get number of tokens in the prompt
      tokenizer: WindowService = (
          WindowServiceFactory.get_window_service(
              request.model, self.metric_service
          )
      )
      num_prompt_tokens: int = tokenizer.get_num_tokens(request.prompt)
      stats.append(
          Stat(MetricName("num_prompt_tokens")).add(num_prompt_tokens)
      )
  
      return stats
  
imports: from typing import List, Dict, cast
  from dataclasses import dataclass
  from helm.common.general import parallel_map
  from helm.common.request import Request
  from helm.benchmark.adaptation.scenario_state import ScenarioState
  from helm.benchmark.adaptation.request_state import RequestState
  from helm.benchmark.metrics.statistic import Stat, merge_stat
  from helm.benchmark.window_services.window_service import WindowService
  from helm.benchmark.window_services.window_service_factory import WindowServiceFactory
  from .metric import Metric, MetricResult, PerInstanceStats
  from .metric_name import MetricName
  from .metric_service import MetricService
  from .tokens.auto_token_cost_estimator import AutoTokenCostEstimator
  from .tokens.token_cost_estimator import TokenCostEstimator
label_desc: Use image node_id 1 for calling the Processor obj's underlying member method code with example usage: obj.process(request_state) and returns: stats