🔧 chore(llms.py): add extra fields for VertexAI template and modify field type for "credentials"
📝 chore(llms.py): improve field configuration for VertexAI template and modify field type for "credentials"
The `add_extra_fields` method is modified to add an additional field called "credentials" for the VertexAI template. The field is of type "file" and is required. It allows the user to upload a JSON file as credentials. The `format_openai_field` method is also updated to handle the new "credentials" field.
This commit is contained in:
parent
879390488e
commit
4d72c92e4c
1 changed files with 18 additions and 0 deletions
|
|
@ -6,6 +6,21 @@ from langflow.template.frontend_node.constants import OPENAI_API_BASE_INFO
|
|||
|
||||
|
||||
class LLMFrontendNode(FrontendNode):
|
||||
def add_extra_fields(self) -> None:
|
||||
if self.template.type_name == "VertexAI":
|
||||
# Add credentials field which should of type file.
|
||||
self.template.add_field(
|
||||
TemplateField(
|
||||
field_type="file",
|
||||
required=True,
|
||||
show=True,
|
||||
name="credentials",
|
||||
value="",
|
||||
suffixes=[".json"],
|
||||
fileTypes=["json"],
|
||||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def format_openai_field(field: TemplateField):
|
||||
if "openai" in field.name.lower():
|
||||
|
|
@ -81,6 +96,9 @@ class LLMFrontendNode(FrontendNode):
|
|||
"model_file",
|
||||
"model_type",
|
||||
"deployment_name",
|
||||
"credentials",
|
||||
]:
|
||||
field.advanced = False
|
||||
field.show = True
|
||||
if field.name == "credentials":
|
||||
field.field_type = "file"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue