def decode_grounding_metadata(
    grounding_metadata: Optional[dict[str, Any]],
) -> Optional[types.GroundingMetadata]:
  """Decodes a grounding metadata object from a JSON dictionary."""
  if not grounding_metadata:
    return None
  return types.GroundingMetadata.model_validate(grounding_metadata)
Decodes a grounding metadata object from a JSON dictionary.
src/google/adk/sessions/_session_util.py