Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cdc0664
test(huggingface): mark the old tests with their upstream cases
cunninghamcard-bit Oct 20, 2026
33bc2d5
test(huggingface): port the remaining upstream tests
cunninghamcard-bit Oct 20, 2026
34573a0
fix(huggingface): MCP calls are not dynamic matches @ai-sdk/huggingfa…
cunninghamcard-bit Oct 20, 2026
768950e
fix(huggingface): output items yield a tool-result matches @ai-sdk/hu…
cunninghamcard-bit Oct 20, 2026
72fc9f5
fix(huggingface): stream errors end with an error finish matches @ai-…
cunninghamcard-bit Oct 20, 2026
eb5741b
test(huggingface): map the upstream files in layout.toml
cunninghamcard-bit Oct 20, 2026
26cf0a8
fix(huggingface): MCP calls are not dynamic matches @ai-sdk/huggingfa…
cunninghamcard-bit Oct 20, 2026
fcdc9c0
fix(huggingface): output items yield a tool-result matches @ai-sdk/hu…
cunninghamcard-bit Oct 20, 2026
a351988
fix(huggingface): stream errors end with an error finish matches @ai-…
cunninghamcard-bit Oct 20, 2026
7f0f732
Merge the Hugging Face fix PRs into the test port
cunninghamcard-bit Oct 20, 2026
84c2335
test(huggingface): the error-text exclusions still hold after #268
cunninghamcard-bit Oct 20, 2026
ca4b932
Merge branch 'master' into fix/hugging-face-stream-errors-end-with-an…
cunninghamcard-bit Oct 20, 2026
e0150c1
Merge master into fix/hugging-face-stream-errors-end-with-an-error-fi…
cunninghamcard-bit Oct 24, 2026
36b3e4e
Merge fix/hugging-face-stream-errors-end-with-an-error-finish into te…
cunninghamcard-bit Oct 24, 2026
5daa1c6
Merge master into fix/hugging-face-stream-errors-end-with-an-error-fi…
cunninghamcard-bit Oct 25, 2026
670e8c8
Merge remote-tracking branch 'origin/fix/hugging-face-stream-errors-e…
cunninghamcard-bit Oct 25, 2026
3bc293e
Merge remote-tracking branch 'origin/master' into fix/hugging-face-st…
cunninghamcard-bit Oct 25, 2026
b1e436b
Merge branch 'fix/hugging-face-stream-errors-end-with-an-error-finish…
cunninghamcard-bit Oct 25, 2026
e4437f4
Merge remote-tracking branch 'origin/master' into fix/hugging-face-st…
cunninghamcard-bit Oct 25, 2026
68ec40a
Merge branch 'fix/hugging-face-stream-errors-end-with-an-error-finish…
cunninghamcard-bit Oct 25, 2026
1eab5c6
Merge remote-tracking branch 'origin/master' into fix/hugging-face-st…
cunninghamcard-bit Oct 25, 2026
98a0417
Merge branch 'fix/hugging-face-stream-errors-end-with-an-error-finish…
cunninghamcard-bit Oct 25, 2026
dda600c
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 25, 2026
a49742d
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
claude Oct 25, 2026
b6cdf58
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 27, 2026
bba572c
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 27, 2026
1b45da3
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 27, 2026
a7b00e8
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 27, 2026
8126f92
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions aimux-providers/layout.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2440,3 +2440,96 @@ status = "mapped"
upstream = "src/version.ts"
status = "not-applicable"
reason = "VERSION is the package version string; aimux pins it in shared/aisdk_pins.rs, which the user-agent tests read"

[huggingface]
package = "@ai-sdk/huggingface"

[[huggingface.files]]
upstream = "src/huggingface-config.ts"
rust = "huggingface.rs"
status = "mapped"

[huggingface.files.tests]

[[huggingface.files]]
upstream = "src/huggingface-error.ts"
rust = "huggingface/responses.rs"
status = "mapped"

[huggingface.files.tests]

[[huggingface.files]]
upstream = "src/huggingface-provider.ts"
rust = "huggingface.rs"
status = "mapped"

[huggingface.files.tests]
sub-feature = [
{ case = "HuggingFaceProvider › unsupported functionality › should throw for text embedding models", issue = 276, reason = "aimux-core NoSuchModel carries only model_id and model_type and formats as \"no such model: …\", without the provider's own message" },
{ case = "HuggingFaceProvider › unsupported functionality › should throw for image models", issue = 276, reason = "aimux-core NoSuchModel carries only model_id and model_type and formats as \"no such model: …\", without the provider's own message" },
]

[[huggingface.files]]
upstream = "src/index.ts"
rust = "huggingface.rs"
status = "mapped"

[huggingface.files.tests]

[[huggingface.files]]
upstream = "src/responses/convert-huggingface-responses-usage.ts"
rust = "huggingface/responses.rs"
status = "mapped"

[huggingface.files.tests]

[[huggingface.files]]
upstream = "src/responses/convert-to-huggingface-responses-messages.ts"
rust = "huggingface/responses.rs"
status = "mapped"

[huggingface.files.tests]

[[huggingface.files]]
upstream = "src/responses/huggingface-responses-language-model-options.ts"
rust = "huggingface/options.rs"
status = "mapped"

[huggingface.files.tests]

[[huggingface.files]]
upstream = "src/responses/huggingface-responses-language-model.ts"
rust = "huggingface/responses.rs"
status = "mapped"

[huggingface.files.tests]
registered = [
{ case = "HuggingFaceResponsesLanguageModel › doStream › preserves $expectedType stream errors", ref = "SSE 预读", reason = "an error as the first SSE event is returned by do_stream as Err, not as an error part of the stream" },
]
sub-feature = [
{ case = "HuggingFaceResponsesLanguageModel › message conversion › should throw for file parts with provider references", issue = 276, reason = "aimux-core formats UnsupportedFunctionalityError as \"unsupported functionality: …\", not upstream's \"'…' functionality not supported.\"" },
]

[[huggingface.files]]
upstream = "src/responses/huggingface-responses-prepare-tools.ts"
rust = "huggingface/responses.rs"
status = "mapped"

[huggingface.files.tests]

[[huggingface.files]]
upstream = "src/responses/map-huggingface-responses-finish-reason.ts"
rust = "huggingface/responses.rs"
status = "mapped"

[huggingface.files.tests]

[[huggingface.files]]
upstream = "src/responses/huggingface-responses-settings.ts"
status = "not-applicable"
reason = "only the HuggingFaceResponsesModelId string union; Rust takes the model id as &str"

[[huggingface.files]]
upstream = "src/version.ts"
status = "not-applicable"
reason = "the crate version is used instead (RFC-0046 §4.2)"
3 changes: 3 additions & 0 deletions aimux-providers/src/huggingface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,6 @@ impl ProviderDiscovery for HuggingFaceProvider {
Box::pin(async move { crate::openai::model::list_models_once(&config).await })
}
}

#[cfg(test)]
mod tests;
4 changes: 4 additions & 0 deletions aimux-providers/src/huggingface/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//! Ports of the `@ai-sdk/huggingface@2.0.62` test files.

mod provider;
mod responses;
81 changes: 81 additions & 0 deletions aimux-providers/src/huggingface/tests/provider.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//! Port of `src/huggingface-provider.test.ts`.
//!
//! Harness differences from the TypeScript (expectations are unchanged):
//! - `typeof provider === 'function'` and the `[Function]` snapshot are checked
//! by calling [`HuggingFaceProvider::call`], the Rust form of the callable
//! provider.
//! - `typeof provider.responses === 'function'` is checked by a typed binding:
//! the method exists and returns the Responses model.

use std::collections::HashMap;
use std::sync::Arc;

use crate::{HuggingFaceProviderSettings, HuggingFaceResponsesModel, create_huggingface};
use aimux_core::language_model::LanguageModel;
use aimux_core::provider::Provider;

mod hugging_face_provider {
use super::*;

mod create_hugging_face {
use super::*;

/// upstream: @ai-sdk/huggingface src/huggingface-provider.test.ts › HuggingFaceProvider › createHuggingFace › should create provider with default configuration
#[test]
fn should_create_provider_with_default_configuration() {
let provider =
create_huggingface(HuggingFaceProviderSettings::default()).expect("valid settings");

let _model: Arc<dyn LanguageModel> = provider.call("any-model");
let _responses: HuggingFaceResponsesModel = provider.responses("any-model");
provider
.language_model("any-model")
.expect("language model");
}

/// upstream: @ai-sdk/huggingface src/huggingface-provider.test.ts › HuggingFaceProvider › createHuggingFace › should create provider with custom settings
#[test]
fn should_create_provider_with_custom_settings() {
let provider = create_huggingface(HuggingFaceProviderSettings {
api_key: Some("custom-key".to_string().into()),
base_url: Some("https://custom.url".to_string()),
headers: Some(HashMap::from([(
"Custom-Header".to_string(),
Some("test".to_string()),
)])),
..Default::default()
})
.expect("valid settings");

let _model: Arc<dyn LanguageModel> = provider.call("any-model");
let _responses: HuggingFaceResponsesModel = provider.responses("any-model");
provider
.language_model("any-model")
.expect("language model");
}
}

mod model_creation_methods {
use super::*;

/// upstream: @ai-sdk/huggingface src/huggingface-provider.test.ts › HuggingFaceProvider › model creation methods › should expose responses method
#[test]
fn should_expose_responses_method() {
let provider =
create_huggingface(HuggingFaceProviderSettings::default()).expect("valid settings");

let _responses: HuggingFaceResponsesModel = provider.responses("any-model");
}

/// upstream: @ai-sdk/huggingface src/huggingface-provider.test.ts › HuggingFaceProvider › model creation methods › should expose languageModel method
#[test]
fn should_expose_language_model_method() {
let provider =
create_huggingface(HuggingFaceProviderSettings::default()).expect("valid settings");

let _model: Arc<dyn LanguageModel> = provider
.language_model("any-model")
.expect("language model");
}
}
}
3 changes: 3 additions & 0 deletions aimux-providers/src/huggingface/tests/responses/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! Ports of `src/responses/huggingface-responses-language-model.test.ts`.

mod responses_language_model;
Loading
Loading