code: def from_yaml_file(cls, stream: t.IO[t.Any]) -> OpenAPISpecification:
      try:
          yaml_content = yaml.safe_load(stream)
      except yaml.YAMLError as exc:
          logger.error(exc)
          raise
  
      try:
          return bentoml_cattr.structure(yaml_content, cls)
      except cattr.errors.ClassValidationError:
          raise
  
imports: from __future__ import annotations
  import logging
  import typing
  import attr
  import cattr.errors
  import yaml
  from cattr.gen import make_dict_unstructure_fn
  from cattr.gen import override
  from ...utils import bentoml_cattr
label_desc: Use image node_id 2 for calling the OpenAPISpecification obj's underlying member method code with example usage: obj.from_yaml_file(cls, stream) and returns: bentoml_cattr