From d421de5b8b98d07301e8aa6f7690cd1732d55621 Mon Sep 17 00:00:00 2001 From: Edwin Jose Date: Tue, 15 Apr 2025 09:57:55 -0400 Subject: [PATCH] feat: add tool mode unsupported list for groq Models (#7497) * update groq Models Tested curated list of latest models * add tool mode tested models * Update src/backend/base/langflow/base/models/groq_constants.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * [autofix.ci] apply automated fixes --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- .../base/langflow/base/models/groq_constants.py | 10 ++++++++++ src/backend/base/langflow/components/models/groq.py | 12 +++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/backend/base/langflow/base/models/groq_constants.py b/src/backend/base/langflow/base/models/groq_constants.py index 9d0124236..62c2f4282 100644 --- a/src/backend/base/langflow/base/models/groq_constants.py +++ b/src/backend/base/langflow/base/models/groq_constants.py @@ -42,6 +42,16 @@ UNSUPPORTED_GROQ_MODELS = [ "whisper-large-v3-turbo", # OpenAI "distil-whisper-large-v3-en", # HuggingFace ] + +TOOL_CALLING_UNSUPPORTED_GROQ_MODELS = [ + "allam-2-7b", # Saudi Data and AI Authority (SDAIA) + "llama-3.1-8b-instant", # Meta Slow Response + "llama-guard-3-8b", # Meta + "llama-3.2-11b-vision-preview", # Meta + "llama3-8b-8192", # Meta + "llama3-70b-8192", # Meta + "deepseek-r1-distill-llama-70b", # DeepSeek +] # Combined list of all current models for backward compatibility GROQ_MODELS = GROQ_PRODUCTION_MODELS + GROQ_PREVIEW_MODELS diff --git a/src/backend/base/langflow/components/models/groq.py b/src/backend/base/langflow/components/models/groq.py index 28c76a9af..f45812e16 100644 --- a/src/backend/base/langflow/components/models/groq.py +++ b/src/backend/base/langflow/components/models/groq.py @@ -2,7 +2,11 @@ import requests from loguru import logger from pydantic.v1 import SecretStr -from langflow.base.models.groq_constants import GROQ_MODELS +from langflow.base.models.groq_constants import ( + GROQ_MODELS, + TOOL_CALLING_UNSUPPORTED_GROQ_MODELS, + UNSUPPORTED_GROQ_MODELS, +) from langflow.base.models.model import LCModelComponent from langflow.field_typing import LanguageModel from langflow.field_typing.range_spec import RangeSpec @@ -78,7 +82,9 @@ class GroqModel(LCModelComponent): response = requests.get(url, headers=headers, timeout=10) response.raise_for_status() model_list = response.json() - model_ids = [model["id"] for model in model_list.get("data", [])] + model_ids = [ + model["id"] for model in model_list.get("data", []) if model["id"] not in UNSUPPORTED_GROQ_MODELS + ] except (ImportError, ValueError, requests.exceptions.RequestException) as e: logger.exception(f"Error getting model names: {e}") model_ids = GROQ_MODELS @@ -94,7 +100,7 @@ class GroqModel(LCModelComponent): api_key=self.api_key, base_url=self.base_url, ) - if not self.supports_tool_calling(model_with_tool): + if not self.supports_tool_calling(model_with_tool) or model in TOOL_CALLING_UNSUPPORTED_GROQ_MODELS: model_ids.remove(model) return model_ids return model_ids