# TEMPLATE = """Some special magic {type_needle_v} are hidden within the following text. Make sure to memorize it. I will quiz you about the {type_needle_v} afterwards.\n{context}\nWhat are all the special magic {type_needle_v} for {query} mentioned in the provided text? The special magic {type_needle_v} for {query} mentioned in the provided text are"""
TEMPLATE="""Some special magic {type_needle_v} are hidden within the following text. Make sure to memorize it. I will quiz you about the {type_needle_v} afterwards.\n{context}\nWhat are all the special magic {type_needle_v} for {query} mentioned in the provided text?"""
SEQ_LENGTHS=(
# 131072,
# 65536,
# 32768,
# 16384,
# 8192,
4096,
)
NUM_SAMPLES=500
REMOVE_NEWLINE_TAB=""
STOP_WORDS=""
RANDOM_SEED=42
@cache
defget_haystack(
type_haystack:Literal["essay","repeat","needle"],
)->Union[list[str],str]:
NEEDLE="One of the special magic {type_needle_v} for {key} is: {value}."
iftype_haystack=="essay":
essay=get_all_essays()["text"]
# essay = json.load(open(essay))["text"]
haystack=re.sub(r"\s+"," ",essay).split(" ")
eliftype_haystack=="repeat":
haystack="The grass is green. The sky is blue. The sun is yellow. Here we go. There and back again."
eliftype_haystack=="needle":
haystack=NEEDLE
else:
raiseNotImplementedError(f"{type_haystack} is not implemented.")