def _create_transformer_definition(
    transformer_func: Callable, entity_name_to_id_map: dict
) -> schemas.TransformerCreate:
    """Create a transformer definition from a transformer function.

    Args:
        transformer_func: The transformer function
        entity_name_to_id_map: Mapping from entity names to entity IDs

    Returns:
        schemas.TransformerCreate: The transformer definition
    """
    # Get type hints for input/output
    type_hints = get_type_hints(transformer_func)

    # Get input type from first parameter
    first_param = next(iter(inspect.signature(transformer_func).parameters.values()))
    input_type = type_hints[first_param.name]
    input_type_name = input_type.__name__

    # Base types from _base.py are special cases
    base_types = [
        "BaseEntity",
        "ChunkEntity",
        "ParentEntity",
        "FileEntity",
        "PolymorphicEntity",
        "CodeFileEntity",
        "WebEntity",
    ]
    # For input types
    input_entity_ids = []
    if input_type_name in entity_name_to_id_map:
        input_entity_ids = [UUID(id) for id in entity_name_to_id_map[input_type_name]]
    elif input_type_name in base_types:
        # For base types, we don't require entity IDs since they're not directly registered
        # as entity definitions (they're abstract base classes)
        sync_logger.info(
            f"Transformer {transformer_func._name} uses base type {input_type_name} as input"
        )
    else:
        raise ValueError(
            f"Transformer {transformer_func._name} has unknown input type {input_type_name}"
        )

    # Get output types from return annotation
    return_type = type_hints["return"]
    output_types = _get_type_names(return_type)

    # For output types
    output_entity_ids = []
    for type_name in output_types:
        if type_name in entity_name_to_id_map:
            output_entity_ids.extend([UUID(id) for id in entity_name_to_id_map[type_name]])
        elif type_name in base_types:
            # For base types, don't add entity IDs but don't error either
            sync_logger.info(
                f"Transformer {transformer_func._name} uses base type {type_name} as output"
            )
        else:
            raise ValueError(
                f"Transformer {transformer_func._name} has unknown output type {type_name}"
            )

    return schemas.TransformerCreate(
        name=transformer_func._name,
        description=transformer_func.__doc__,
        method_name=transformer_func.__name__,
        module_name=transformer_func.__module__,
        auth_type=getattr(transformer_func, "_auth_type", None),
        auth_config_class=getattr(transformer_func, "_auth_config_class", None),
        config_schema=getattr(transformer_func, "_config_schema", {}),
        input_entity_definition_ids=input_entity_ids,
        output_entity_definition_ids=output_entity_ids,
    )
Create a transformer definition from a transformer function.

    Args:
        transformer_func: The transformer function
        entity_name_to_id_map: Mapping from entity names to entity IDs

    Returns:
        schemas.TransformerCreate: The transformer definition
    
backend/airweave/platform/db_sync.py