Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add Groq Model Constants #4689

Merged
merged 9 commits into from
Nov 19, 2024
21 changes: 20 additions & 1 deletion src/backend/base/langflow/base/models/groq_constants.py
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
MODEL_NAMES = ["llama3-8b-8192", "llama3-70b-8192", "mixtral-8x7b-32768", "gemma-7b-it", "gemma2-9b-it"]
GROQ_MODELS = [
"distil-whisper-large-v3-en", # HuggingFace
"gemma2-9b-it", # Google
"gemma-7b-it", # Google
"llama3-groq-70b-8192-tool-use-preview", # Groq
"llama3-groq-8b-8192-tool-use-preview", # Groq
"llama-3.1-70b-versatile", # Meta
"llama-3.1-8b-instant", # Meta
"llama-3.2-1b-preview", # Meta
"llama-3.2-3b-preview", # Meta
"llama-3.2-11b-vision-preview", # Meta
"llama-3.2-90b-vision-preview", # Meta
"llama-guard-3-8b", # Meta
"llama3-70b-8192", # Meta
"llama3-8b-8192", # Meta
"mixtral-8x7b-32768", # Mistral
"whisper-large-v3", # OpenAI
"whisper-large-v3-turbo", # OpenAI
]
MODEL_NAMES = GROQ_MODELS # reverse compatibility
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def create_input_fields_dict(inputs, prefix):
"prefix": "",
"component_class": OpenAIModelComponent(),
},
"Groq": {"fields": GROQ_FIELDS, "inputs": GROQ_INPUTS, "prefix": "groq_", "component_class": GroqModel()},
"Groq": {"fields": GROQ_FIELDS, "inputs": GROQ_INPUTS, "prefix": "", "component_class": GroqModel()},
"Anthropic": {
"fields": ANTHROPIC_FIELDS,
"inputs": ANTHROPIC_INPUTS,
Expand Down
6 changes: 4 additions & 2 deletions src/backend/base/langflow/components/models/groq.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pydantic.v1 import SecretStr
from typing_extensions import override

from langflow.base.models.groq_constants import GROQ_MODELS
from langflow.base.models.model import LCModelComponent
from langflow.field_typing import LanguageModel
from langflow.inputs.inputs import HandleInput
Expand Down Expand Up @@ -48,7 +49,8 @@ class GroqModel(LCModelComponent):
name="model_name",
display_name="Model",
info="The name of the model to use.",
options=[],
options=GROQ_MODELS,
value="llama-3.1-8b-instant",
refresh_button=True,
),
HandleInput(
Expand All @@ -74,7 +76,7 @@ def get_models(self) -> list[str]:
return [model["id"] for model in model_list.get("data", [])]
except requests.RequestException as e:
self.status = f"Error fetching models: {e}"
return []
return GROQ_MODELS

@override
def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):
Expand Down
Loading