code: def _squad_update(
      preds: Dict[str, str],
      target: List[Dict[str, List[Dict[str, List[Dict[str, Any]]]]]],
  ) -> Tuple[Tensor, Tensor, Tensor]:
      """Compute F1 Score and Exact Match for a collection of predictions and references.
  
      Args:
          preds: A dictionary mapping an `id` to the predicted `answer`.
          target:
              A list of dictionary mapping `paragraphs` to list of dictionary mapping `qas` to a list of dictionary
              containing `id` and list of all possible `answers`.
  
      Return:
          Tuple containing F1 score, Exact match score and total number of examples.
  
      Example:
          >>> from torchmetrics.functional.text.squad import _squad_update
          >>> preds = [{"prediction_text": "1976", "id": "56e10a3be3433e1400422b22"}]
          >>> target = [{"answers": {"answer_start": [97], "text": ["1976"]}, "id": "56e10a3be3433e1400422b22"}]
          >>> preds_dict = {pred["id"]: pred["prediction_text"] for pred in preds}
          >>> targets_dict = [
          ...     dict(paragraphs=[dict(qas=[dict(answers=[
          ...         {"text": txt} for txt in tgt["answers"]["text"]], id=tgt["id"]) for tgt in target
          ...     ])])
          ... ]
          >>> _squad_update(preds_dict, targets_dict)
          (tensor(1.), tensor(1.), tensor(1))
  
      """
      f1 = tensor(0.0)
      exact_match = tensor(0.0)
      total = tensor(0)
      for article in target:
          for paragraph in article["paragraphs"]:
              for qa in paragraph["qas"]:
                  total += 1
                  if qa["id"] not in preds:
                      rank_zero_warn(
                          f"Unanswered question {qa['id']} will receive score 0."
                      )
                      continue
                  ground_truths = [x["text"] for x in qa["answers"]]
                  pred = preds[qa["id"]]
                  exact_match += _metric_max_over_ground_truths(
                      _compute_exact_match_score, pred, ground_truths
                  )
                  f1 += _metric_max_over_ground_truths(
                      _compute_f1_score, pred, ground_truths
                  )
  
      return f1, exact_match, total
  
file_path: torchmetrics/src/torchmetrics/functional/text/squad.py
imports: import re
  import string
  from collections import Counter
  from typing import Any, Callable, Dict, List, Tuple, Union
  from torch import Tensor, tensor
  from torchmetrics.utilities import rank_zero_warn
label_desc: Use image node_id 7 for calling a global function with example usage: _squad_update(preds, target) and returns: f1,  exact_match,  total