Replies: 2 comments 1 reply
-
Hey @TzurV! I'm here to help you with any bugs, questions, or contributions you have. Let's get this sorted out! To resolve the "Sorry, we found an unexpected error!" message when trying to open "Website content QA" examples in LangFlow version 1.0.9, you need to correct the JSON structure of the flow. The provided JSON contains malformed data, specifically the use of "œ" instead of standard quotation marks and other formatting issues. Here is a corrected version of the JSON structure: {
"data": {
"edges": [
{
"data": {
"sourceHandle": {
"dataType": "File",
"id": "File-h46aK",
"name": "data",
"output_types": ["Data"]
},
"targetHandle": {
"fieldName": "data",
"id": "ParseData-sqVr1",
"inputTypes": ["Data"],
"type": "other"
}
},
"id": "reactflow__edge-File-h46aK-ParseData-sqVr1",
"source": "File-h46aK",
"sourceHandle": "data",
"target": "ParseData-sqVr1",
"targetHandle": "data"
},
{
"data": {
"sourceHandle": {
"dataType": "ParseData",
"id": "ParseData-sqVr1",
"name": "text",
"output_types": ["Message"]
},
"targetHandle": {
"fieldName": "Document",
"id": "Prompt-mQ7w2",
"inputTypes": ["Message", "Text"],
"type": "str"
}
},
"id": "reactflow__edge-ParseData-sqVr1-Prompt-mQ7w2",
"source": "ParseData-sqVr1",
"sourceHandle": "text",
"target": "Prompt-mQ7w2",
"targetHandle": "Document"
},
{
"data": {
"sourceHandle": {
"dataType": "ChatInput",
"id": "ChatInput-cMXe0",
"name": "message",
"output_types": ["Message"]
},
"targetHandle": {
"fieldName": "Question",
"id": "Prompt-mQ7w2",
"inputTypes": ["Message", "Text"],
"type": "str"
}
},
"id": "reactflow__edge-ChatInput-cMXe0-Prompt-mQ7w2",
"source": "ChatInput-cMXe0",
"sourceHandle": "message",
"target": "Prompt-mQ7w2",
"targetHandle": "Question"
},
{
"data": {
"sourceHandle": {
"dataType": "Prompt",
"id": "Prompt-mQ7w2",
"name": "prompt",
"output_types": ["Message"]
},
"targetHandle": {
"fieldName": "input_value",
"id": "OpenAIModel-O0AGC",
"inputTypes": ["Message"],
"type": "str"
}
},
"id": "reactflow__edge-Prompt-mQ7w2-OpenAIModel-O0AGC",
"source": "Prompt-mQ7w2",
"sourceHandle": "prompt",
"target": "OpenAIModel-O0AGC",
"targetHandle": "input_value"
},
{
"data": {
"sourceHandle": {
"dataType": "OpenAIModel",
"id": "OpenAIModel-O0AGC",
"name": "text_output",
"output_types": ["Message"]
},
"targetHandle": {
"fieldName": "input_value",
"id": "ChatOutput-efggd",
"inputTypes": ["Message"],
"type": "str"
}
},
"id": "reactflow__edge-OpenAIModel-O0AGC-ChatOutput-efggd",
"source": "OpenAIModel-O0AGC",
"sourceHandle": "text_output",
"target": "ChatOutput-efggd",
"targetHandle": "input_value"
}
],
"nodes": [
{
"data": {
"id": "File-h46aK",
"node": {
"base_classes": ["Data"],
"beta": false,
"conditional_paths": [],
"custom_fields": {},
"description": "A generic file loader.",
"display_name": "File",
"documentation": "",
"edited": false,
"field_order": ["path", "silent_errors"],
"frozen": false,
"icon": "file-text",
"output_types": [],
"outputs": [
{
"cache": true,
"display_name": "Data",
"hidden": false,
"method": "load_file",
"name": "data",
"selected": "Data",
"types": ["Data"],
"value": "__UNDEFINED__"
}
],
"pinned": false,
"template": {
"_type": "Component",
"code": {
"advanced": true,
"dynamic": true,
"fileTypes": [],
"file_path": "",
"info": "",
"list": false,
"load_from_db": false,
"multiline": true,
"name": "code",
"password": false,
"placeholder": "",
"required": true,
"show": true,
"title_case": false,
"type": "code",
"value": "from pathlib import Path\n\nfrom langflow.base.data.utils import TEXT_FILE_TYPES, parse_text_file_to_data\nfrom langflow.custom import Component\nfrom langflow.io import BoolInput, FileInput, Output\nfrom langflow.schema import Data\n\n\nclass FileComponent(Component):\n display_name = \"File\"\n description = \"A generic file loader.\"\n icon = \"file-text\"\n\n inputs = [\n FileInput(\n name=\"path\",\n display_name=\"Path\",\n file_types=TEXT_FILE_TYPES,\n info=f\"Supported file types: {', '.join(TEXT_FILE_TYPES)}\",\n ),\n BoolInput(\n name=\"silent_errors\",\n display_name=\"Silent Errors\",\n advanced=True,\n info=\"If true, errors will not raise an exception.\",\n ),\n ]\n\n outputs = [\n Output(display_name=\"Data\", name=\"data\", method=\"load_file\"),\n ]\n\n def load_file(self) -> Data:\n if not self.path:\n raise ValueError(\"Please, upload a file to use this component.\")\n resolved_path = self.resolve_path(self.path)\n silent_errors = self.silent_errors\n\n extension = Path(resolved_path).suffix[1:].lower()\n\n if extension == \"doc\":\n raise ValueError(\"doc files are not supported. Please save as .docx\")\n if extension not in TEXT_FILE_TYPES:\n raise ValueError(f\"Unsupported file type: {extension}\")\n\n data = parse_text_file_to_data(resolved_path, silent_errors)\n self.status = data if data else \"No data\"\n return data or Data()\n"
},
"path": {
"advanced": false,
"display_name": "Path",
"dynamic": false,
"fileTypes": [
"txt",
"md",
"mdx",
"csv",
"json",
"yaml",
"yml",
"xml",
"html",
"htm",
"pdf",
"docx",
"py",
"sh",
"sql",
"js",
"ts",
"tsx"
],
"file_path": "",
"info": "Supported file types: txt, md, mdx, csv, json, yaml, yml, xml, html, htm, pdf, docx, py, sh, sql, js, ts, tsx",
"list": false,
"name": "path",
"placeholder": "",
"required": false,
"show": true,
"title_case": false,
"trace_as_metadata": true,
"type": "file",
"value": ""
},
"silent_errors": {
"advanced": true,
"display_name": "Silent Errors",
"dynamic": false,
"info": "If true, errors will not raise an exception.",
"list": false,
"name": "silent_errors",
"placeholder": "",
"required": false,
"show": true,
"title_case": false,
"trace_as_metadata": true,
"type": "bool",
"value": false
}
}
},
"type": "File"
},
"dragging": false,
"height": 300,
"id": "File-h46aK",
"position": {
"x": -449.0807503257012,
"y": -253.5304920926106
},
"positionAbsolute": {
"x": -449.0807503257012,
"y": -253.5304920926106
},
"selected": false,
"type": "genericNode",
"width": 384
},
{
"data": {
"id": "ParseData-sqVr1",
"node": {
"base_classes": ["Message"],
"beta": false,
"conditional_paths": [],
"custom_fields": {},
"description": "Convert Data into plain text following a specified template.",
"display_name": "Parse Data",
"documentation": "",
"edited": false,
"field_order": ["data", "template", "sep"],
"frozen": false,
"icon": "braces",
"output_types": [],
"outputs": [
{
"cache": true,
"display_name": "Text",
"hidden": false,
"method": "parse_data",
"name": "text",
"selected": "Message",
"types": ["Message"],
"value": "__UNDEFINED__"
}
],
"pinned": false,
"template": {
"_type": "Component",
"code": {
"advanced": true,
"dynamic": true,
"fileTypes": [],
"file_path": "",
"info": "",
"list": false,
"load_from_db": false,
"multiline": true,
"name": "code",
"password": false,
"placeholder": "",
"required": true,
"show": true,
"title_case": false,
"type": "code",
"value": "from langflow.custom import Component\nfrom langflow.helpers.data import data_to_text\nfrom langflow.io import DataInput, MultilineInput, Output, StrInput\nfrom langflow.schema.message import Message\n\n\nclass ParseDataComponent(Component):\n display_name = \"Parse Data\"\n description = \"Convert Data into plain text following a specified template.\"\n icon = \"braces\"\n\n inputs = [\n DataInput(name=\"data\", display_name=\"Data\", info=\"The data to convert to text.\"),\n MultilineInput(\n name=\"template\",\n display_name=\"Template\",\n info=\"The template to use for formatting the data. It can contain the keys {text}, {data} or any other key in the Data.\",\n value=\"{text}\",\n ),\n StrInput(name=\"sep\", display_name=\"Separator\", advanced=True, value=\"\\n\"),\n ]\n\n outputs = [\n Output(display_name=\"Text\", name=\"text\", method=\"parse_data\"),\n ]\n\n def parse_data(self) -> Message:\n data = self.data if isinstance(self.data, list) else [self.data]\n template = self.template\n\n result_string = data_to_text(template, data, sep=self.sep)\n self.status = result_string\n return Message(text=result_string)\n"
},
"data": {
"advanced": false,
"display_name": "Data",
"dynamic": false,
"info": "The data to convert to text.",
"input_types": ["Data"],
"list": false,
"name": "data",
"placeholder": "",
"required": false,
"show": true,
"title_case": false,
"trace_as_input": true,
"trace_as_metadata": true,
"type": "other",
"value": ""
},
"sep": {
"advanced": true,
"display_name": "Separator",
"dynamic": false,
"info": "",
"list": false,
"name": "sep",
"placeholder": "",
"required": false,
"show": true,
"title_case": false,
"trace_as_metadata": true,
"type": "str",
"value": "\\n"
}
}
},
"type": "ParseData"
},
"dragging": false,
"height": 300,
"id": "ParseData-sqVr1",
"position": {
"x": -449.0807503257012,
"y": -253.5304920926106
},
"positionAbsolute": {
"x": -449.0807503257012,
"y": -253.5304920926106
},
"selected": false,
"type": "genericNode",
"width": 384
}
]
},
"description": "This flow integrates PDF reading with a language model to answer document-specific questions. Ideal for small-scale texts, it facilitates direct queries with immediate insights.",
"endpoint_name": null,
"id": "4b4cbf9e-34fe-4613-a460-3b7af89b7788",
"is_component": false,
"last_tested_version": "1.0.0rc1",
"name": "Document QA"
} Make sure to replace the incorrect characters and ensure the JSON structure is valid. This should resolve the error message when trying to open the "Website content QA" examples in LangFlow version 1.0.9 [[1]](https://github.com/langflow-ai/langflow/blob/main/src/backend/base/langflow/initial_setup/starter_projects/Document QA.json). |
Beta Was this translation helpful? Give feedback.
-
I'm working in wondows. where can I find the JSON structure file ? |
Beta Was this translation helpful? Give feedback.
-
Today, I installed langFlow on my computer using Python virtual env.
I tried installing a couple of "Website content QA" examples from the store, but when I tried to open them, I got the message "Sorry, we found an unexpected error!"
for example:
Advice?
Beta Was this translation helpful? Give feedback.
All reactions