mirror of
https://github.com/aaif-goose/goose.git
synced 2026-06-01 22:09:18 +02:00
Prefer goose aliases for Databricks v2 inventory (#9430)
Signed-off-by: Bradley Axen <baxen@squareup.com>
This commit is contained in:
@@ -881,10 +881,10 @@ fn enrich_model_ids_with_canonical(
|
||||
models.push(model);
|
||||
}
|
||||
|
||||
// For databricks, prefer goose- prefixed model_ids when there are duplicates.
|
||||
// For Databricks providers, prefer goose- prefixed model_ids when there are duplicates.
|
||||
// Re-scan: if a later model_id with "goose-" prefix maps to the same display name,
|
||||
// swap it in.
|
||||
if provider_family == "databricks" {
|
||||
if matches!(provider_family, "databricks" | "databricks_v2") {
|
||||
let mut name_to_idx: HashMap<String, usize> = HashMap::new();
|
||||
for (idx, model) in models.iter().enumerate() {
|
||||
name_to_idx.insert(model.name.clone(), idx);
|
||||
@@ -1178,6 +1178,26 @@ mod tests {
|
||||
assert!(models[0].name.contains("Claude"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn databricks_v2_inventory_prefers_goose_model_ids_for_duplicate_names() {
|
||||
let models = enrich_model_ids_with_canonical(
|
||||
"databricks_v2",
|
||||
&[
|
||||
"databricks-gpt-5-5".to_string(),
|
||||
"goose-gpt-5-5".to_string(),
|
||||
],
|
||||
);
|
||||
|
||||
assert!(
|
||||
models.iter().any(|model| model.id == "goose-gpt-5-5"),
|
||||
"expected goose-gpt-5-5 to win duplicate canonical-name tie, got {models:?}"
|
||||
);
|
||||
assert!(
|
||||
!models.iter().any(|model| model.id == "databricks-gpt-5-5"),
|
||||
"expected databricks-gpt-5-5 to be replaced by goose-gpt-5-5, got {models:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inventory_uses_configured_models_before_first_successful_refresh() {
|
||||
let configured_models = [ModelInfo::new("claude-sonnet-4-5", 0)];
|
||||
|
||||
Reference in New Issue
Block a user