From 3167330cbc8a2c14eb42a39628a2995a78c12b15 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 12:57:16 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix(validate.py):=20add=20"BaseO?= =?UTF-8?q?utputParser"=20to=20the=20list=20of=20input=5Ftypes=20in=20the?= =?UTF-8?q?=20template=5Ffield=20=F0=9F=94=A7=20fix(settings.py):=20add=20?= =?UTF-8?q?"output=5Fparsers"=20attribute=20to=20the=20Settings=20class=20?= =?UTF-8?q?The=20"input=5Ftypes"=20list=20in=20the=20template=5Ffield=20of?= =?UTF-8?q?=20the=20post=5Fvalidate=5Fprompt=20function=20in=20validate.py?= =?UTF-8?q?=20was=20missing=20the=20"BaseOutputParser"=20type.=20This=20fi?= =?UTF-8?q?x=20adds=20it=20to=20the=20list=20to=20ensure=20proper=20valida?= =?UTF-8?q?tion.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/backend/langflow/api/v1/validate.py | 2 +- src/backend/langflow/settings.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/api/v1/validate.py b/src/backend/langflow/api/v1/validate.py index b5b886816..184657a63 100644 --- a/src/backend/langflow/api/v1/validate.py +++ b/src/backend/langflow/api/v1/validate.py @@ -42,7 +42,7 @@ def post_validate_prompt(prompt: ValidatePromptRequest): field_type="str", show=True, advanced=False, - input_types=["BaseLoader"], + input_types=["BaseLoader", "BaseOutputParser"], ) prompt.frontend_node.template[variable] = template_field.to_dict() diff --git a/src/backend/langflow/settings.py b/src/backend/langflow/settings.py index e3644e84c..8fe508210 100644 --- a/src/backend/langflow/settings.py +++ b/src/backend/langflow/settings.py @@ -19,6 +19,7 @@ class Settings(BaseSettings): toolkits: List[str] = [] textsplitters: List[str] = [] utilities: List[str] = [] + output_parsers: List[str] = [] dev: bool = False database_url: str = "sqlite:///./langflow.db" cache: str = "InMemoryCache" @@ -48,6 +49,10 @@ class Settings(BaseSettings): self.toolkits = new_settings.toolkits or [] self.textsplitters = new_settings.textsplitters 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 def update_settings(self, **kwargs):