feat: improve model input fields for sambanova component (#5708)

* feat: improve model input fields for sambanova component

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

* [autofix.ci] apply automated fixes (attempt 2/3)

* feat: improve model input fields for sambanova component

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

* [autofix.ci] apply automated fixes (attempt 2/3)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Vinícios Batista da Silva 2025-01-17 14:17:24 -03:00 committed by GitHub
commit 5848b11caa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,7 +4,8 @@ from pydantic.v1 import SecretStr
from langflow.base.models.model import LCModelComponent
from langflow.base.models.sambanova_constants import SAMBANOVA_MODEL_NAMES
from langflow.field_typing import LanguageModel
from langflow.io import DropdownInput, FloatInput, IntInput, SecretStrInput, StrInput
from langflow.field_typing.range_spec import RangeSpec
from langflow.io import DropdownInput, IntInput, SecretStrInput, SliderInput, StrInput
class SambaNovaComponent(LCModelComponent):
@ -37,6 +38,7 @@ class SambaNovaComponent(LCModelComponent):
info="The Sambanova API Key to use for the Sambanova model.",
advanced=False,
value="SAMBANOVA_API_KEY",
required=True,
),
IntInput(
name="max_tokens",
@ -45,7 +47,9 @@ class SambaNovaComponent(LCModelComponent):
value=4096,
info="The maximum number of tokens to generate. Set to 0 for unlimited tokens.",
),
FloatInput(name="temperature", display_name="Temperature", value=0.07),
SliderInput(
name="temperature", display_name="Temperature", value=0.1, range_spec=RangeSpec(min=0, max=2, step=0.01)
),
]
def build_model(self) -> LanguageModel: # type: ignore[type-var]