def dashscope_build_configurable_transformation_enum():
    """
    Build an enum of configurable transformations.
    But conditional on if the corresponding component is available.
    """

    class ConfigurableComponent(Enum):
        @classmethod
        def from_component(
            cls, component: BaseComponent
        ) -> "ConfigurableTransformations":
            component_class = type(component)
            for component_type in cls:
                if component_type.value.component_type == component_class:
                    return component_type
            raise ValueError(
                f"Component {component} is not a supported transformation component."
            )

        def build_configured_transformation(
            self, component: BaseComponent
        ) -> "DashScopeConfiguredTransformation":
            component_type = self.value.component_type
            if not isinstance(component, component_type):
                raise ValueError(
                    f"The enum value {self} is not compatible with component of "
                    f"type {type(component)}"
                )
            return DashScopeConfiguredTransformation[component_type](  # type: ignore
                component=component, name=self.value.name
            )

    enum_members = []

    # Node parsers
    try:
        from llama_index.node_parser.dashscope import DashScopeJsonNodeParser

        enum_members.append(
            (
                "DASHSCOPE_JSON_NODE_PARSER",
                ConfigurableTransformation(
                    name="DashScope Json Node Parser",
                    transformation_category=TransformationCategories.NODE_PARSER,
                    component_type=DashScopeJsonNodeParser,
                ),
            )
        )
    except (ImportError, ValidationError):
        pass

    # Embeddings
    try:
        from llama_index.embeddings.dashscope import (
            DashScopeEmbedding,
        )  # pants: no-infer-dep

        enum_members.append(
            (
                "DASHSCOPE_EMBEDDING",
                ConfigurableTransformation(
                    name="DashScope Embedding",
                    transformation_category=TransformationCategories.EMBEDDING,
                    component_type=DashScopeEmbedding,
                ),
            )
        )
    except (ImportError, ValidationError):
        pass

    return ConfigurableComponent("ConfigurableTransformations", enum_members)

    Build an enum of configurable transformations.
    But conditional on if the corresponding component is available.
    
llama-index-integrations/indices/llama-index-indices-managed-dashscope/llama_index/indices/managed/dashscope/transformations.py