class_docstr: An `Adapter`, guided by the `AdapterSpec`, takes a `Scenario` and produces
  a `ScenarioState`. It has additional logic surrounding in-context examples.
code: def _adapt_trial_index(
      self,
      all_train_instances: List[Instance],
      train_trial_index: int,
      eval_instances: List[Instance],
      parallelism: int,
  ) -> List[RequestState]:
      self.train_trial_index: int = train_trial_index
      self.train_instances: List[Instance] = self.sample_examples(
          all_train_instances,
          seed=train_trial_index,
          sample_train=self.adapter_spec.sample_train,
      )
      hlog(
          f"Sampled {len(self.train_instances)} examples for trial #{self.train_trial_index}."
      )
  
      # Generate request_states
      results: List[List[RequestState]] = parallel_map(
          self.generate_requests,
          eval_instances,
          parallelism=parallelism,
      )
  
      # Print out prompts for one instance (useful for debugging)
      if train_trial_index == 0 and len(results) > 0:
          with htrack_block("Sample prompts"):
              for request_state in results[0]:
                  with htrack_block(
                      f"reference index = {request_state.reference_index}, "
                      f"request_mode = {request_state.request_mode}"
                  ):
                      for line in request_state.request.prompt.split(
                          "\n"
                      ):
                          hlog(line)
  
      # Flatten and return
      all_request_states: List[RequestState] = []
      for result_index, result in enumerate(results):
          all_request_states.extend(result)
  
      return [
          request_state
          for result in results
          for request_state in result
      ]
  
imports: import random
  from abc import ABC
  from collections import defaultdict
  from dataclasses import replace
  from itertools import cycle
  from typing import List, Dict, Optional
  from helm.benchmark.adaptation.prompt import Prompt
  from helm.benchmark.adaptation.request_state import RequestState
  from helm.benchmark.adaptation.scenario_state import ScenarioState
  from helm.benchmark.scenarios.scenario import Instance, TRAIN_SPLIT, EVAL_SPLITS, Reference
  from helm.common.general import parallel_map
  from helm.common.hierarchical_logger import hlog, htrack, htrack_block
  from .adapter import Adapter
label_desc: Use image node_id 2 for calling the InContextLearningAdapter obj's underlying member method code with example usage: obj._adapt_trial_index(all_train_instances, train_trial_index, eval_instances, parallelism) and returns: unknown