def create_resource_path(
    resource_path: OLIVE_RESOURCE_ANNOTATIONS,
) -> Optional[ResourcePath]:
    """Create a resource path from a string or a dict.

    If a string or Path is provided, it is inferred to be a file, folder, or string name.
    If a dict is provided, it must have "type" and "config" fields. The "type" field must be one of the
    values in the ResourceType enum. The "config" field must be a dict that can be used to create a resource
    config of the specified type.

    :param resource_path:
    :return: A resource path.
    """
    if resource_path is None:
        return None
    if isinstance(resource_path, ResourcePath):
        return resource_path
    if isinstance(resource_path, (ResourcePathConfig, dict)):
        resource_path_config = validate_config(resource_path, ResourcePathConfig)
        return resource_path_config.create_resource_path()

    # check if the resource path is a file, folder, azureml datastore, or a string name
    resource_type: ResourceType = None
    config_key = None
    if Path(resource_path).is_file():
        resource_type = ResourceType.LocalFile
        config_key = "path"
    elif Path(resource_path).is_dir():
        resource_type = ResourceType.LocalFolder
        config_key = "path"
    elif str(resource_path).startswith("azureml://"):
        resource_type = ResourceType.AzureMLDatastore
        config_key = "datastore_url"
    else:
        resource_type = ResourceType.StringName
        config_key = "name"

    return ResourcePathConfig(type=resource_type, config={config_key: resource_path}).create_resource_path()
Create a resource path from a string or a dict.

    If a string or Path is provided, it is inferred to be a file, folder, or string name.
    If a dict is provided, it must have "type" and "config" fields. The "type" field must be one of the
    values in the ResourceType enum. The "config" field must be a dict that can be used to create a resource
    config of the specified type.

    :param resource_path:
    :return: A resource path.
    
olive/resource_path.py