other template fixes

This commit is contained in:
Gabriel Almeida 2023-04-29 19:35:10 -03:00
commit f0ba11c840
2 changed files with 9 additions and 0 deletions

View file

@ -197,6 +197,7 @@ class FrontendNode(BaseModel):
"examples",
"code",
"headers",
"description",
}
# Replace dict type with str

View file

@ -77,6 +77,12 @@ class PromptTemplateNode(FrontendNode):
def to_dict(self):
return super().to_dict()
@staticmethod
def format_field(field: TemplateField, name: Optional[str] = None) -> None:
FrontendNode.format_field(field, name)
if field.name == "examples":
field.advanced = False
class PythonFunctionNode(FrontendNode):
name: str = "PythonFunction"
@ -486,6 +492,7 @@ class PromptFrontendNode(FrontendNode):
"suffix",
"prefix",
"examples",
"format_instructions",
]
if field.field_type == "StringPromptTemplate" and "Message" in str(name):
field.field_type = "prompt"
@ -496,6 +503,7 @@ class PromptFrontendNode(FrontendNode):
if field.name in PROMPT_FIELDS:
field.field_type = "prompt"
field.advanced = False
if (
"Union" in field.field_type