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:
parent
0ddc310122
commit
7dce8cd499
1 changed files with 12 additions and 2 deletions
|
|
@ -6,7 +6,14 @@ from langflow.base.models.aiml_constants import AimlModels
|
||||||
from langflow.base.models.model import LCModelComponent
|
from langflow.base.models.model import LCModelComponent
|
||||||
from langflow.field_typing import LanguageModel
|
from langflow.field_typing import LanguageModel
|
||||||
from langflow.field_typing.range_spec import RangeSpec
|
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):
|
class AIMLModelComponent(LCModelComponent):
|
||||||
|
|
@ -46,8 +53,11 @@ class AIMLModelComponent(LCModelComponent):
|
||||||
info="The AIML API Key to use for the OpenAI model.",
|
info="The AIML API Key to use for the OpenAI model.",
|
||||||
advanced=False,
|
advanced=False,
|
||||||
value="AIML_API_KEY",
|
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
|
@override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue