feat: enhance AIML model input validation and UX (#5702)

* 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 <vinicios.batsi@gmail.com>

* [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 <gabriel@langflow.org>
This commit is contained in:
Vinícios Batista da Silva 2025-01-16 13:27:52 -03:00 committed by GitHub
commit 7dce8cd499
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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