code: def LossDataclassField(feature_type: str, default: str) -> Field:
      loss_registry = get_loss_classes(feature_type)
  
      class LossSelection(schema_utils.TypeSelection):
          def __init__(self):
              super().__init__(
                  registry=loss_registry, default_value=default
              )
  
          def get_schema_from_registry(
              self, key: str
          ) -> Type[schema_utils.BaseMarshmallowConfig]:
              return get_loss_cls(feature_type, key)
  
          def _jsonschema_type_mapping(self):
              return {
                  "type": "object",
                  "properties": {
                      "type": {
                          "type": "string",
                          "enum": list(loss_registry.keys()),
                          "default": default,
                      },
                  },
                  "title": "loss_options",
                  "allOf": get_loss_conds(feature_type),
              }
  
      return LossSelection().get_default_field()
  
imports: from dataclasses import Field
  from typing import Type
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.schema import utils
  from ludwig.schema.features.loss import get_loss_classes, get_loss_cls
label_desc: Use image node_id 2 for calling a global function with example usage: LossDataclassField(feature_type, default) and returns: LossSelection, get_loss_cls, dict