class_docstr: Simulate neuron behavior based on an explanation.
  
  Unlike ExplanationNeuronSimulator, this class uses one few-shot prompt per token to calculate
  expected activations. This is slower. This class gets a one-token completion and calculates an
  expected value from that token's logprobs.
class_docstr_tok: ["Simulate","neuron","behavior","based","on","an","explanation",".","Unlike","ExplanationNeuronSimulator",",","this","class","uses","one","few-shot","prompt","per","token","to","calculate","expected","activations",".","This","is","slower",".","This","class","gets","a","one-token","completion","and","calculates","an","expected","value","from","that","token","'s","logprobs","."]
code: def __init__(
      self,
      model_name: str,
      explanation: str,
      max_concurrent: Optional[int] = 10,
      few_shot_example_set: FewShotExampleSet = FewShotExampleSet.NEWER,
      prompt_format: PromptFormat = PromptFormat.INSTRUCTION_FOLLOWING,
      cache: bool = False,
  ):
      assert (
          few_shot_example_set != FewShotExampleSet.ORIGINAL
      ), "This simulator doesn't support the ORIGINAL few-shot example set."
      self.api_client = ApiClient(
          model_name=model_name,
          max_concurrent=max_concurrent,
          cache=cache,
      )
      self.explanation = explanation
      self.few_shot_example_set = few_shot_example_set
      self.prompt_format = prompt_format
  
imports: from __future__ import annotations
  import asyncio
  import logging
  from abc import ABC, abstractmethod
  from collections import OrderedDict
  from enum import Enum
  from typing import Any, Optional, Sequence, Union
  import numpy
  from neuron_explainer.activations.activation_records import calculate_max_activation, format_activation_records, format_sequences_for_simulation, normalize_activations
  from neuron_explainer.activations.activations import ActivationRecord
  from neuron_explainer.api_client import ApiClient
  from neuron_explainer.explanations.explainer import EXPLANATION_PREFIX
  from neuron_explainer.explanations.explanations import ActivationScale, SequenceSimulation
  from neuron_explainer.explanations.few_shot_examples import FewShotExampleSet
  from neuron_explainer.explanations.prompt_builder import HarmonyMessage, PromptBuilder, PromptFormat, Role
label_desc: Use image node_id 1 to create a new ExplanationTokenByTokenSimulator object from inherited base classes: NeuronSimulator with example: obj = ExplanationTokenByTokenSimulator(model_name, explanation, max_concurrent, few_shot_example_set, prompt_format, cache)