This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 70ebd3fba fix(services/huggingface): Allow users to use datasets as an 
alias to dataset repo type (#6826)
70ebd3fba is described below

commit 70ebd3fbadcdabb76b1addfe2e0b6ddbbb444214
Author: Xuanwo <[email protected]>
AuthorDate: Thu Nov 27 19:39:39 2025 +0800

    fix(services/huggingface): Allow users to use datasets as an alias to 
dataset repo type (#6826)
    
    * fix(services/huggingface): Allow users to use datasets as an alias to 
dataset repo type
    
    Signed-off-by: Xuanwo <[email protected]>
    
    * Fix test
    
    Signed-off-by: Xuanwo <[email protected]>
    
    ---------
    
    Signed-off-by: Xuanwo <[email protected]>
---
 core/src/services/huggingface/backend.rs | 17 ++++++++++++++++-
 core/src/services/huggingface/config.rs  |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/core/src/services/huggingface/backend.rs 
b/core/src/services/huggingface/backend.rs
index 96ab07163..49fa1618e 100644
--- a/core/src/services/huggingface/backend.rs
+++ b/core/src/services/huggingface/backend.rs
@@ -44,6 +44,7 @@ impl HuggingfaceBuilder {
     /// Available values:
     /// - model
     /// - dataset
+    /// - datasets (alias for dataset)
     ///
     /// Currently, only models and datasets are supported.
     /// [Reference](https://huggingface.co/docs/hub/repositories)
@@ -128,7 +129,7 @@ impl Builder for HuggingfaceBuilder {
 
         let repo_type = match self.config.repo_type.as_deref() {
             Some("model") => Ok(RepoType::Model),
-            Some("dataset") => Ok(RepoType::Dataset),
+            Some("dataset") | Some("datasets") => Ok(RepoType::Dataset),
             Some("space") => Err(Error::new(
                 ErrorKind::ConfigInvalid,
                 "repo type \"space\" is unsupported",
@@ -290,3 +291,17 @@ pub enum RepoType {
     Model,
     Dataset,
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn build_accepts_datasets_alias() {
+        HuggingfaceBuilder::default()
+            .repo_id("org/repo")
+            .repo_type("datasets")
+            .build()
+            .expect("builder should accept datasets alias");
+    }
+}
diff --git a/core/src/services/huggingface/config.rs 
b/core/src/services/huggingface/config.rs
index 6b4034bfb..508eb289f 100644
--- a/core/src/services/huggingface/config.rs
+++ b/core/src/services/huggingface/config.rs
@@ -33,6 +33,7 @@ pub struct HuggingfaceConfig {
     /// Available values:
     /// - model
     /// - dataset
+    /// - datasets (alias for dataset)
     pub repo_type: Option<String>,
     /// Repo id of this backend.
     ///

Reply via email to