From f6d08a3d0ad3de8e33c4554538a4a8d3cae4469b Mon Sep 17 00:00:00 2001 From: sammyvoncheese Date: Wed, 5 Mar 2025 19:08:08 -0500 Subject: [PATCH] Update toolSupport.ts 3 Ollama logic changes. - Added logic to pull off the model name from a model which includes an extended path like "hf.co/DevQuasar/ibm-granite.granite-3.2-8b-instruct-preview-GGUF:F16" - added a "granite-3" check to support Hf format for the model name - changed the string compare to look for the model names in the whole string --- core/llm/toolSupport.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index 1e23cbf3e..ebe6599f8 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -57,9 +57,18 @@ export const PROVIDER_TOOL_SUPPORT: Record< }, // https://ollama.com/search?c=tools ollama: (model) => { + let modelName = ""; + // Extract the model name after the last slash to support other registries + if(model.includes("/")) { + let parts = model.split('/'); + modelName = parts[parts.length - 1]; + } else { + modelName = model; + } + if ( ["vision", "math", "guard", "mistrallite", "mistral-openorca"].some( - (part) => model.toLowerCase().includes(part), + (part) => modelName.toLowerCase().includes(part), ) ) { return false; @@ -79,10 +88,11 @@ export const PROVIDER_TOOL_SUPPORT: Record< "nemotron", "llama3-groq", "granite3", + "granite-3", "aya-expanse", "firefunction-v2", "mistral", - ].some((part) => model.toLowerCase().startsWith(part)) + ].some((part) => modelName.toLowerCase().includes(part)) ) { return true; }