refactor(langflow): set advanced flag to True for TemplateFieldCreator class

refactor(langflow): set advanced flag to False for LLMFrontendNode class' api key field
feat(langflow): add show flag to LLMFrontendNode class' model_kwargs field
refactor(langflow): set advanced flag to False and show flag to True for LLMFrontendNode class' model_name and temperature fields
This commit is contained in:
Gabriel Almeida 2023-04-28 19:17:38 -03:00
commit 0fd8f73c08
2 changed files with 7 additions and 2 deletions

View file

@ -23,7 +23,7 @@ class TemplateFieldCreator(BaseModel, ABC):
options: list[str] = []
name: str = ""
display_name: Optional[str] = None
advanced: bool = False
advanced: bool = True
def to_dict(self):
result = self.dict()
@ -241,4 +241,4 @@ class FrontendNode(BaseModel):
# If the field.name contains api or api and key, then it might be an api key
# other conditions are to make sure that it is not an input or output variable
if "api" in key.lower() and "key" in key.lower():
field.required = False
field.required = False

View file

@ -448,6 +448,7 @@ class LLMFrontendNode(FrontendNode):
# Required should be False to support
# loading the API key from environment variables
field.required = False
field.advanced = False
if field.name == "task":
field.required = True
@ -461,3 +462,7 @@ class LLMFrontendNode(FrontendNode):
if field.name == "model_kwargs":
field.field_type = "code"
field.advanced = True
field.show = True
elif field.name in ["model_name", "temperature"]:
field.advanced = False
field.show = True