code: def generate_triples_factory(
      num_entities: int = 33,
      num_relations: int = 7,
      num_triples: int = 101,
      random_state: TorchRandomHint = None,
      create_inverse_triples: bool = False,
  ) -> CoreTriplesFactory:
      """Generate a triples factory with random triples."""
      mapped_triples = generate_triples(
          num_entities=num_entities,
          num_relations=num_relations,
          num_triples=num_triples,
          random_state=random_state,
      )
      return CoreTriplesFactory.create(
          mapped_triples=mapped_triples,
          create_inverse_triples=create_inverse_triples,
      )
  
imports: import torch
  from .triples_factory import CoreTriplesFactory
  from .utils import get_entities, get_relations
  from ..typing import TorchRandomHint
  from ..utils import ensure_torch_random_state
label_desc: Use image node_id 2 for calling a global function with example usage: generate_triples_factory(num_entities, num_relations, num_triples, random_state, create_inverse_triples) and returns: CoreTriplesFactory