chore: Update starter projects (#5788)

This commit is contained in:
Gabriel Luiz Freitas Almeida 2025-01-18 20:17:44 -03:00 committed by GitHub
commit 8459ce99f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 1794 additions and 1794 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,86 @@
{
"data": {
"edges": [
{
"animated": false,
"className": "",
"data": {
"sourceHandle": {
"dataType": "Agent",
"id": "Agent-HoULP",
"name": "response",
"output_types": [
"Message"
]
},
"targetHandle": {
"fieldName": "input_value",
"id": "ChatOutput-60t7m",
"inputTypes": [
"Message"
],
"type": "str"
}
},
"id": "reactflow__edge-Agent-HoULP{œdataTypeœ:œAgentœ,œidœ:œAgent-HoULPœ,œnameœ:œresponseœ,œoutput_typesœ:[œMessageœ]}-ChatOutput-60t7m{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-60t7mœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
"source": "Agent-HoULP",
"sourceHandle": "{œdataTypeœ: œAgentœ, œidœ: œAgent-HoULPœ, œnameœ: œresponseœ, œoutput_typesœ: [œMessageœ]}",
"target": "ChatOutput-60t7m",
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œChatOutput-60t7mœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"
},
{
"animated": false,
"className": "",
"data": {
"sourceHandle": {
"dataType": "Prompt",
"id": "Prompt-nzVmM",
"name": "prompt",
"output_types": [
"Message"
]
},
"targetHandle": {
"fieldName": "input_value",
"id": "Agent-HoULP",
"inputTypes": [
"Message"
],
"type": "str"
}
},
"id": "reactflow__edge-Prompt-nzVmM{œdataTypeœ:œPromptœ,œidœ:œPrompt-nzVmMœ,œnameœ:œpromptœ,œoutput_typesœ:[œMessageœ]}-Agent-HoULP{œfieldNameœ:œinput_valueœ,œidœ:œAgent-HoULPœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
"source": "Prompt-nzVmM",
"sourceHandle": "{œdataTypeœ: œPromptœ, œidœ: œPrompt-nzVmMœ, œnameœ: œpromptœ, œoutput_typesœ: [œMessageœ]}",
"target": "Agent-HoULP",
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œAgent-HoULPœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"
},
{
"data": {
"sourceHandle": {
"dataType": "CalculatorComponent",
"id": "CalculatorComponent-A0PBx",
"name": "component_as_tool",
"output_types": [
"Tool"
]
},
"targetHandle": {
"fieldName": "tools",
"id": "Agent-HoULP",
"inputTypes": [
"Tool"
],
"type": "other"
}
},
"id": "xy-edge__CalculatorComponent-A0PBx{œdataTypeœ:œCalculatorComponentœ,œidœ:œCalculatorComponent-A0PBxœ,œnameœ:œcomponent_as_toolœ,œoutput_typesœ:[œToolœ]}-Agent-HoULP{œfieldNameœ:œtoolsœ,œidœ:œAgent-HoULPœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}",
"source": "CalculatorComponent-A0PBx",
"sourceHandle": "{œdataTypeœ: œCalculatorComponentœ, œidœ: œCalculatorComponent-A0PBxœ, œnameœ: œcomponent_as_toolœ, œoutput_typesœ: [œToolœ]}",
"target": "Agent-HoULP",
"targetHandle": "{œfieldNameœ: œtoolsœ, œidœ: œAgent-HoULPœ, œinputTypesœ: [œToolœ], œtypeœ: œotherœ}"
}
],
"nodes": [
{
"data": {
@ -231,6 +312,10 @@
"dragging": false,
"height": 693,
"id": "Prompt-nzVmM",
"measured": {
"height": 693,
"width": 360
},
"position": {
"x": 1349.861745038984,
"y": 347.90475109976467
@ -241,11 +326,7 @@
},
"selected": false,
"type": "genericNode",
"width": 320,
"measured": {
"width": 360,
"height": 693
}
"width": 320
},
{
"data": {
@ -512,6 +593,10 @@
"dragging": false,
"height": 234,
"id": "ChatOutput-60t7m",
"measured": {
"height": 234,
"width": 360
},
"position": {
"x": 2240.3625274769397,
"y": 355.16302699218204
@ -522,11 +607,7 @@
},
"selected": false,
"type": "genericNode",
"width": 320,
"measured": {
"width": 360,
"height": 234
}
"width": 320
},
{
"data": {
@ -542,6 +623,10 @@
"dragging": false,
"height": 800,
"id": "note-BnQHz",
"measured": {
"height": 800,
"width": 328
},
"position": {
"x": 689.7659055360411,
"y": 68.95847391680593
@ -557,11 +642,7 @@
"width": 600
},
"type": "noteNode",
"width": 600,
"measured": {
"width": 328,
"height": 800
}
"width": 600
},
{
"data": {
@ -1127,6 +1208,10 @@
"dragging": false,
"height": 650,
"id": "Agent-HoULP",
"measured": {
"height": 650,
"width": 360
},
"position": {
"x": 1819.2633856623966,
"y": 138.32023808479687
@ -1137,291 +1222,206 @@
},
"selected": false,
"type": "genericNode",
"width": 320,
"measured": {
"width": 360,
"height": 650
}
"width": 320
},
{
"id": "CalculatorComponent-A0PBx",
"type": "genericNode",
"position": {
"x": 1350.9477037257504,
"y": -45.351578570289234
},
"data": {
"id": "CalculatorComponent-A0PBx",
"node": {
"base_classes": [
"Data"
],
"beta": false,
"category": "tools",
"conditional_paths": [],
"custom_fields": {},
"description": "Perform basic arithmetic operations on a given expression.",
"display_name": "Calculator",
"documentation": "",
"edited": false,
"field_order": [
"expression"
],
"frozen": false,
"icon": "calculator",
"key": "CalculatorComponent",
"legacy": false,
"metadata": {},
"minimized": false,
"output_types": [],
"outputs": [
{
"cache": true,
"display_name": "Toolset",
"hidden": null,
"method": "to_toolkit",
"name": "component_as_tool",
"required_inputs": null,
"selected": "Tool",
"types": [
"Tool"
],
"value": "__UNDEFINED__"
}
],
"pinned": false,
"score": 0.001,
"template": {
"_type": "Component",
"code": {
"type": "code",
"required": true,
"placeholder": "",
"list": false,
"show": true,
"multiline": true,
"value": "import ast\nimport operator\nfrom collections.abc import Callable\n\nfrom langflow.custom import Component\nfrom langflow.inputs import MessageTextInput\nfrom langflow.io import Output\nfrom langflow.schema import Data\n\n\nclass CalculatorComponent(Component):\n display_name = \"Calculator\"\n description = \"Perform basic arithmetic operations on a given expression.\"\n icon = \"calculator\"\n\n # Cache operators dictionary as a class variable\n OPERATORS: dict[type[ast.operator], Callable] = {\n ast.Add: operator.add,\n ast.Sub: operator.sub,\n ast.Mult: operator.mul,\n ast.Div: operator.truediv,\n ast.Pow: operator.pow,\n }\n\n inputs = [\n MessageTextInput(\n name=\"expression\",\n display_name=\"Expression\",\n info=\"The arithmetic expression to evaluate (e.g., '4*4*(33/22)+12-20').\",\n tool_mode=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Data\", name=\"result\", type_=Data, method=\"evaluate_expression\"),\n ]\n\n def _eval_expr(self, node: ast.AST) -> float:\n \"\"\"Evaluate an AST node recursively.\"\"\"\n if isinstance(node, ast.Constant):\n if isinstance(node.value, int | float):\n return float(node.value)\n error_msg = f\"Unsupported constant type: {type(node.value).__name__}\"\n raise TypeError(error_msg)\n if isinstance(node, ast.Num): # For backwards compatibility\n if isinstance(node.n, int | float):\n return float(node.n)\n error_msg = f\"Unsupported number type: {type(node.n).__name__}\"\n raise TypeError(error_msg)\n\n if isinstance(node, ast.BinOp):\n op_type = type(node.op)\n if op_type not in self.OPERATORS:\n error_msg = f\"Unsupported binary operator: {op_type.__name__}\"\n raise TypeError(error_msg)\n\n left = self._eval_expr(node.left)\n right = self._eval_expr(node.right)\n return self.OPERATORS[op_type](left, right)\n\n error_msg = f\"Unsupported operation or expression type: {type(node).__name__}\"\n raise TypeError(error_msg)\n\n def evaluate_expression(self) -> Data:\n \"\"\"Evaluate the mathematical expression and return the result.\"\"\"\n try:\n tree = ast.parse(self.expression, mode=\"eval\")\n result = self._eval_expr(tree.body)\n\n formatted_result = f\"{float(result):.6f}\".rstrip(\"0\").rstrip(\".\")\n self.log(f\"Calculation result: {formatted_result}\")\n\n self.status = formatted_result\n return Data(data={\"result\": formatted_result})\n\n except ZeroDivisionError:\n error_message = \"Error: Division by zero\"\n self.status = error_message\n return Data(data={\"error\": error_message, \"input\": self.expression})\n\n except (SyntaxError, TypeError, KeyError, ValueError, AttributeError, OverflowError) as e:\n error_message = f\"Invalid expression: {e!s}\"\n self.status = error_message\n return Data(data={\"error\": error_message, \"input\": self.expression})\n\n def build(self):\n \"\"\"Return the main evaluation function.\"\"\"\n return self.evaluate_expression\n",
"fileTypes": [],
"file_path": "",
"password": false,
"name": "code",
"advanced": true,
"dynamic": true,
"fileTypes": [],
"file_path": "",
"info": "",
"list": false,
"load_from_db": false,
"title_case": false
"multiline": true,
"name": "code",
"password": false,
"placeholder": "",
"required": true,
"show": true,
"title_case": false,
"type": "code",
"value": "import ast\nimport operator\nfrom collections.abc import Callable\n\nfrom langflow.custom import Component\nfrom langflow.inputs import MessageTextInput\nfrom langflow.io import Output\nfrom langflow.schema import Data\n\n\nclass CalculatorComponent(Component):\n display_name = \"Calculator\"\n description = \"Perform basic arithmetic operations on a given expression.\"\n icon = \"calculator\"\n\n # Cache operators dictionary as a class variable\n OPERATORS: dict[type[ast.operator], Callable] = {\n ast.Add: operator.add,\n ast.Sub: operator.sub,\n ast.Mult: operator.mul,\n ast.Div: operator.truediv,\n ast.Pow: operator.pow,\n }\n\n inputs = [\n MessageTextInput(\n name=\"expression\",\n display_name=\"Expression\",\n info=\"The arithmetic expression to evaluate (e.g., '4*4*(33/22)+12-20').\",\n tool_mode=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Data\", name=\"result\", type_=Data, method=\"evaluate_expression\"),\n ]\n\n def _eval_expr(self, node: ast.AST) -> float:\n \"\"\"Evaluate an AST node recursively.\"\"\"\n if isinstance(node, ast.Constant):\n if isinstance(node.value, int | float):\n return float(node.value)\n error_msg = f\"Unsupported constant type: {type(node.value).__name__}\"\n raise TypeError(error_msg)\n if isinstance(node, ast.Num): # For backwards compatibility\n if isinstance(node.n, int | float):\n return float(node.n)\n error_msg = f\"Unsupported number type: {type(node.n).__name__}\"\n raise TypeError(error_msg)\n\n if isinstance(node, ast.BinOp):\n op_type = type(node.op)\n if op_type not in self.OPERATORS:\n error_msg = f\"Unsupported binary operator: {op_type.__name__}\"\n raise TypeError(error_msg)\n\n left = self._eval_expr(node.left)\n right = self._eval_expr(node.right)\n return self.OPERATORS[op_type](left, right)\n\n error_msg = f\"Unsupported operation or expression type: {type(node).__name__}\"\n raise TypeError(error_msg)\n\n def evaluate_expression(self) -> Data:\n \"\"\"Evaluate the mathematical expression and return the result.\"\"\"\n try:\n tree = ast.parse(self.expression, mode=\"eval\")\n result = self._eval_expr(tree.body)\n\n formatted_result = f\"{float(result):.6f}\".rstrip(\"0\").rstrip(\".\")\n self.log(f\"Calculation result: {formatted_result}\")\n\n self.status = formatted_result\n return Data(data={\"result\": formatted_result})\n\n except ZeroDivisionError:\n error_message = \"Error: Division by zero\"\n self.status = error_message\n return Data(data={\"error\": error_message, \"input\": self.expression})\n\n except (SyntaxError, TypeError, KeyError, ValueError, AttributeError, OverflowError) as e:\n error_message = f\"Invalid expression: {e!s}\"\n self.status = error_message\n return Data(data={\"error\": error_message, \"input\": self.expression})\n\n def build(self):\n \"\"\"Return the main evaluation function.\"\"\"\n return self.evaluate_expression\n"
},
"expression": {
"tool_mode": true,
"trace_as_input": true,
"trace_as_metadata": true,
"load_from_db": false,
"list": false,
"list_add_label": "Add More",
"required": false,
"placeholder": "",
"show": true,
"name": "expression",
"value": "",
"display_name": "Expression",
"_input_type": "MessageTextInput",
"advanced": false,
"display_name": "Expression",
"dynamic": false,
"info": "The arithmetic expression to evaluate (e.g., '4*4*(33/22)+12-20').",
"input_types": [
"Message"
],
"dynamic": false,
"info": "The arithmetic expression to evaluate (e.g., '4*4*(33/22)+12-20').",
"list": false,
"list_add_label": "Add More",
"load_from_db": false,
"name": "expression",
"placeholder": "",
"required": false,
"show": true,
"title_case": false,
"tool_mode": true,
"trace_as_input": true,
"trace_as_metadata": true,
"type": "str",
"_input_type": "MessageTextInput"
"value": ""
},
"tools_metadata": {
"tool_mode": false,
"_input_type": "TableInput",
"advanced": false,
"display_name": "Edit tools",
"dynamic": false,
"info": "",
"is_list": true,
"list_add_label": "Add More",
"table_schema": {
"columns": [
{
"name": "name",
"display_name": "Tool Name",
"sortable": false,
"filterable": false,
"type": "text",
"description": "Specify the name of the tool.",
"disable_edit": false,
"edit_mode": "inline",
"formatter": "text"
},
{
"name": "description",
"display_name": "Tool Description",
"sortable": false,
"filterable": false,
"type": "text",
"description": "Describe the purpose of the tool.",
"disable_edit": false,
"edit_mode": "popover",
"formatter": "text"
},
{
"name": "tags",
"display_name": "Tool Identifiers",
"sortable": false,
"filterable": false,
"type": "text",
"description": "The default identifiers for the tools and cannot be changed.",
"disable_edit": true,
"edit_mode": "inline",
"formatter": "text"
},
{
"name": "commands",
"display_name": "Commands",
"sortable": false,
"filterable": false,
"type": "text",
"description": "Add commands to the tool. These commands will be used to run the tool. Start all commands with a `/`. You can add multiple commands separated by a comma.\nExample: `/command1`, `/command2`, `/command3`",
"disable_edit": false,
"edit_mode": "inline",
"formatter": "text"
}
]
},
"trigger_text": "",
"trigger_icon": "Hammer",
"name": "tools_metadata",
"placeholder": "",
"real_time_refresh": true,
"required": false,
"show": true,
"table_icon": "Hammer",
"table_options": {
"block_add": true,
"block_delete": true,
"block_edit": true,
"block_sort": true,
"block_filter": true,
"block_hide": true,
"block_select": true,
"hide_options": true,
"block_sort": true,
"description": "Modify tool names and descriptions to help agents understand when to use each tool.",
"field_parsers": {
"commands": "commands",
"name": [
"snake_case",
"no_blank"
],
"commands": "commands"
]
},
"description": "Modify tool names and descriptions to help agents understand when to use each tool."
"hide_options": true
},
"table_schema": {
"columns": [
{
"description": "Specify the name of the tool.",
"disable_edit": false,
"display_name": "Tool Name",
"edit_mode": "inline",
"filterable": false,
"formatter": "text",
"name": "name",
"sortable": false,
"type": "text"
},
{
"description": "Describe the purpose of the tool.",
"disable_edit": false,
"display_name": "Tool Description",
"edit_mode": "popover",
"filterable": false,
"formatter": "text",
"name": "description",
"sortable": false,
"type": "text"
},
{
"description": "The default identifiers for the tools and cannot be changed.",
"disable_edit": true,
"display_name": "Tool Identifiers",
"edit_mode": "inline",
"filterable": false,
"formatter": "text",
"name": "tags",
"sortable": false,
"type": "text"
},
{
"description": "Add commands to the tool. These commands will be used to run the tool. Start all commands with a `/`. You can add multiple commands separated by a comma.\nExample: `/command1`, `/command2`, `/command3`",
"disable_edit": false,
"display_name": "Commands",
"edit_mode": "inline",
"filterable": false,
"formatter": "text",
"name": "commands",
"sortable": false,
"type": "text"
}
]
},
"title_case": false,
"tool_mode": false,
"trace_as_metadata": true,
"required": false,
"placeholder": "",
"show": true,
"name": "tools_metadata",
"trigger_icon": "Hammer",
"trigger_text": "",
"type": "table",
"value": [
{
"name": "None-evaluate_expression",
"description": "evaluate_expression() - Perform basic arithmetic operations on a given expression.",
"name": "None-evaluate_expression",
"tags": [
"None-evaluate_expression"
]
}
],
"display_name": "Edit tools",
"advanced": false,
"dynamic": false,
"info": "",
"real_time_refresh": true,
"title_case": false,
"type": "table",
"_input_type": "TableInput"
]
}
},
"description": "Perform basic arithmetic operations on a given expression.",
"icon": "calculator",
"base_classes": [
"Data"
],
"display_name": "Calculator",
"documentation": "",
"minimized": false,
"custom_fields": {},
"output_types": [],
"pinned": false,
"conditional_paths": [],
"frozen": false,
"outputs": [
{
"types": [
"Tool"
],
"selected": "Tool",
"name": "component_as_tool",
"hidden": null,
"display_name": "Toolset",
"method": "to_toolkit",
"value": "__UNDEFINED__",
"cache": true,
"required_inputs": null
}
],
"field_order": [
"expression"
],
"beta": false,
"legacy": false,
"edited": false,
"metadata": {},
"category": "tools",
"key": "CalculatorComponent",
"score": 0.001
}
},
"showNode": true,
"type": "CalculatorComponent",
"id": "CalculatorComponent-A0PBx"
"type": "CalculatorComponent"
},
"dragging": false,
"id": "CalculatorComponent-A0PBx",
"measured": {
"height": 374,
"width": 360
},
"position": {
"x": 1350.9477037257504,
"y": -45.351578570289234
},
"selected": true,
"measured": {
"width": 360,
"height": 374
},
"dragging": false
}
],
"edges": [
{
"animated": false,
"className": "",
"data": {
"sourceHandle": {
"dataType": "Agent",
"id": "Agent-HoULP",
"name": "response",
"output_types": [
"Message"
]
},
"targetHandle": {
"fieldName": "input_value",
"id": "ChatOutput-60t7m",
"inputTypes": [
"Message"
],
"type": "str"
}
},
"id": "reactflow__edge-Agent-HoULP{œdataTypeœ:œAgentœ,œidœ:œAgent-HoULPœ,œnameœ:œresponseœ,œoutput_typesœ:[œMessageœ]}-ChatOutput-60t7m{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-60t7mœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
"source": "Agent-HoULP",
"sourceHandle": "{œdataTypeœ:œAgentœ,œidœ:œAgent-HoULPœ,œnameœ:œresponseœ,œoutput_typesœ:[œMessageœ]}",
"target": "ChatOutput-60t7m",
"targetHandle": "{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-60t7mœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}"
},
{
"animated": false,
"className": "",
"data": {
"sourceHandle": {
"dataType": "Prompt",
"id": "Prompt-nzVmM",
"name": "prompt",
"output_types": [
"Message"
]
},
"targetHandle": {
"fieldName": "input_value",
"id": "Agent-HoULP",
"inputTypes": [
"Message"
],
"type": "str"
}
},
"id": "reactflow__edge-Prompt-nzVmM{œdataTypeœ:œPromptœ,œidœ:œPrompt-nzVmMœ,œnameœ:œpromptœ,œoutput_typesœ:[œMessageœ]}-Agent-HoULP{œfieldNameœ:œinput_valueœ,œidœ:œAgent-HoULPœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
"source": "Prompt-nzVmM",
"sourceHandle": "{œdataTypeœ:œPromptœ,œidœ:œPrompt-nzVmMœ,œnameœ:œpromptœ,œoutput_typesœ:[œMessageœ]}",
"target": "Agent-HoULP",
"targetHandle": "{œfieldNameœ:œinput_valueœ,œidœ:œAgent-HoULPœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}"
},
{
"source": "CalculatorComponent-A0PBx",
"sourceHandle": "{œdataTypeœ:œCalculatorComponentœ,œidœ:œCalculatorComponent-A0PBxœ,œnameœ:œcomponent_as_toolœ,œoutput_typesœ:[œToolœ]}",
"target": "Agent-HoULP",
"targetHandle": "{œfieldNameœ:œtoolsœ,œidœ:œAgent-HoULPœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}",
"data": {
"targetHandle": {
"fieldName": "tools",
"id": "Agent-HoULP",
"inputTypes": [
"Tool"
],
"type": "other"
},
"sourceHandle": {
"dataType": "CalculatorComponent",
"id": "CalculatorComponent-A0PBx",
"name": "component_as_tool",
"output_types": [
"Tool"
]
}
},
"id": "xy-edge__CalculatorComponent-A0PBx{œdataTypeœ:œCalculatorComponentœ,œidœ:œCalculatorComponent-A0PBxœ,œnameœ:œcomponent_as_toolœ,œoutput_typesœ:[œToolœ]}-Agent-HoULP{œfieldNameœ:œtoolsœ,œidœ:œAgent-HoULPœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}"
"type": "genericNode"
}
],
"viewport": {