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>
This commit is contained in:
Edwin Jose 2025-04-15 09:57:55 -04:00 committed by GitHub
commit d421de5b8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 3 deletions

View file

@ -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

View file

@ -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