def preprocess_example(example: RawExample, funcall_format: str) -> RawExample:
  """Returns a preprocessed example according to the funcall format."""
  if funcall_format == "top":
    example = copy.deepcopy(example)
    # For old versions of the JSONL files:
    # Change `input_str` to match the official tokenization.
    if "tokens" in example:
      example["input_str"] = " ".join(example["tokens"])
    # Change `output_str` to be the formatted logical form.
    example["output_str"] = top_utils.format_serialized(example["output_str"])
    return example
  else:
    raise ValueError(f"Unknown funcall_format: {funcall_format}")
Returns a preprocessed example according to the funcall format.
language/casper/augment/casper_formatters.py