Skip to content

Commit

Permalink
fix: add Groq Model Constants (#4689)
Browse files Browse the repository at this point in the history
* upddate in groq models

groq models updated

* [autofix.ci] apply automated fixes

* Update model_input_constants.py

remove groq prefix

* Update groq.py

updated Groq Model list to be also a backup list if the API call fails, also at start.

* Update groq.py

format issue solved

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
edwinjosechittilappilly and autofix-ci[bot] authored Nov 19, 2024
1 parent 50aa618 commit 699ec18
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
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

0 comments on commit 699ec18

Please sign in to comment.