Switch tetrate tool filtering back to supports_computer_use (#7024)

This commit is contained in:
David Katz
2026-02-06 10:25:24 -05:00
committed by GitHub
parent b1feead405
commit 14a9d1e61e
+6 -24
View File
@@ -299,39 +299,21 @@ impl Provider for TetrateProvider {
let mut models: Vec<String> = data
.iter()
.filter_map(|model| {
// Get the model ID
let id = model.get("id").and_then(|v| v.as_str())?;
// Check if the model supports computer_use (which indicates tool/function support)
// The Tetrate API uses "supports_computer_use" instead of "supported_parameters"
let supported_params =
match model.get("supported_parameters").and_then(|v| v.as_array()) {
Some(params) => params,
None => {
tracing::debug!(
"Model '{}' missing supported_parameters field, skipping",
id
);
return None;
}
};
let has_tool_support = supported_params
.iter()
.any(|param| param.as_str() == Some("tools"));
if has_tool_support {
let supports_computer_use = model
.get("supports_computer_use")
.and_then(|v| v.as_bool())
.unwrap_or(false);
if supports_computer_use {
Some(id.to_string())
} else {
tracing::debug!("Model '{}' does not support tools, skipping", id);
None
}
})
.collect();
// If no models with tool support were found, fall back to manual entry
if models.is_empty() {
tracing::warn!("No models with tool support found in Tetrate Agent Router Service API response, falling back to manual model entry");
tracing::warn!("No models found in Tetrate Agent Router Service API response, falling back to manual model entry");
return Ok(None);
}