🔧 fix(validate.py): add "BaseOutputParser" to the list of input_types in the template_field

🔧 fix(settings.py): add "output_parsers" attribute to the Settings class
The "input_types" list in the template_field of the post_validate_prompt function in validate.py was missing the "BaseOutputParser" type. This fix adds it to the list to ensure proper validation.

The Settings class in settings.py was missing the "output_parsers" attribute. This fix adds the attribute to the class to ensure that the list of output parsers can be properly configured and accessed.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-29 12:57:16 -03:00
commit 3167330cbc
2 changed files with 6 additions and 1 deletions

View file

@ -42,7 +42,7 @@ def post_validate_prompt(prompt: ValidatePromptRequest):
field_type="str", field_type="str",
show=True, show=True,
advanced=False, advanced=False,
input_types=["BaseLoader"], input_types=["BaseLoader", "BaseOutputParser"],
) )
prompt.frontend_node.template[variable] = template_field.to_dict() prompt.frontend_node.template[variable] = template_field.to_dict()

View file

@ -19,6 +19,7 @@ class Settings(BaseSettings):
toolkits: List[str] = [] toolkits: List[str] = []
textsplitters: List[str] = [] textsplitters: List[str] = []
utilities: List[str] = [] utilities: List[str] = []
output_parsers: List[str] = []
dev: bool = False dev: bool = False
database_url: str = "sqlite:///./langflow.db" database_url: str = "sqlite:///./langflow.db"
cache: str = "InMemoryCache" cache: str = "InMemoryCache"
@ -48,6 +49,10 @@ class Settings(BaseSettings):
self.toolkits = new_settings.toolkits or [] self.toolkits = new_settings.toolkits or []
self.textsplitters = new_settings.textsplitters or [] self.textsplitters = new_settings.textsplitters or []
self.utilities = new_settings.utilities or [] self.utilities = new_settings.utilities or []
self.embeddings = new_settings.embeddings or []
self.vectorstores = new_settings.vectorstores or []
self.documentloaders = new_settings.documentloaders or []
self.output_parsers = new_settings.output_parsers or []
self.dev = dev self.dev = dev
def update_settings(self, **kwargs): def update_settings(self, **kwargs):