mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-10 03:30:59 +00:00
The crate reorganization renamed lib/crates/ to lib/apps|components|foundation/. Git followed all modified files across the rename; the only conflict was the newly added codec/cache.rs, now placed at lib/components/fabro-llm/src/codec/cache.rs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
44 lines
1.4 KiB
Rust
44 lines
1.4 KiB
Rust
use std::any::{TypeId, type_name};
|
|
|
|
use fabro_api::types::ModelFeatures as ApiModelFeatures;
|
|
use fabro_model::{ModelFeatures, ReasoningEffortFeature};
|
|
|
|
#[test]
|
|
fn model_features_reuses_canonical_type() {
|
|
assert_same_type::<ApiModelFeatures, ModelFeatures>();
|
|
}
|
|
|
|
#[test]
|
|
fn model_features_json_matches_openapi_shape() {
|
|
let features = ModelFeatures {
|
|
tools: true,
|
|
vision: true,
|
|
reasoning: true,
|
|
reasoning_effort: ReasoningEffortFeature::Levels,
|
|
prompt_cache: false,
|
|
cache_control_breakpoints: false,
|
|
sampling_params: true,
|
|
};
|
|
|
|
let json = serde_json::to_value(&features).unwrap();
|
|
assert_eq!(json["tools"], true);
|
|
assert_eq!(json["vision"], true);
|
|
assert_eq!(json["reasoning"], true);
|
|
assert_eq!(json["reasoning_effort"], "levels");
|
|
assert_eq!(json["prompt_cache"], false);
|
|
assert_eq!(json["cache_control_breakpoints"], false);
|
|
assert_eq!(json["sampling_params"], true);
|
|
|
|
let round_trip: ApiModelFeatures = serde_json::from_value(json).unwrap();
|
|
assert_eq!(round_trip, features);
|
|
}
|
|
|
|
fn assert_same_type<T: 'static, U: 'static>() {
|
|
assert_eq!(
|
|
TypeId::of::<T>(),
|
|
TypeId::of::<U>(),
|
|
"{} should be the same type as {}",
|
|
type_name::<T>(),
|
|
type_name::<U>()
|
|
);
|
|
}
|