class_docstr: prompt template is taken from [日本語に特化した60億パラメータ規模のGPTモデルの構築と評価](https://www.anlp.jp/proceedings/annual_meeting/2023/pdf_dir/H9-4.pdf)
class_docstr_tok: ["prompt","template","is","taken","from","[","\u65e5\u672c\u8a9e\u306b\u7279\u5316\u3057\u305f60\u5104\u30d1\u30e9\u30e1\u30fc\u30bf\u898f\u6a21\u306eGPT\u30e2\u30c7\u30eb\u306e\u69cb\u7bc9\u3068\u8a55\u4fa1","]","(","https",":","\/\/www.anlp.jp\/proceedings\/annual_meeting\/2023\/pdf_dir\/H9-4.pdf",")"]
code: def fewshot_context(self, doc, num_fewshot, **kwargs):
      max_num_tokens = max(
          [
              len(self._tokenize(answer))
              for answer in doc["answers"]["text"]
          ]
      )
      max_length = self.max_length - max_num_tokens
  
      # If the prompt is too long with fewshot examples, reduce the number of
      # examples until it fits.
      while num_fewshot >= 0:
          ctx = super().fewshot_context(doc, num_fewshot, **kwargs)
          if len(self._tokenize(ctx)) <= max_length:
              doc["context"] = ctx
              return ctx
          num_fewshot -= 1
  
      # if we got here then even 0 fewshot is too long
      return ValueError(
          f"0-shot prompt is too long for max length {max_length}:\n{ctx}"
      )
  
imports: import os
  import inspect
  import datasets
  from math import exp
  from lm_eval.base import rf, Task
  from functools import partial
  from lm_eval.jasquad import jasquad
label_desc: Use image node_id 14 for calling the JAQKETV2 obj's underlying member method code with example usage: obj.fewshot_context(doc, num_fewshot) and returns: ValueError, ctx