def METHOD_NAME(
    self, invocation_layer_class: Optional[Type[PromptModelInvocationLayer]]
) -> PromptModelInvocationLayer:
    kwargs = {
        "api_key": self.api_key,
        "use_auth_token": self.use_auth_token,
        "use_gpu": self.use_gpu,
        "devices": self.devices,
    }
    all_kwargs = {**self.model_kwargs, **kwargs}
    if invocation_layer_class:
        return invocation_layer_class(
            model_name_or_path=self.model_name_or_path, max_length=self.max_length, **all_kwargs
        )
    for invocation_layer in PromptModelInvocationLayer.invocation_layer_providers:
        if inspect.isabstract(invocation_layer):
            continue
        if invocation_layer.supports(self.model_name_or_path, **all_kwargs):
            return invocation_layer(
                model_name_or_path=self.model_name_or_path, max_length=self.max_length, **all_kwargs
            )
    raise ValueError(
        f"Model {self.model_name_or_path} is not supported - no matching invocation layer found."
        f" Currently supported invocation layers are: {PromptModelInvocationLayer.invocation_layer_providers}"
        f" You can implement and provide custom invocation layer for {self.model_name_or_path} by subclassing "
        "PromptModelInvocationLayer."
    )