Switch tetrate tool filtering back to supports_computer_use (#7024)
This commit is contained in:
@@ -299,39 +299,21 @@ impl Provider for TetrateProvider {
|
|||||||
let mut models: Vec<String> = data
|
let mut models: Vec<String> = data
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|model| {
|
.filter_map(|model| {
|
||||||
// Get the model ID
|
|
||||||
let id = model.get("id").and_then(|v| v.as_str())?;
|
let id = model.get("id").and_then(|v| v.as_str())?;
|
||||||
|
let supports_computer_use = model
|
||||||
// Check if the model supports computer_use (which indicates tool/function support)
|
.get("supports_computer_use")
|
||||||
// The Tetrate API uses "supports_computer_use" instead of "supported_parameters"
|
.and_then(|v| v.as_bool())
|
||||||
let supported_params =
|
.unwrap_or(false);
|
||||||
match model.get("supported_parameters").and_then(|v| v.as_array()) {
|
if supports_computer_use {
|
||||||
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 {
|
|
||||||
Some(id.to_string())
|
Some(id.to_string())
|
||||||
} else {
|
} else {
|
||||||
tracing::debug!("Model '{}' does not support tools, skipping", id);
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// If no models with tool support were found, fall back to manual entry
|
|
||||||
if models.is_empty() {
|
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);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user