fix: filter models without tool support from recommended list (#7198)
Signed-off-by: rabi <ramishra@redhat.com>
This commit is contained in:
@@ -142,7 +142,6 @@ pub async fn run_model_list<C: Connection>() {
|
|||||||
"gpt-5-codex",
|
"gpt-5-codex",
|
||||||
"gpt-5",
|
"gpt-5",
|
||||||
"gpt-5-2025-08-07",
|
"gpt-5-2025-08-07",
|
||||||
"gpt-5-chat-latest",
|
|
||||||
"gpt-5-mini",
|
"gpt-5-mini",
|
||||||
"gpt-5-mini-2025-08-07",
|
"gpt-5-mini-2025-08-07",
|
||||||
TEST_MODEL,
|
TEST_MODEL,
|
||||||
@@ -172,16 +171,10 @@ pub async fn run_model_list<C: Connection>() {
|
|||||||
"gpt-4o-2024-05-13",
|
"gpt-4o-2024-05-13",
|
||||||
"gpt-4o-2024-08-06",
|
"gpt-4o-2024-08-06",
|
||||||
"gpt-4o-2024-11-20",
|
"gpt-4o-2024-11-20",
|
||||||
"text-embedding-3-large",
|
|
||||||
"text-embedding-3-small",
|
|
||||||
"gpt-4",
|
"gpt-4",
|
||||||
"gpt-4-0613",
|
"gpt-4-0613",
|
||||||
"gpt-4-turbo",
|
"gpt-4-turbo",
|
||||||
"gpt-4-turbo-2024-04-09",
|
"gpt-4-turbo-2024-04-09",
|
||||||
"gpt-3.5-turbo",
|
|
||||||
"gpt-3.5-turbo-0125",
|
|
||||||
"gpt-3.5-turbo-1106",
|
|
||||||
"text-embedding-ada-002",
|
|
||||||
]
|
]
|
||||||
.iter()
|
.iter()
|
||||||
.map(|id| ModelInfo::new(ModelId::new(*id), *id))
|
.map(|id| ModelInfo::new(ModelId::new(*id), *id))
|
||||||
|
|||||||
@@ -481,6 +481,10 @@ pub trait Provider: Send + Sync {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !canonical_model.tool_call && !self.get_model_config().toolshim {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let release_date = canonical_model.release_date.clone();
|
let release_date = canonical_model.release_date.clone();
|
||||||
|
|
||||||
Some((model.clone(), release_date))
|
Some((model.clone(), release_date))
|
||||||
|
|||||||
@@ -311,7 +311,6 @@ impl Provider for OpenRouterProvider {
|
|||||||
Ok((message, ProviderUsage::new(response_model, usage)))
|
Ok((message, ProviderUsage::new(response_model, usage)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fetch supported models from OpenRouter API (only models with tool support)
|
|
||||||
async fn fetch_supported_models(&self) -> Result<Vec<String>, ProviderError> {
|
async fn fetch_supported_models(&self) -> Result<Vec<String>, ProviderError> {
|
||||||
let response = self
|
let response = self
|
||||||
.api_client
|
.api_client
|
||||||
@@ -350,32 +349,8 @@ impl Provider for OpenRouterProvider {
|
|||||||
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())?;
|
||||||
|
Some(id.to_string())
|
||||||
// Check if the model supports tools
|
|
||||||
let supported_params =
|
|
||||||
match model.get("supported_parameters").and_then(|v| v.as_array()) {
|
|
||||||
Some(params) => params,
|
|
||||||
None => {
|
|
||||||
// If supported_parameters is missing, skip this model (assume no tool support)
|
|
||||||
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())
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user