From 7dce8cd499137b01cad5a79be48e33bb26249cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcios=20Batista=20da=20Silva?= Date: Thu, 16 Jan 2025 13:27:52 -0300 Subject: [PATCH] feat: enhance AIML model input validation and UX (#5702) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * git commit -m feat: improve model input fields 1. Make api_key field required 2. Convert temperature to SliderInput with range 0-2 Co-authored-by: VinĂ­cios Batista da Silva * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Gabriel Luiz Freitas Almeida --- .../base/langflow/components/models/aiml.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/backend/base/langflow/components/models/aiml.py b/src/backend/base/langflow/components/models/aiml.py index 202f47fd5..dd0613b6a 100644 --- a/src/backend/base/langflow/components/models/aiml.py +++ b/src/backend/base/langflow/components/models/aiml.py @@ -6,7 +6,14 @@ from langflow.base.models.aiml_constants import AimlModels from langflow.base.models.model import LCModelComponent from langflow.field_typing import LanguageModel from langflow.field_typing.range_spec import RangeSpec -from langflow.inputs import DictInput, DropdownInput, FloatInput, IntInput, SecretStrInput, StrInput +from langflow.inputs import ( + DictInput, + DropdownInput, + IntInput, + SecretStrInput, + SliderInput, + StrInput, +) class AIMLModelComponent(LCModelComponent): @@ -46,8 +53,11 @@ class AIMLModelComponent(LCModelComponent): info="The AIML API Key to use for the OpenAI model.", advanced=False, value="AIML_API_KEY", + required=True, + ), + SliderInput( + name="temperature", display_name="Temperature", value=0.1, range_spec=RangeSpec(min=0, max=2, step=0.01) ), - FloatInput(name="temperature", display_name="Temperature", value=0.1), ] @override