{
  "data": {
    "edges": [
      {
        "animated": false,
        "className": "",
        "data": {
          "sourceHandle": {
            "dataType": "SplitText",
            "id": "SplitText-QIKhg",
            "name": "dataframe",
            "output_types": [
              "DataFrame"
            ]
          },
          "targetHandle": {
            "fieldName": "ingest_data",
            "id": "OpenSearchHybrid-Ve6bS",
            "inputTypes": [
              "Data",
              "DataFrame"
            ],
            "type": "other"
          }
        },
        "id": "xy-edge__SplitText-QIKhg{œdataTypeœ:œSplitTextœ,œidœ:œSplitText-QIKhgœ,œnameœ:œdataframeœ,œoutput_typesœ:[œDataFrameœ]}-OpenSearchHybrid-Ve6bS{œfieldNameœ:œingest_dataœ,œidœ:œOpenSearchHybrid-Ve6bSœ,œinputTypesœ:[œDataœ,œDataFrameœ],œtypeœ:œotherœ}",
        "selected": false,
        "source": "SplitText-QIKhg",
        "sourceHandle": "{œdataTypeœ:œSplitTextœ,œidœ:œSplitText-QIKhgœ,œnameœ:œdataframeœ,œoutput_typesœ:[œDataFrameœ]}",
        "target": "OpenSearchHybrid-Ve6bS",
        "targetHandle": "{œfieldNameœ:œingest_dataœ,œidœ:œOpenSearchHybrid-Ve6bSœ,œinputTypesœ:[œDataœ,œDataFrameœ],œtypeœ:œotherœ}"
      },
      {
        "animated": false,
        "className": "",
        "data": {
          "sourceHandle": {
            "dataType": "SecretInput",
            "id": "SecretInput-F34VJ",
            "name": "text",
            "output_types": [
              "Message"
            ]
          },
          "targetHandle": {
            "fieldName": "dynamic_connector_type",
            "id": "AdvancedDynamicFormBuilder-81Exw",
            "inputTypes": [
              "Text",
              "Message"
            ],
            "type": "str"
          }
        },
        "id": "xy-edge__SecretInput-F34VJ{œdataTypeœ:œSecretInputœ,œidœ:œSecretInput-F34VJœ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}-AdvancedDynamicFormBuilder-81Exw{œfieldNameœ:œdynamic_connector_typeœ,œidœ:œAdvancedDynamicFormBuilder-81Exwœ,œinputTypesœ:[œTextœ,œMessageœ],œtypeœ:œstrœ}",
        "selected": false,
        "source": "SecretInput-F34VJ",
        "sourceHandle": "{œdataTypeœ:œSecretInputœ,œidœ:œSecretInput-F34VJœ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}",
        "target": "AdvancedDynamicFormBuilder-81Exw",
        "targetHandle": "{œfieldNameœ:œdynamic_connector_typeœ,œidœ:œAdvancedDynamicFormBuilder-81Exwœ,œinputTypesœ:[œTextœ,œMessageœ],œtypeœ:œstrœ}"
      },
      {
        "animated": false,
        "className": "",
        "data": {
          "sourceHandle": {
            "dataType": "SecretInput",
            "id": "SecretInput-b2cab",
            "name": "text",
            "output_types": [
              "Message"
            ]
          },
          "targetHandle": {
            "fieldName": "dynamic_owner",
            "id": "AdvancedDynamicFormBuilder-81Exw",
            "inputTypes": [
              "Text",
              "Message"
            ],
            "type": "str"
          }
        },
        "id": "xy-edge__SecretInput-b2cab{œdataTypeœ:œSecretInputœ,œidœ:œSecretInput-b2cabœ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}-AdvancedDynamicFormBuilder-81Exw{œfieldNameœ:œdynamic_ownerœ,œidœ:œAdvancedDynamicFormBuilder-81Exwœ,œinputTypesœ:[œTextœ,œMessageœ],œtypeœ:œstrœ}",
        "selected": false,
        "source": "SecretInput-b2cab",
        "sourceHandle": "{œdataTypeœ:œSecretInputœ,œidœ:œSecretInput-b2cabœ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}",
        "target": "AdvancedDynamicFormBuilder-81Exw",
        "targetHandle": "{œfieldNameœ:œdynamic_ownerœ,œidœ:œAdvancedDynamicFormBuilder-81Exwœ,œinputTypesœ:[œTextœ,œMessageœ],œtypeœ:œstrœ}"
      },
      {
        "animated": false,
        "className": "",
        "data": {
          "sourceHandle": {
            "dataType": "SecretInput",
            "id": "SecretInput-ZVfuS",
            "name": "text",
            "output_types": [
              "Message"
            ]
          },
          "targetHandle": {
            "fieldName": "dynamic_owner_email",
            "id": "AdvancedDynamicFormBuilder-81Exw",
            "inputTypes": [
              "Text",
              "Message"
            ],
            "type": "str"
          }
        },
        "id": "xy-edge__SecretInput-ZVfuS{œdataTypeœ:œSecretInputœ,œidœ:œSecretInput-ZVfuSœ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}-AdvancedDynamicFormBuilder-81Exw{œfieldNameœ:œdynamic_owner_emailœ,œidœ:œAdvancedDynamicFormBuilder-81Exwœ,œinputTypesœ:[œTextœ,œMessageœ],œtypeœ:œstrœ}",
        "selected": false,
        "source": "SecretInput-ZVfuS",
        "sourceHandle": "{œdataTypeœ:œSecretInputœ,œidœ:œSecretInput-ZVfuSœ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}",
        "target": "AdvancedDynamicFormBuilder-81Exw",
        "targetHandle": "{œfieldNameœ:œdynamic_owner_emailœ,œidœ:œAdvancedDynamicFormBuilder-81Exwœ,œinputTypesœ:[œTextœ,œMessageœ],œtypeœ:œstrœ}"
      },
      {
        "animated": false,
        "className": "",
        "data": {
          "sourceHandle": {
            "dataType": "SecretInput",
            "id": "SecretInput-Iqtxd",
            "name": "text",
            "output_types": [
              "Message"
            ]
          },
          "targetHandle": {
            "fieldName": "dynamic_owner_name",
            "id": "AdvancedDynamicFormBuilder-81Exw",
            "inputTypes": [
              "Text",
              "Message"
            ],
            "type": "str"
          }
        },
        "id": "xy-edge__SecretInput-Iqtxd{œdataTypeœ:œSecretInputœ,œidœ:œSecretInput-Iqtxdœ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}-AdvancedDynamicFormBuilder-81Exw{œfieldNameœ:œdynamic_owner_nameœ,œidœ:œAdvancedDynamicFormBuilder-81Exwœ,œinputTypesœ:[œTextœ,œMessageœ],œtypeœ:œstrœ}",
        "selected": false,
        "source": "SecretInput-Iqtxd",
        "sourceHandle": "{œdataTypeœ:œSecretInputœ,œidœ:œSecretInput-Iqtxdœ,œnameœ:œtextœ,œoutput_typesœ:[œMessageœ]}",
        "target": "AdvancedDynamicFormBuilder-81Exw",
        "targetHandle": "{œfieldNameœ:œdynamic_owner_nameœ,œidœ:œAdvancedDynamicFormBuilder-81Exwœ,œinputTypesœ:[œTextœ,œMessageœ],œtypeœ:œstrœ}"
      },
      {
        "animated": false,
        "className": "",
        "data": {
          "sourceHandle": {
            "dataType": "AdvancedDynamicFormBuilder",
            "id": "AdvancedDynamicFormBuilder-81Exw",
            "name": "form_data",
            "output_types": [
              "Data"
            ]
          },
          "targetHandle": {
            "fieldName": "docs_metadata",
            "id": "OpenSearchHybrid-Ve6bS",
            "inputTypes": [
              "Data"
            ],
            "type": "table"
          }
        },
        "id": "xy-edge__AdvancedDynamicFormBuilder-81Exw{œdataTypeœ:œAdvancedDynamicFormBuilderœ,œidœ:œAdvancedDynamicFormBuilder-81Exwœ,œnameœ:œform_dataœ,œoutput_typesœ:[œDataœ]}-OpenSearchHybrid-Ve6bS{œfieldNameœ:œdocs_metadataœ,œidœ:œOpenSearchHybrid-Ve6bSœ,œinputTypesœ:[œDataœ],œtypeœ:œtableœ}",
        "selected": false,
        "source": "AdvancedDynamicFormBuilder-81Exw",
        "sourceHandle": "{œdataTypeœ:œAdvancedDynamicFormBuilderœ,œidœ:œAdvancedDynamicFormBuilder-81Exwœ,œnameœ:œform_dataœ,œoutput_typesœ:[œDataœ]}",
        "target": "OpenSearchHybrid-Ve6bS",
        "targetHandle": "{œfieldNameœ:œdocs_metadataœ,œidœ:œOpenSearchHybrid-Ve6bSœ,œinputTypesœ:[œDataœ],œtypeœ:œtableœ}"
      },
      {
        "animated": false,
        "className": "",
        "data": {
          "sourceHandle": {
            "dataType": "DoclingRemote",
            "id": "DoclingRemote-Dp3PX",
            "name": "dataframe",
            "output_types": [
              "DataFrame"
            ]
          },
          "targetHandle": {
            "fieldName": "data_inputs",
            "id": "ExportDoclingDocument-zZdRg",
            "inputTypes": [
              "Data",
              "DataFrame"
            ],
            "type": "other"
          }
        },
        "id": "xy-edge__DoclingRemote-Dp3PX{œdataTypeœ:œDoclingRemoteœ,œidœ:œDoclingRemote-Dp3PXœ,œnameœ:œdataframeœ,œoutput_typesœ:[œDataFrameœ]}-ExportDoclingDocument-zZdRg{œfieldNameœ:œdata_inputsœ,œidœ:œExportDoclingDocument-zZdRgœ,œinputTypesœ:[œDataœ,œDataFrameœ],œtypeœ:œotherœ}",
        "selected": false,
        "source": "DoclingRemote-Dp3PX",
        "sourceHandle": "{œdataTypeœ:œDoclingRemoteœ,œidœ:œDoclingRemote-Dp3PXœ,œnameœ:œdataframeœ,œoutput_typesœ:[œDataFrameœ]}",
        "target": "ExportDoclingDocument-zZdRg",
        "targetHandle": "{œfieldNameœ:œdata_inputsœ,œidœ:œExportDoclingDocument-zZdRgœ,œinputTypesœ:[œDataœ,œDataFrameœ],œtypeœ:œotherœ}"
      },
      {
        "animated": false,
        "className": "",
        "data": {
          "sourceHandle": {
            "dataType": "ExportDoclingDocument",
            "id": "ExportDoclingDocument-zZdRg",
            "name": "dataframe",
            "output_types": [
              "DataFrame"
            ]
          },
          "targetHandle": {
            "fieldName": "df",
            "id": "DataFrameOperations-1BWXB",
            "inputTypes": [
              "DataFrame"
            ],
            "type": "other"
          }
        },
        "id": "xy-edge__ExportDoclingDocument-zZdRg{œdataTypeœ:œExportDoclingDocumentœ,œidœ:œExportDoclingDocument-zZdRgœ,œnameœ:œdataframeœ,œoutput_typesœ:[œDataFrameœ]}-DataFrameOperations-1BWXB{œfieldNameœ:œdfœ,œidœ:œDataFrameOperations-1BWXBœ,œinputTypesœ:[œDataFrameœ],œtypeœ:œotherœ}",
        "selected": false,
        "source": "ExportDoclingDocument-zZdRg",
        "sourceHandle": "{œdataTypeœ:œExportDoclingDocumentœ,œidœ:œExportDoclingDocument-zZdRgœ,œnameœ:œdataframeœ,œoutput_typesœ:[œDataFrameœ]}",
        "target": "DataFrameOperations-1BWXB",
        "targetHandle": "{œfieldNameœ:œdfœ,œidœ:œDataFrameOperations-1BWXBœ,œinputTypesœ:[œDataFrameœ],œtypeœ:œotherœ}"
      },
      {
        "animated": false,
        "className": "",
        "data": {
          "sourceHandle": {
            "dataType": "DataFrameOperations",
            "id": "DataFrameOperations-N80fC",
            "name": "output",
            "output_types": [
              "DataFrame"
            ]
          },
          "targetHandle": {
            "fieldName": "data_inputs",
            "id": "SplitText-QIKhg",
            "inputTypes": [
              "Data",
              "DataFrame",
              "Message"
            ],
            "type": "other"
          }
        },
        "id": "xy-edge__DataFrameOperations-N80fC{œdataTypeœ:œDataFrameOperationsœ,œidœ:œDataFrameOperations-N80fCœ,œnameœ:œoutputœ,œoutput_typesœ:[œDataFrameœ]}-SplitText-QIKhg{œfieldNameœ:œdata_inputsœ,œidœ:œSplitText-QIKhgœ,œinputTypesœ:[œDataœ,œDataFrameœ,œMessageœ],œtypeœ:œotherœ}",
        "selected": false,
        "source": "DataFrameOperations-N80fC",
        "sourceHandle": "{œdataTypeœ:œDataFrameOperationsœ,œidœ:œDataFrameOperations-N80fCœ,œnameœ:œoutputœ,œoutput_typesœ:[œDataFrameœ]}",
        "target": "SplitText-QIKhg",
        "targetHandle": "{œfieldNameœ:œdata_inputsœ,œidœ:œSplitText-QIKhgœ,œinputTypesœ:[œDataœ,œDataFrameœ,œMessageœ],œtypeœ:œotherœ}"
      },
      {
        "animated": false,
        "className": "",
        "data": {
          "sourceHandle": {
            "dataType": "DataFrameOperations",
            "id": "DataFrameOperations-1BWXB",
            "name": "output",
            "output_types": [
              "DataFrame"
            ]
          },
          "targetHandle": {
            "fieldName": "df",
            "id": "DataFrameOperations-9vMrp",
            "inputTypes": [
              "DataFrame"
            ],
            "type": "other"
          }
        },
        "id": "xy-edge__DataFrameOperations-1BWXB{œdataTypeœ:œDataFrameOperationsœ,œidœ:œDataFrameOperations-1BWXBœ,œnameœ:œoutputœ,œoutput_typesœ:[œDataFrameœ]}-DataFrameOperations-9vMrp{œfieldNameœ:œdfœ,œidœ:œDataFrameOperations-9vMrpœ,œinputTypesœ:[œDataFrameœ],œtypeœ:œotherœ}",
        "selected": false,
        "source": "DataFrameOperations-1BWXB",
        "sourceHandle": "{œdataTypeœ:œDataFrameOperationsœ,œidœ:œDataFrameOperations-1BWXBœ,œnameœ:œoutputœ,œoutput_typesœ:[œDataFrameœ]}",
        "target": "DataFrameOperations-9vMrp",
        "targetHandle": "{œfieldNameœ:œdfœ,œidœ:œDataFrameOperations-9vMrpœ,œinputTypesœ:[œDataFrameœ],œtypeœ:œotherœ}"
      },
      {
        "animated": false,
        "className": "",
        "data": {
          "sourceHandle": {
            "dataType": "DataFrameOperations",
            "id": "DataFrameOperations-9vMrp",
            "name": "output",
            "output_types": [
              "DataFrame"
            ]
          },
          "targetHandle": {
            "fieldName": "df",
            "id": "DataFrameOperations-N80fC",
            "inputTypes": [
              "DataFrame"
            ],
            "type": "other"
          }
        },
        "id": "xy-edge__DataFrameOperations-9vMrp{œdataTypeœ:œDataFrameOperationsœ,œidœ:œDataFrameOperations-9vMrpœ,œnameœ:œoutputœ,œoutput_typesœ:[œDataFrameœ]}-DataFrameOperations-N80fC{œfieldNameœ:œdfœ,œidœ:œDataFrameOperations-N80fCœ,œinputTypesœ:[œDataFrameœ],œtypeœ:œotherœ}",
        "selected": false,
        "source": "DataFrameOperations-9vMrp",
        "sourceHandle": "{œdataTypeœ:œDataFrameOperationsœ,œidœ:œDataFrameOperations-9vMrpœ,œnameœ:œoutputœ,œoutput_typesœ:[œDataFrameœ]}",
        "target": "DataFrameOperations-N80fC",
        "targetHandle": "{œfieldNameœ:œdfœ,œidœ:œDataFrameOperations-N80fCœ,œinputTypesœ:[œDataFrameœ],œtypeœ:œotherœ}"
      },
      {
        "animated": false,
        "data": {
          "sourceHandle": {
            "dataType": "EmbeddingModel",
            "id": "EmbeddingModel-WIe3H",
            "name": "embeddings",
            "output_types": [
              "Embeddings"
            ]
          },
          "targetHandle": {
            "fieldName": "embedding",
            "id": "OpenSearchHybrid-Ve6bS",
            "inputTypes": [
              "Embeddings"
            ],
            "type": "other"
          }
        },
        "id": "xy-edge__EmbeddingModel-WIe3H{œdataTypeœ:œEmbeddingModelœ,œidœ:œEmbeddingModel-WIe3Hœ,œnameœ:œembeddingsœ,œoutput_typesœ:[œEmbeddingsœ]}-OpenSearchHybrid-Ve6bS{œfieldNameœ:œembeddingœ,œidœ:œOpenSearchHybrid-Ve6bSœ,œinputTypesœ:[œEmbeddingsœ],œtypeœ:œotherœ}",
        "selected": false,
        "source": "EmbeddingModel-WIe3H",
        "sourceHandle": "{œdataTypeœ:œEmbeddingModelœ,œidœ:œEmbeddingModel-WIe3Hœ,œnameœ:œembeddingsœ,œoutput_typesœ:[œEmbeddingsœ]}",
        "target": "OpenSearchHybrid-Ve6bS",
        "targetHandle": "{œfieldNameœ:œembeddingœ,œidœ:œOpenSearchHybrid-Ve6bSœ,œinputTypesœ:[œEmbeddingsœ],œtypeœ:œotherœ}"
      }
    ],
    "nodes": [
      {
        "data": {
          "description": "Split text into chunks based on specified criteria.",
          "display_name": "Split Text",
          "id": "SplitText-QIKhg",
          "node": {
            "base_classes": [
              "DataFrame"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Split text into chunks based on specified criteria.",
            "display_name": "Split Text",
            "documentation": "https://docs.langflow.org/components-processing#split-text",
            "edited": true,
            "field_order": [
              "data_inputs",
              "chunk_overlap",
              "chunk_size",
              "separator",
              "text_key",
              "keep_separator"
            ],
            "frozen": false,
            "icon": "scissors-line-dashed",
            "legacy": false,
            "lf_version": "1.6.3.dev0",
            "metadata": {
              "code_hash": "f2867efda61f",
              "dependencies": {
                "dependencies": [
                  {
                    "name": "langchain_text_splitters",
                    "version": "0.3.9"
                  },
                  {
                    "name": "lfx",
                    "version": null
                  }
                ],
                "total_dependencies": 2
              },
              "module": "custom_components.split_text"
            },
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "Chunks",
                "group_outputs": false,
                "hidden": null,
                "method": "split_text",
                "name": "dataframe",
                "options": null,
                "required_inputs": null,
                "selected": "DataFrame",
                "tool_mode": true,
                "types": [
                  "DataFrame"
                ],
                "value": "__UNDEFINED__"
              }
            ],
            "pinned": false,
            "template": {
              "_type": "Component",
              "chunk_overlap": {
                "_input_type": "IntInput",
                "advanced": false,
                "display_name": "Chunk Overlap",
                "dynamic": false,
                "info": "Number of characters to overlap between chunks.",
                "list": false,
                "list_add_label": "Add More",
                "name": "chunk_overlap",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "int",
                "value": 200
              },
              "chunk_size": {
                "_input_type": "IntInput",
                "advanced": false,
                "display_name": "Chunk Size",
                "dynamic": false,
                "info": "The maximum length of each chunk. Text is first split by separator, then chunks are merged up to this size. Individual splits larger than this won't be further divided.",
                "list": false,
                "list_add_label": "Add More",
                "name": "chunk_size",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "int",
                "value": 1000
              },
              "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 langchain_text_splitters import CharacterTextSplitter\n\nfrom lfx.custom.custom_component.component import Component\nfrom lfx.io import DropdownInput, HandleInput, IntInput, MessageTextInput, Output\nfrom lfx.schema.data import Data\nfrom lfx.schema.dataframe import DataFrame\nfrom lfx.schema.message import Message\nfrom lfx.utils.util import unescape_string\n\n\nclass SplitTextComponent(Component):\n    display_name: str = \"Split Text\"\n    description: str = \"Split text into chunks based on specified criteria.\"\n    documentation: str = \"https://docs.langflow.org/components-processing#split-text\"\n    icon = \"scissors-line-dashed\"\n    name = \"SplitText\"\n\n    inputs = [\n        HandleInput(\n            name=\"data_inputs\",\n            display_name=\"Input\",\n            info=\"The data with texts to split in chunks.\",\n            input_types=[\"Data\", \"DataFrame\", \"Message\"],\n            required=True,\n        ),\n        IntInput(\n            name=\"chunk_overlap\",\n            display_name=\"Chunk Overlap\",\n            info=\"Number of characters to overlap between chunks.\",\n            value=200,\n        ),\n        IntInput(\n            name=\"chunk_size\",\n            display_name=\"Chunk Size\",\n            info=(\n                \"The maximum length of each chunk. Text is first split by separator, \"\n                \"then chunks are merged up to this size. \"\n                \"Individual splits larger than this won't be further divided.\"\n            ),\n            value=1000,\n        ),\n        MessageTextInput(\n            name=\"separator\",\n            display_name=\"Separator\",\n            info=(\n                \"The character to split on. Use \\\\n for newline. \"\n                \"Examples: \\\\n\\\\n for paragraphs, \\\\n for lines, . for sentences\"\n            ),\n            value=\"\\n\",\n        ),\n        MessageTextInput(\n            name=\"text_key\",\n            display_name=\"Text Key\",\n            info=\"The key to use for the text column.\",\n            value=\"text\",\n            advanced=True,\n        ),\n        DropdownInput(\n            name=\"keep_separator\",\n            display_name=\"Keep Separator\",\n            info=\"Whether to keep the separator in the output chunks and where to place it.\",\n            options=[\"False\", \"True\", \"Start\", \"End\"],\n            value=\"False\",\n            advanced=True,\n        ),\n    ]\n\n    outputs = [\n        Output(display_name=\"Chunks\", name=\"dataframe\", method=\"split_text\"),\n    ]\n\n    def _docs_to_data(self, docs) -> list[Data]:\n        return [Data(text=doc.page_content, data=doc.metadata) for doc in docs]\n\n    def _fix_separator(self, separator: str) -> str:\n        \"\"\"Fix common separator issues and convert to proper format.\"\"\"\n        if separator == \"/n\":\n            return \"\\n\"\n        if separator == \"/t\":\n            return \"\\t\"\n        return separator\n\n    def split_text_base(self):\n        separator = self._fix_separator(self.separator)\n        separator = unescape_string(separator)\n\n        if isinstance(self.data_inputs, DataFrame):\n            if not len(self.data_inputs):\n                msg = \"DataFrame is empty\"\n                raise TypeError(msg)\n\n            self.data_inputs.text_key = self.text_key\n            try:\n                documents = self.data_inputs.to_lc_documents()\n            except Exception as e:\n                msg = f\"Error converting DataFrame to documents: {e}\"\n                raise TypeError(msg) from e\n        elif isinstance(self.data_inputs, Message):\n            self.data_inputs = [self.data_inputs.to_data()]\n            return self.split_text_base()\n        else:\n            if not self.data_inputs:\n                msg = \"No data inputs provided\"\n                raise TypeError(msg)\n\n            documents = []\n            if isinstance(self.data_inputs, Data):\n                self.data_inputs.text_key = self.text_key\n                documents = [self.data_inputs.to_lc_document()]\n            else:\n                try:\n                    documents = [input_.to_lc_document() for input_ in self.data_inputs if isinstance(input_, Data)]\n                    if not documents:\n                        msg = f\"No valid Data inputs found in {type(self.data_inputs)}\"\n                        raise TypeError(msg)\n                except AttributeError as e:\n                    msg = f\"Invalid input type in collection: {e}\"\n                    raise TypeError(msg) from e\n        try:\n            # Convert string 'False'/'True' to boolean\n            keep_sep = self.keep_separator\n            if isinstance(keep_sep, str):\n                if keep_sep.lower() == \"false\":\n                    keep_sep = False\n                elif keep_sep.lower() == \"true\":\n                    keep_sep = True\n                # 'start' and 'end' are kept as strings\n\n            splitter = CharacterTextSplitter(\n                chunk_overlap=self.chunk_overlap,\n                chunk_size=self.chunk_size,\n                separator=separator,\n                keep_separator=keep_sep,\n            )\n            return splitter.split_documents(documents)\n        except Exception as e:\n            msg = f\"Error splitting text: {e}\"\n            raise TypeError(msg) from e\n\n    def split_text(self) -> DataFrame:\n        return DataFrame(self._docs_to_data(self.split_text_base()))\n"
              },
              "data_inputs": {
                "_input_type": "HandleInput",
                "advanced": false,
                "display_name": "Input",
                "dynamic": false,
                "info": "The data with texts to split in chunks.",
                "input_types": [
                  "Data",
                  "DataFrame",
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "name": "data_inputs",
                "placeholder": "",
                "required": true,
                "show": true,
                "title_case": false,
                "trace_as_metadata": true,
                "type": "other",
                "value": ""
              },
              "keep_separator": {
                "_input_type": "DropdownInput",
                "advanced": true,
                "combobox": false,
                "dialog_inputs": {},
                "display_name": "Keep Separator",
                "dynamic": false,
                "external_options": {},
                "info": "Whether to keep the separator in the output chunks and where to place it.",
                "name": "keep_separator",
                "options": [
                  "False",
                  "True",
                  "Start",
                  "End"
                ],
                "options_metadata": [],
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "toggle": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "False"
              },
              "separator": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "Separator",
                "dynamic": false,
                "info": "The character to split on. Use \\n for newline. Examples: \\n\\n for paragraphs, \\n for lines, . for sentences",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "separator",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": "\n"
              },
              "text_key": {
                "_input_type": "MessageTextInput",
                "advanced": true,
                "display_name": "Text Key",
                "dynamic": false,
                "info": "The key to use for the text column.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "text_key",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": "text"
              }
            },
            "tool_mode": false
          },
          "selected_output": "chunks",
          "type": "SplitText"
        },
        "dragging": false,
        "height": 475,
        "id": "SplitText-QIKhg",
        "measured": {
          "height": 475,
          "width": 320
        },
        "position": {
          "x": 1704.25352249077,
          "y": 1199.364065218893
        },
        "positionAbsolute": {
          "x": 1683.4543896546102,
          "y": 1350.7871623588553
        },
        "selected": false,
        "type": "genericNode",
        "width": 320
      },
      {
        "data": {
          "id": "OpenSearchHybrid-Ve6bS",
          "node": {
            "base_classes": [
              "Data",
              "DataFrame",
              "VectorStore"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Store and search documents using OpenSearch with multi-model hybrid semantic and keyword search.",
            "display_name": "OpenSearch",
            "documentation": "",
            "edited": true,
            "field_order": [
              "docs_metadata",
              "opensearch_url",
              "index_name",
              "engine",
              "space_type",
              "ef_construction",
              "m",
              "ingest_data",
              "search_query",
              "should_cache_vector_store",
              "embedding",
              "embedding_model_name",
              "vector_field",
              "number_of_results",
              "filter_expression",
              "auth_mode",
              "username",
              "password",
              "jwt_token",
              "jwt_header",
              "bearer_prefix",
              "use_ssl",
              "verify_certs"
            ],
            "frozen": false,
            "icon": "OpenSearch",
            "last_updated": "2025-10-10T14:37:10.405Z",
            "legacy": false,
            "metadata": {
              "code_hash": "62d330aec569",
              "dependencies": {
                "dependencies": [
                  {
                    "name": "opensearchpy",
                    "version": "2.8.0"
                  },
                  {
                    "name": "lfx",
                    "version": "0.1.12.dev32"
                  }
                ],
                "total_dependencies": 2
              },
              "module": "custom_components.opensearch"
            },
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "Search Results",
                "group_outputs": false,
                "hidden": null,
                "method": "search_documents",
                "name": "search_results",
                "options": null,
                "required_inputs": null,
                "selected": "Data",
                "tool_mode": true,
                "types": [
                  "Data"
                ],
                "value": "__UNDEFINED__"
              },
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "DataFrame",
                "group_outputs": false,
                "hidden": null,
                "method": "as_dataframe",
                "name": "dataframe",
                "options": null,
                "required_inputs": null,
                "selected": "DataFrame",
                "tool_mode": true,
                "types": [
                  "DataFrame"
                ],
                "value": "__UNDEFINED__"
              },
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "Vector Store Connection",
                "group_outputs": false,
                "hidden": false,
                "method": "as_vector_store",
                "name": "vectorstoreconnection",
                "options": null,
                "required_inputs": null,
                "selected": "VectorStore",
                "tool_mode": true,
                "types": [
                  "VectorStore"
                ],
                "value": "__UNDEFINED__"
              }
            ],
            "pinned": false,
            "template": {
              "_type": "Component",
              "auth_mode": {
                "_input_type": "DropdownInput",
                "advanced": false,
                "combobox": false,
                "dialog_inputs": {},
                "display_name": "Authentication Mode",
                "dynamic": false,
                "external_options": {},
                "info": "Authentication method: 'basic' for username/password authentication, or 'jwt' for JSON Web Token (Bearer) authentication.",
                "load_from_db": false,
                "name": "auth_mode",
                "options": [
                  "basic",
                  "jwt"
                ],
                "options_metadata": [],
                "placeholder": "",
                "real_time_refresh": true,
                "required": false,
                "show": true,
                "title_case": false,
                "toggle": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "jwt"
              },
              "bearer_prefix": {
                "_input_type": "BoolInput",
                "advanced": true,
                "display_name": "Prefix 'Bearer '",
                "dynamic": false,
                "info": "",
                "list": false,
                "list_add_label": "Add More",
                "name": "bearer_prefix",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": true
              },
              "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 __future__ import annotations\n\nimport copy\nimport json\nimport time\nimport uuid\nfrom typing import Any, List, Optional\n\nfrom concurrent.futures import ThreadPoolExecutor, as_completed\n\nfrom opensearchpy import OpenSearch, helpers\nfrom opensearchpy.exceptions import RequestError\n\nfrom lfx.base.vectorstores.model import LCVectorStoreComponent, check_cached_vector_store\nfrom lfx.base.vectorstores.vector_store_connection_decorator import vector_store_connection\nfrom lfx.io import BoolInput, DropdownInput, HandleInput, IntInput, MultilineInput, SecretStrInput, StrInput, TableInput\nfrom lfx.log import logger\nfrom lfx.schema.data import Data\n\n\ndef normalize_model_name(model_name: str) -> str:\n    \"\"\"Normalize embedding model name for use as field suffix.\n\n    Converts model names to valid OpenSearch field names by replacing\n    special characters and ensuring alphanumeric format.\n\n    Args:\n        model_name: Original embedding model name (e.g., \"text-embedding-3-small\")\n\n    Returns:\n        Normalized field suffix (e.g., \"text_embedding_3_small\")\n    \"\"\"\n    normalized = model_name.lower()\n    # Replace common separators with underscores\n    normalized = normalized.replace(\"-\", \"_\").replace(\":\", \"_\").replace(\"/\", \"_\").replace(\".\", \"_\")\n    # Remove any non-alphanumeric characters except underscores\n    normalized = \"\".join(c if c.isalnum() or c == \"_\" else \"_\" for c in normalized)\n    # Remove duplicate underscores\n    while \"__\" in normalized:\n        normalized = normalized.replace(\"__\", \"_\")\n    return normalized.strip(\"_\")\n\n\ndef get_embedding_field_name(model_name: str) -> str:\n    \"\"\"Get the dynamic embedding field name for a model.\n\n    Args:\n        model_name: Embedding model name\n\n    Returns:\n        Field name in format: chunk_embedding_{normalized_model_name}\n    \"\"\"\n    return f\"chunk_embedding_{normalize_model_name(model_name)}\"\n\n\n@vector_store_connection\nclass OpenSearchVectorStoreComponent(LCVectorStoreComponent):\n    \"\"\"OpenSearch Vector Store Component with Multi-Model Hybrid Search Capabilities.\n\n    This component provides vector storage and retrieval using OpenSearch, combining semantic\n    similarity search (KNN) with keyword-based search for optimal results. It supports:\n    - Multiple embedding models per index with dynamic field names\n    - Automatic detection and querying of all available embedding models\n    - Parallel embedding generation for multi-model search\n    - Document ingestion with model tracking\n    - Advanced filtering and aggregations\n    - Flexible authentication options\n\n    Features:\n    - Multi-model vector storage with dynamic fields (chunk_embedding_{model_name})\n    - Hybrid search combining multiple KNN queries (dis_max) + keyword matching\n    - Auto-detection of available models in the index\n    - Parallel query embedding generation for all detected models\n    - Vector storage with configurable engines (jvector, nmslib, faiss, lucene)\n    - Flexible authentication (Basic auth, JWT tokens)\n    \"\"\"\n\n    display_name: str = \"OpenSearch (Multi-Model)\"\n    icon: str = \"OpenSearch\"\n    description: str = (\n        \"Store and search documents using OpenSearch with multi-model hybrid semantic and keyword search.\"\n    )\n\n    # Keys we consider baseline\n    default_keys: list[str] = [\n        \"opensearch_url\",\n        \"index_name\",\n        *[i.name for i in LCVectorStoreComponent.inputs],  # search_query, add_documents, etc.\n        \"embedding\",\n        \"embedding_model_name\",\n        \"vector_field\",\n        \"number_of_results\",\n        \"auth_mode\",\n        \"username\",\n        \"password\",\n        \"jwt_token\",\n        \"jwt_header\",\n        \"bearer_prefix\",\n        \"use_ssl\",\n        \"verify_certs\",\n        \"filter_expression\",\n        \"engine\",\n        \"space_type\",\n        \"ef_construction\",\n        \"m\",\n        \"num_candidates\",\n        \"docs_metadata\",\n    ]\n\n    inputs = [\n        TableInput(\n            name=\"docs_metadata\",\n            display_name=\"Document Metadata\",\n            info=(\n                \"Additional metadata key-value pairs to be added to all ingested documents. \"\n                \"Useful for tagging documents with source information, categories, or other custom attributes.\"\n            ),\n            table_schema=[\n                {\n                    \"name\": \"key\",\n                    \"display_name\": \"Key\",\n                    \"type\": \"str\",\n                    \"description\": \"Key name\",\n                },\n                {\n                    \"name\": \"value\",\n                    \"display_name\": \"Value\",\n                    \"type\": \"str\",\n                    \"description\": \"Value of the metadata\",\n                },\n            ],\n            value=[],\n            input_types=[\"Data\"]\n        ),\n        StrInput(\n            name=\"opensearch_url\",\n            display_name=\"OpenSearch URL\",\n            value=\"http://localhost:9200\",\n            info=(\n                \"The connection URL for your OpenSearch cluster \"\n                \"(e.g., http://localhost:9200 for local development or your cloud endpoint).\"\n            ),\n        ),\n        StrInput(\n            name=\"index_name\",\n            display_name=\"Index Name\",\n            value=\"langflow\",\n            info=(\n                \"The OpenSearch index name where documents will be stored and searched. \"\n                \"Will be created automatically if it doesn't exist.\"\n            ),\n        ),\n        DropdownInput(\n            name=\"engine\",\n            display_name=\"Vector Engine\",\n            options=[\"jvector\", \"nmslib\", \"faiss\", \"lucene\"],\n            value=\"jvector\",\n            info=(\n                \"Vector search engine for similarity calculations. 'jvector' is recommended for most use cases. \"\n                \"Note: Amazon OpenSearch Serverless only supports 'nmslib' or 'faiss'.\"\n            ),\n            advanced=True,\n        ),\n        DropdownInput(\n            name=\"space_type\",\n            display_name=\"Distance Metric\",\n            options=[\"l2\", \"l1\", \"cosinesimil\", \"linf\", \"innerproduct\"],\n            value=\"l2\",\n            info=(\n                \"Distance metric for calculating vector similarity. 'l2' (Euclidean) is most common, \"\n                \"'cosinesimil' for cosine similarity, 'innerproduct' for dot product.\"\n            ),\n            advanced=True,\n        ),\n        IntInput(\n            name=\"ef_construction\",\n            display_name=\"EF Construction\",\n            value=512,\n            info=(\n                \"Size of the dynamic candidate list during index construction. \"\n                \"Higher values improve recall but increase indexing time and memory usage.\"\n            ),\n            advanced=True,\n        ),\n        IntInput(\n            name=\"m\",\n            display_name=\"M Parameter\",\n            value=16,\n            info=(\n                \"Number of bidirectional connections for each vector in the HNSW graph. \"\n                \"Higher values improve search quality but increase memory usage and indexing time.\"\n            ),\n            advanced=True,\n        ),\n        IntInput(\n            name=\"num_candidates\",\n            display_name=\"Candidate Pool Size\",\n            value=1000,\n            info=(\n                \"Number of approximate neighbors to consider for each KNN query. \"\n                \"Some OpenSearch deployments do not support this parameter; set to 0 to disable.\"\n            ),\n            advanced=True,\n        ),\n        *LCVectorStoreComponent.inputs,  # includes search_query, add_documents, etc.\n        HandleInput(name=\"embedding\", display_name=\"Embedding\", input_types=[\"Embeddings\"]),\n        StrInput(\n            name=\"embedding_model_name\",\n            display_name=\"Embedding Model Name\",\n            value=\"\",\n            info=(\n                \"Name of the embedding model being used (e.g., 'text-embedding-3-small'). \"\n                \"Used to create dynamic vector field names and track which model embedded each document. \"\n                \"Auto-detected from embedding component if not specified.\"\n            ),\n        ),\n        StrInput(\n            name=\"vector_field\",\n            display_name=\"Legacy Vector Field Name\",\n            value=\"chunk_embedding\",\n            advanced=True,\n            info=(\n                \"Legacy field name for backward compatibility. New documents use dynamic fields \"\n                \"(chunk_embedding_{model_name}) based on the embedding_model_name.\"\n            ),\n        ),\n        IntInput(\n            name=\"number_of_results\",\n            display_name=\"Default Result Limit\",\n            value=10,\n            advanced=True,\n            info=(\n                \"Default maximum number of search results to return when no limit is \"\n                \"specified in the filter expression.\"\n            ),\n        ),\n        MultilineInput(\n            name=\"filter_expression\",\n            display_name=\"Search Filters (JSON)\",\n            value=\"\",\n            info=(\n                \"Optional JSON configuration for search filtering, result limits, and score thresholds.\\n\\n\"\n                \"Format 1 - Explicit filters:\\n\"\n                '{\"filter\": [{\"term\": {\"filename\":\"doc.pdf\"}}, '\n                '{\"terms\":{\"owner\":[\"user1\",\"user2\"]}}], \"limit\": 10, \"score_threshold\": 1.6}\\n\\n'\n                \"Format 2 - Context-style mapping:\\n\"\n                '{\"data_sources\":[\"file.pdf\"], \"document_types\":[\"application/pdf\"], \"owners\":[\"user123\"]}\\n\\n'\n                \"Use __IMPOSSIBLE_VALUE__ as placeholder to ignore specific filters.\"\n            ),\n        ),\n        # ----- Auth controls (dynamic) -----\n        DropdownInput(\n            name=\"auth_mode\",\n            display_name=\"Authentication Mode\",\n            value=\"basic\",\n            options=[\"basic\", \"jwt\"],\n            info=(\n                \"Authentication method: 'basic' for username/password authentication, \"\n                \"or 'jwt' for JSON Web Token (Bearer) authentication.\"\n            ),\n            real_time_refresh=True,\n            advanced=False,\n        ),\n        StrInput(\n            name=\"username\",\n            display_name=\"Username\",\n            value=\"admin\",\n            show=False,\n        ),\n        SecretStrInput(\n            name=\"password\",\n            display_name=\"OpenSearch Password\",\n            value=\"admin\",\n            show=False,\n        ),\n        SecretStrInput(\n            name=\"jwt_token\",\n            display_name=\"JWT Token\",\n            value=\"JWT\",\n            load_from_db=False,\n            show=True,\n            info=(\n                \"Valid JSON Web Token for authentication. \"\n                \"Will be sent in the Authorization header (with optional 'Bearer ' prefix).\"\n            ),\n        ),\n        StrInput(\n            name=\"jwt_header\",\n            display_name=\"JWT Header Name\",\n            value=\"Authorization\",\n            show=False,\n            advanced=True,\n        ),\n        BoolInput(\n            name=\"bearer_prefix\",\n            display_name=\"Prefix 'Bearer '\",\n            value=True,\n            show=False,\n            advanced=True,\n        ),\n        # ----- TLS -----\n        BoolInput(\n            name=\"use_ssl\",\n            display_name=\"Use SSL/TLS\",\n            value=True,\n            advanced=True,\n            info=\"Enable SSL/TLS encryption for secure connections to OpenSearch.\",\n        ),\n        BoolInput(\n            name=\"verify_certs\",\n            display_name=\"Verify SSL Certificates\",\n            value=False,\n            advanced=True,\n            info=(\n                \"Verify SSL certificates when connecting. \"\n                \"Disable for self-signed certificates in development environments.\"\n            ),\n        ),\n    ]\n\n    def _get_embedding_model_name(self) -> str:\n        \"\"\"Get the embedding model name from component config or embedding object.\n\n        Returns:\n            Embedding model name\n\n        Raises:\n            ValueError: If embedding model name cannot be determined\n        \"\"\"\n        # First try explicit embedding_model_name input\n        if hasattr(self, \"embedding_model_name\") and self.embedding_model_name:\n            return self.embedding_model_name.strip()\n\n        # Try to get from embedding component\n        if hasattr(self, \"embedding\") and self.embedding:\n            if hasattr(self.embedding, \"model\"):\n                return str(self.embedding.model)\n            if hasattr(self.embedding, \"model_name\"):\n                return str(self.embedding.model_name)\n\n        msg = (\n            \"Could not determine embedding model name. \"\n            \"Please set the 'embedding_model_name' field or ensure the embedding component \"\n            \"has a 'model' or 'model_name' attribute.\"\n        )\n        raise ValueError(msg)\n\n    # ---------- helper functions for index management ----------\n    def _default_text_mapping(\n        self,\n        dim: int,\n        engine: str = \"jvector\",\n        space_type: str = \"l2\",\n        ef_search: int = 512,\n        ef_construction: int = 100,\n        m: int = 16,\n        vector_field: str = \"vector_field\",\n    ) -> dict[str, Any]:\n        \"\"\"Create the default OpenSearch index mapping for vector search.\n\n        This method generates the index configuration with k-NN settings optimized\n        for approximate nearest neighbor search using the specified vector engine.\n        Includes the embedding_model keyword field for tracking which model was used.\n\n        Args:\n            dim: Dimensionality of the vector embeddings\n            engine: Vector search engine (jvector, nmslib, faiss, lucene)\n            space_type: Distance metric for similarity calculation\n            ef_search: Size of dynamic list used during search\n            ef_construction: Size of dynamic list used during index construction\n            m: Number of bidirectional links for each vector\n            vector_field: Name of the field storing vector embeddings\n\n        Returns:\n            Dictionary containing OpenSearch index mapping configuration\n        \"\"\"\n        return {\n            \"settings\": {\"index\": {\"knn\": True, \"knn.algo_param.ef_search\": ef_search}},\n            \"mappings\": {\n                \"properties\": {\n                    vector_field: {\n                        \"type\": \"knn_vector\",\n                        \"dimension\": dim,\n                        \"method\": {\n                            \"name\": \"disk_ann\",\n                            \"space_type\": space_type,\n                            \"engine\": engine,\n                            \"parameters\": {\"ef_construction\": ef_construction, \"m\": m},\n                        },\n                    },\n                    \"embedding_model\": {\"type\": \"keyword\"},  # Track which model was used\n                    \"embedding_dimensions\": {\"type\": \"integer\"},\n                }\n            },\n        }\n\n    def _ensure_embedding_field_mapping(\n        self,\n        client: OpenSearch,\n        index_name: str,\n        field_name: str,\n        dim: int,\n        engine: str,\n        space_type: str,\n        ef_construction: int,\n        m: int,\n    ) -> None:\n        \"\"\"Lazily add a dynamic embedding field to the index if it doesn't exist.\n\n        This allows adding new embedding models without recreating the entire index.\n        Also ensures the embedding_model tracking field exists.\n\n        Args:\n            client: OpenSearch client instance\n            index_name: Target index name\n            field_name: Dynamic field name for this embedding model\n            dim: Vector dimensionality\n            engine: Vector search engine\n            space_type: Distance metric\n            ef_construction: Construction parameter\n            m: HNSW parameter\n        \"\"\"\n        try:\n            mapping = {\n                \"properties\": {\n                    field_name: {\n                        \"type\": \"knn_vector\",\n                        \"dimension\": dim,\n                        \"method\": {\n                            \"name\": \"disk_ann\",\n                            \"space_type\": space_type,\n                            \"engine\": engine,\n                            \"parameters\": {\"ef_construction\": ef_construction, \"m\": m},\n                        },\n                    },\n                    # Also ensure the embedding_model tracking field exists as keyword\n                    \"embedding_model\": {\n                        \"type\": \"keyword\"\n                    },\n                    \"embedding_dimensions\": {\n                        \"type\": \"integer\"\n                    }\n                }\n            }\n            client.indices.put_mapping(index=index_name, body=mapping)\n            logger.info(f\"Added/updated embedding field mapping: {field_name}\")\n        except Exception as e:\n            logger.warning(f\"Could not add embedding field mapping for {field_name}: {e}\")\n            raise\n\n        properties = self._get_index_properties(client)\n        if not self._is_knn_vector_field(properties, field_name):\n            raise ValueError(\n                f\"Field '{field_name}' is not mapped as knn_vector. Current mapping: {properties.get(field_name)}\"\n            )\n\n    def _validate_aoss_with_engines(self, *, is_aoss: bool, engine: str) -> None:\n        \"\"\"Validate engine compatibility with Amazon OpenSearch Serverless (AOSS).\n\n        Amazon OpenSearch Serverless has restrictions on which vector engines\n        can be used. This method ensures the selected engine is compatible.\n\n        Args:\n            is_aoss: Whether the connection is to Amazon OpenSearch Serverless\n            engine: The selected vector search engine\n\n        Raises:\n            ValueError: If AOSS is used with an incompatible engine\n        \"\"\"\n        if is_aoss and engine not in {\"nmslib\", \"faiss\"}:\n            msg = \"Amazon OpenSearch Service Serverless only supports `nmslib` or `faiss` engines\"\n            raise ValueError(msg)\n\n    def _is_aoss_enabled(self, http_auth: Any) -> bool:\n        \"\"\"Determine if Amazon OpenSearch Serverless (AOSS) is being used.\n\n        Args:\n            http_auth: The HTTP authentication object\n\n        Returns:\n            True if AOSS is enabled, False otherwise\n        \"\"\"\n        return http_auth is not None and hasattr(http_auth, \"service\") and http_auth.service == \"aoss\"\n\n    def _bulk_ingest_embeddings(\n        self,\n        client: OpenSearch,\n        index_name: str,\n        embeddings: list[list[float]],\n        texts: list[str],\n        metadatas: list[dict] | None = None,\n        ids: list[str] | None = None,\n        vector_field: str = \"vector_field\",\n        text_field: str = \"text\",\n        embedding_model: str = \"unknown\",\n        mapping: dict | None = None,\n        max_chunk_bytes: int | None = 1 * 1024 * 1024,\n        *,\n        is_aoss: bool = False,\n    ) -> list[str]:\n        \"\"\"Efficiently ingest multiple documents with embeddings into OpenSearch.\n\n        This method uses bulk operations to insert documents with their vector\n        embeddings and metadata into the specified OpenSearch index. Each document\n        is tagged with the embedding_model name for tracking.\n\n        Args:\n            client: OpenSearch client instance\n            index_name: Target index for document storage\n            embeddings: List of vector embeddings for each document\n            texts: List of document texts\n            metadatas: Optional metadata dictionaries for each document\n            ids: Optional document IDs (UUIDs generated if not provided)\n            vector_field: Field name for storing vector embeddings\n            text_field: Field name for storing document text\n            embedding_model: Name of the embedding model used\n            mapping: Optional index mapping configuration\n            max_chunk_bytes: Maximum size per bulk request chunk\n            is_aoss: Whether using Amazon OpenSearch Serverless\n\n        Returns:\n            List of document IDs that were successfully ingested\n        \"\"\"\n        if not mapping:\n            mapping = {}\n\n        requests = []\n        return_ids = []\n        vector_dimensions = len(embeddings[0]) if embeddings else None\n\n        for i, text in enumerate(texts):\n            metadata = metadatas[i] if metadatas else {}\n            if vector_dimensions is not None and \"embedding_dimensions\" not in metadata:\n                metadata = {**metadata, \"embedding_dimensions\": vector_dimensions}\n            _id = ids[i] if ids else str(uuid.uuid4())\n            request = {\n                \"_op_type\": \"index\",\n                \"_index\": index_name,\n                vector_field: embeddings[i],\n                text_field: text,\n                \"embedding_model\": embedding_model,  # Track which model was used\n                **metadata,\n            }\n            if is_aoss:\n                request[\"id\"] = _id\n            else:\n                request[\"_id\"] = _id\n            requests.append(request)\n            return_ids.append(_id)\n        if metadatas:\n            self.log(f\"Sample metadata: {metadatas[0] if metadatas else {}}\")\n        helpers.bulk(client, requests, max_chunk_bytes=max_chunk_bytes)\n        return return_ids\n\n    # ---------- auth / client ----------\n    def _build_auth_kwargs(self) -> dict[str, Any]:\n        \"\"\"Build authentication configuration for OpenSearch client.\n\n        Constructs the appropriate authentication parameters based on the\n        selected auth mode (basic username/password or JWT token).\n\n        Returns:\n            Dictionary containing authentication configuration\n\n        Raises:\n            ValueError: If required authentication parameters are missing\n        \"\"\"\n        mode = (self.auth_mode or \"basic\").strip().lower()\n        if mode == \"jwt\":\n            token = (self.jwt_token or \"\").strip()\n            if not token:\n                msg = \"Auth Mode is 'jwt' but no jwt_token was provided.\"\n                raise ValueError(msg)\n            header_name = (self.jwt_header or \"Authorization\").strip()\n            header_value = f\"Bearer {token}\" if self.bearer_prefix else token\n            return {\"headers\": {header_name: header_value}}\n        user = (self.username or \"\").strip()\n        pwd = (self.password or \"\").strip()\n        if not user or not pwd:\n            msg = \"Auth Mode is 'basic' but username/password are missing.\"\n            raise ValueError(msg)\n        return {\"http_auth\": (user, pwd)}\n\n    def build_client(self) -> OpenSearch:\n        \"\"\"Create and configure an OpenSearch client instance.\n\n        Returns:\n            Configured OpenSearch client ready for operations\n        \"\"\"\n        auth_kwargs = self._build_auth_kwargs()\n        return OpenSearch(\n            hosts=[self.opensearch_url],\n            use_ssl=self.use_ssl,\n            verify_certs=self.verify_certs,\n            ssl_assert_hostname=False,\n            ssl_show_warn=False,\n            **auth_kwargs,\n        )\n\n    @check_cached_vector_store\n    def build_vector_store(self) -> OpenSearch:\n        # Return raw OpenSearch client as our \"vector store.\"\n        self.log(self.ingest_data)\n        client = self.build_client()\n        self._add_documents_to_vector_store(client=client)\n        return client\n\n    # ---------- ingest ----------\n    def _add_documents_to_vector_store(self, client: OpenSearch) -> None:\n        \"\"\"Process and ingest documents into the OpenSearch vector store.\n\n        This method handles the complete document ingestion pipeline:\n        - Prepares document data and metadata\n        - Generates vector embeddings\n        - Creates appropriate index mappings with dynamic field names\n        - Bulk inserts documents with vectors and model tracking\n\n        Args:\n            client: OpenSearch client for performing operations\n        \"\"\"\n        # Convert DataFrame to Data if needed using parent's method\n        self.ingest_data = self._prepare_ingest_data()\n\n        docs = self.ingest_data or []\n        if not docs:\n            self.log(\"No documents to ingest.\")\n            return\n\n        # Get embedding model name\n        embedding_model = self._get_embedding_model_name()\n        dynamic_field_name = get_embedding_field_name(embedding_model)\n\n        self.log(f\"Using embedding model: {embedding_model}\")\n        self.log(f\"Dynamic vector field: {dynamic_field_name}\")\n\n        # Extract texts and metadata from documents\n        texts = []\n        metadatas = []\n        # Process docs_metadata table input into a dict\n        additional_metadata = {}\n        if hasattr(self, \"docs_metadata\") and self.docs_metadata:\n            logger.info(f\"[LF] Docs metadata {self.docs_metadata}\")\n            if isinstance(self.docs_metadata[-1], Data):\n                logger.info(f\"[LF] Docs metadata is a Data object {self.docs_metadata}\")\n                self.docs_metadata = self.docs_metadata[-1].data\n                logger.info(f\"[LF] Docs metadata is a Data object {self.docs_metadata}\")\n                additional_metadata.update(self.docs_metadata)\n            else:\n                for item in self.docs_metadata:\n                    if isinstance(item, dict) and \"key\" in item and \"value\" in item:\n                        additional_metadata[item[\"key\"]] = item[\"value\"]\n        # Replace string \"None\" values with actual None\n        for key, value in additional_metadata.items():\n            if value == \"None\":\n                additional_metadata[key] = None\n        logger.info(f\"[LF] Additional metadata {additional_metadata}\")\n        for doc_obj in docs:\n            data_copy = json.loads(doc_obj.model_dump_json())\n            text = data_copy.pop(doc_obj.text_key, doc_obj.default_value)\n            texts.append(text)\n\n            # Merge additional metadata from table input\n            data_copy.update(additional_metadata)\n\n            metadatas.append(data_copy)\n        self.log(metadatas)\n        if not self.embedding:\n            msg = \"Embedding handle is required to embed documents.\"\n            raise ValueError(msg)\n\n        # Generate embeddings (threaded for concurrency) with retries\n        def embed_chunk(chunk_text: str) -> list[float]:\n            return self.embedding.embed_documents([chunk_text])[0]\n\n        vectors: Optional[List[List[float]]] = None\n        last_exception: Optional[Exception] = None\n        delay = 1.0\n        attempts = 0\n\n        while attempts < 3:\n            attempts += 1\n            try:\n                max_workers = min(max(len(texts), 1), 8)\n                with ThreadPoolExecutor(max_workers=max_workers) as executor:\n                    futures = {executor.submit(embed_chunk, chunk): idx for idx, chunk in enumerate(texts)}\n                    vectors = [None] * len(texts)\n                    for future in as_completed(futures):\n                        idx = futures[future]\n                        vectors[idx] = future.result()\n                break\n            except Exception as exc:\n                last_exception = exc\n                if attempts >= 3:\n                    logger.error(\n                        \"Embedding generation failed after retries\",\n                        error=str(exc),\n                    )\n                    raise\n                logger.warning(\n                    \"Threaded embedding generation failed (attempt %s/%s), retrying in %.1fs\",\n                    attempts,\n                    3,\n                    delay,\n                )\n                time.sleep(delay)\n                delay = min(delay * 2, 8.0)\n\n        if vectors is None:\n            raise RuntimeError(\n                f\"Embedding generation failed: {last_exception}\" if last_exception else \"Embedding generation failed\"\n            )\n\n        if not vectors:\n            self.log(\"No vectors generated from documents.\")\n            return\n\n        # Get vector dimension for mapping\n        dim = len(vectors[0]) if vectors else 768  # default fallback\n\n        # Check for AOSS\n        auth_kwargs = self._build_auth_kwargs()\n        is_aoss = self._is_aoss_enabled(auth_kwargs.get(\"http_auth\"))\n\n        # Validate engine with AOSS\n        engine = getattr(self, \"engine\", \"jvector\")\n        self._validate_aoss_with_engines(is_aoss=is_aoss, engine=engine)\n\n        # Create mapping with proper KNN settings\n        space_type = getattr(self, \"space_type\", \"l2\")\n        ef_construction = getattr(self, \"ef_construction\", 512)\n        m = getattr(self, \"m\", 16)\n\n        mapping = self._default_text_mapping(\n            dim=dim,\n            engine=engine,\n            space_type=space_type,\n            ef_construction=ef_construction,\n            m=m,\n            vector_field=dynamic_field_name,  # Use dynamic field name\n        )\n\n        # Ensure index exists with baseline mapping\n        try:\n            if not client.indices.exists(index=self.index_name):\n                self.log(f\"Creating index '{self.index_name}' with base mapping\")\n                client.indices.create(index=self.index_name, body=mapping)\n        except RequestError as creation_error:\n            if creation_error.error != \"resource_already_exists_exception\":\n                logger.warning(\n                    f\"Failed to create index '{self.index_name}': {creation_error}\"\n                )\n\n        # Ensure the dynamic field exists in the index\n        self._ensure_embedding_field_mapping(\n            client=client,\n            index_name=self.index_name,\n            field_name=dynamic_field_name,\n            dim=dim,\n            engine=engine,\n            space_type=space_type,\n            ef_construction=ef_construction,\n            m=m,\n        )\n\n        self.log(f\"Indexing {len(texts)} documents into '{self.index_name}' with model '{embedding_model}'...\")\n\n        # Use the bulk ingestion with model tracking\n        return_ids = self._bulk_ingest_embeddings(\n            client=client,\n            index_name=self.index_name,\n            embeddings=vectors,\n            texts=texts,\n            metadatas=metadatas,\n            vector_field=dynamic_field_name,  # Use dynamic field name\n            text_field=\"text\",\n            embedding_model=embedding_model,  # Track the model\n            mapping=mapping,\n            is_aoss=is_aoss,\n        )\n        self.log(metadatas)\n\n        self.log(f\"Successfully indexed {len(return_ids)} documents with model {embedding_model}.\")\n\n    # ---------- helpers for filters ----------\n    def _is_placeholder_term(self, term_obj: dict) -> bool:\n        # term_obj like {\"filename\": \"__IMPOSSIBLE_VALUE__\"}\n        return any(v == \"__IMPOSSIBLE_VALUE__\" for v in term_obj.values())\n\n    def _coerce_filter_clauses(self, filter_obj: dict | None) -> list[dict]:\n        \"\"\"Convert filter expressions into OpenSearch-compatible filter clauses.\n\n        This method accepts two filter formats and converts them to standardized\n        OpenSearch query clauses:\n\n        Format A - Explicit filters:\n        {\"filter\": [{\"term\": {\"field\": \"value\"}}, {\"terms\": {\"field\": [\"val1\", \"val2\"]}}],\n         \"limit\": 10, \"score_threshold\": 1.5}\n\n        Format B - Context-style mapping:\n        {\"data_sources\": [\"file1.pdf\"], \"document_types\": [\"pdf\"], \"owners\": [\"user1\"]}\n\n        Args:\n            filter_obj: Filter configuration dictionary or None\n\n        Returns:\n            List of OpenSearch filter clauses (term/terms objects)\n            Placeholder values with \"__IMPOSSIBLE_VALUE__\" are ignored\n        \"\"\"\n        if not filter_obj:\n            return []\n\n        # If it is a string, try to parse it once\n        if isinstance(filter_obj, str):\n            try:\n                filter_obj = json.loads(filter_obj)\n            except json.JSONDecodeError:\n                # Not valid JSON - treat as no filters\n                return []\n\n        # Case A: already an explicit list/dict under \"filter\"\n        if \"filter\" in filter_obj:\n            raw = filter_obj[\"filter\"]\n            if isinstance(raw, dict):\n                raw = [raw]\n            explicit_clauses: list[dict] = []\n            for f in raw or []:\n                if \"term\" in f and isinstance(f[\"term\"], dict) and not self._is_placeholder_term(f[\"term\"]):\n                    explicit_clauses.append(f)\n                elif \"terms\" in f and isinstance(f[\"terms\"], dict):\n                    field, vals = next(iter(f[\"terms\"].items()))\n                    if isinstance(vals, list) and len(vals) > 0:\n                        explicit_clauses.append(f)\n            return explicit_clauses\n\n        # Case B: convert context-style maps into clauses\n        field_mapping = {\n            \"data_sources\": \"filename\",\n            \"document_types\": \"mimetype\",\n            \"owners\": \"owner\",\n        }\n        context_clauses: list[dict] = []\n        for k, values in filter_obj.items():\n            if not isinstance(values, list):\n                continue\n            field = field_mapping.get(k, k)\n            if len(values) == 0:\n                # Match-nothing placeholder (kept to mirror your tool semantics)\n                context_clauses.append({\"term\": {field: \"__IMPOSSIBLE_VALUE__\"}})\n            elif len(values) == 1:\n                if values[0] != \"__IMPOSSIBLE_VALUE__\":\n                    context_clauses.append({\"term\": {field: values[0]}})\n            else:\n                context_clauses.append({\"terms\": {field: values}})\n        return context_clauses\n\n    def _detect_available_models(self, client: OpenSearch, filter_clauses: list[dict] = None) -> list[str]:\n        \"\"\"Detect which embedding models have documents in the index.\n\n        Uses aggregation to find all unique embedding_model values, optionally\n        filtered to only documents matching the user's filter criteria.\n\n        Args:\n            client: OpenSearch client instance\n            filter_clauses: Optional filter clauses to scope model detection\n\n        Returns:\n            List of embedding model names found in the index\n        \"\"\"\n        try:\n            agg_query = {\n                \"size\": 0,\n                \"aggs\": {\n                    \"embedding_models\": {\n                        \"terms\": {\n                            \"field\": \"embedding_model\",\n                            \"size\": 10\n                        }\n                    }\n                }\n            }\n\n            # Apply filters to model detection if any exist\n            if filter_clauses:\n                agg_query[\"query\"] = {\n                    \"bool\": {\n                        \"filter\": filter_clauses\n                    }\n                }\n\n            result = client.search(\n                index=self.index_name,\n                body=agg_query,\n                params={\"terminate_after\": 0},\n            )\n            buckets = result.get(\"aggregations\", {}).get(\"embedding_models\", {}).get(\"buckets\", [])\n            models = [b[\"key\"] for b in buckets if b[\"key\"]]\n\n            logger.info(\n                f\"Detected embedding models in corpus: {models}\"\n                + (f\" (with {len(filter_clauses)} filters)\" if filter_clauses else \"\")\n            )\n            return models\n        except Exception as e:\n            logger.warning(f\"Failed to detect embedding models: {e}\")\n            # Fallback to current model\n            return [self._get_embedding_model_name()]\n\n    def _get_index_properties(self, client: OpenSearch) -> dict[str, Any] | None:\n        \"\"\"Retrieve flattened mapping properties for the current index.\"\"\"\n        try:\n            mapping = client.indices.get_mapping(index=self.index_name)\n        except Exception as e:\n            logger.warning(\n                f\"Failed to fetch mapping for index '{self.index_name}': {e}. Proceeding without mapping metadata.\"\n            )\n            return None\n\n        properties: dict[str, Any] = {}\n        for index_data in mapping.values():\n            props = index_data.get(\"mappings\", {}).get(\"properties\", {})\n            if isinstance(props, dict):\n                properties.update(props)\n        return properties\n\n    def _is_knn_vector_field(self, properties: dict[str, Any] | None, field_name: str) -> bool:\n        \"\"\"Check whether the field is mapped as a knn_vector.\"\"\"\n        if not field_name:\n            return False\n        if properties is None:\n            logger.warning(\n                f\"Mapping metadata unavailable; assuming field '{field_name}' is usable.\"\n            )\n            return True\n        field_def = properties.get(field_name)\n        if not isinstance(field_def, dict):\n            return False\n        if field_def.get(\"type\") == \"knn_vector\":\n            return True\n\n        nested_props = field_def.get(\"properties\")\n        if isinstance(nested_props, dict) and nested_props.get(\"type\") == \"knn_vector\":\n            return True\n\n        return False\n\n    # ---------- search (multi-model hybrid) ----------\n    def search(self, query: str | None = None) -> list[dict[str, Any]]:\n        \"\"\"Perform multi-model hybrid search combining multiple vector similarities and keyword matching.\n\n        This method executes a sophisticated search that:\n        1. Auto-detects all embedding models present in the index\n        2. Generates query embeddings for ALL detected models in parallel\n        3. Combines multiple KNN queries using dis_max (picks best match)\n        4. Adds keyword search with fuzzy matching (30% weight)\n        5. Applies optional filtering and score thresholds\n        6. Returns aggregations for faceted search\n\n        Search weights:\n        - Semantic search (dis_max across all models): 70%\n        - Keyword search: 30%\n\n        Args:\n            query: Search query string (used for both vector embedding and keyword search)\n\n        Returns:\n            List of search results with page_content, metadata, and relevance scores\n\n        Raises:\n            ValueError: If embedding component is not provided or filter JSON is invalid\n        \"\"\"\n        logger.info(self.ingest_data)\n        client = self.build_client()\n        q = (query or \"\").strip()\n\n        # Parse optional filter expression\n        filter_obj = None\n        if getattr(self, \"filter_expression\", \"\") and self.filter_expression.strip():\n            try:\n                filter_obj = json.loads(self.filter_expression)\n            except json.JSONDecodeError as e:\n                msg = f\"Invalid filter_expression JSON: {e}\"\n                raise ValueError(msg) from e\n\n        if not self.embedding:\n            msg = \"Embedding is required to run hybrid search (KNN + keyword).\"\n            raise ValueError(msg)\n\n        # Build filter clauses first so we can use them in model detection\n        filter_clauses = self._coerce_filter_clauses(filter_obj)\n\n        # Detect available embedding models in the index (scoped by filters)\n        available_models = self._detect_available_models(client, filter_clauses)\n\n        if not available_models:\n            logger.warning(\"No embedding models found in index, using current model\")\n            available_models = [self._get_embedding_model_name()]\n\n        # Generate embeddings for ALL detected models in parallel\n        query_embeddings = {}\n\n        # Note: Langflow is synchronous, so we can't use true async here\n        # But we log the intent for parallel processing\n        logger.info(f\"Generating embeddings for {len(available_models)} models\")\n\n        original_model_attr = getattr(self.embedding, \"model\", None)\n        original_deployment_attr = getattr(self.embedding, \"deployment\", None)\n        original_dimensions_attr = getattr(self.embedding, \"dimensions\", None)\n\n        for model_name in available_models:\n            try:\n                # In a real async environment, these would run in parallel\n                # For now, they run sequentially\n                if hasattr(self.embedding, \"model\"):\n                    setattr(self.embedding, \"model\", model_name)\n                if hasattr(self.embedding, \"deployment\"):\n                    setattr(self.embedding, \"deployment\", model_name)\n                if hasattr(self.embedding, \"dimensions\"):\n                    setattr(self.embedding, \"dimensions\", None)\n                vec = self.embedding.embed_query(q)\n                query_embeddings[model_name] = vec\n                logger.info(f\"Generated embedding for model: {model_name}\")\n            except Exception as e:\n                logger.error(f\"Failed to generate embedding for {model_name}: {e}\")\n\n        if hasattr(self.embedding, \"model\"):\n            setattr(self.embedding, \"model\", original_model_attr)\n        if hasattr(self.embedding, \"deployment\"):\n            setattr(self.embedding, \"deployment\", original_deployment_attr)\n        if hasattr(self.embedding, \"dimensions\"):\n            setattr(self.embedding, \"dimensions\", original_dimensions_attr)\n\n        if not query_embeddings:\n            msg = \"Failed to generate embeddings for any model\"\n            raise ValueError(msg)\n\n        index_properties = self._get_index_properties(client)\n        legacy_vector_field = getattr(self, \"vector_field\", \"chunk_embedding\")\n\n        # Build KNN queries for each model\n        embedding_fields: list[str] = []\n        knn_queries_with_candidates = []\n        knn_queries_without_candidates = []\n\n        raw_num_candidates = getattr(self, \"num_candidates\", 1000)\n        try:\n            num_candidates = int(raw_num_candidates) if raw_num_candidates is not None else 0\n        except (TypeError, ValueError):\n            num_candidates = 0\n        use_num_candidates = num_candidates > 0\n\n        for model_name, embedding_vector in query_embeddings.items():\n            field_name = get_embedding_field_name(model_name)\n            selected_field = field_name\n\n            # Only use the expected dynamic field - no legacy fallback\n            # This prevents dimension mismatches between models\n            if not self._is_knn_vector_field(index_properties, selected_field):\n                logger.warning(\n                    f\"Skipping model {model_name}: field '{field_name}' is not mapped as knn_vector. \"\n                    f\"Documents must be indexed with this embedding model before querying.\"\n                )\n                continue\n\n            embedding_fields.append(selected_field)\n\n            base_query = {\n                \"knn\": {\n                    selected_field: {\n                        \"vector\": embedding_vector,\n                        \"k\": 50,\n                    }\n                }\n            }\n\n            if use_num_candidates:\n                query_with_candidates = copy.deepcopy(base_query)\n                query_with_candidates[\"knn\"][selected_field][\"num_candidates\"] = num_candidates\n            else:\n                query_with_candidates = base_query\n\n            knn_queries_with_candidates.append(query_with_candidates)\n            knn_queries_without_candidates.append(base_query)\n\n        if not knn_queries_with_candidates:\n            # No valid fields found - this can happen when:\n            # 1. Index is empty (no documents yet)\n            # 2. Embedding model has changed and field doesn't exist yet\n            # Return empty results instead of failing\n            logger.warning(\n                \"No valid knn_vector fields found for embedding models. \"\n                \"This may indicate an empty index or missing field mappings. \"\n                \"Returning empty search results.\"\n            )\n            return []\n\n        # Build exists filter - document must have at least one embedding field\n        exists_any_embedding = {\n            \"bool\": {\n                \"should\": [{\"exists\": {\"field\": f}} for f in set(embedding_fields)],\n                \"minimum_should_match\": 1\n            }\n        }\n\n        # Combine user filters with exists filter\n        all_filters = [*filter_clauses, exists_any_embedding]\n\n        # Get limit and score threshold\n        limit = (filter_obj or {}).get(\"limit\", self.number_of_results)\n        score_threshold = (filter_obj or {}).get(\"score_threshold\", 0)\n\n        # Build multi-model hybrid query\n        body = {\n            \"query\": {\n                \"bool\": {\n                    \"should\": [\n                        {\n                            \"dis_max\": {\n                                \"tie_breaker\": 0.0,  # Take only the best match, no blending\n                                \"boost\": 0.7,  # 70% weight for semantic search\n                                \"queries\": knn_queries_with_candidates\n                            }\n                        },\n                        {\n                            \"multi_match\": {\n                                \"query\": q,\n                                \"fields\": [\"text^2\", \"filename^1.5\"],\n                                \"type\": \"best_fields\",\n                                \"fuzziness\": \"AUTO\",\n                                \"boost\": 0.3,  # 30% weight for keyword search\n                            }\n                        },\n                    ],\n                    \"minimum_should_match\": 1,\n                    \"filter\": all_filters,\n                }\n            },\n            \"aggs\": {\n                \"data_sources\": {\"terms\": {\"field\": \"filename\", \"size\": 20}},\n                \"document_types\": {\"terms\": {\"field\": \"mimetype\", \"size\": 10}},\n                \"owners\": {\"terms\": {\"field\": \"owner\", \"size\": 10}},\n                \"embedding_models\": {\"terms\": {\"field\": \"embedding_model\", \"size\": 10}},\n            },\n            \"_source\": [\n                \"filename\",\n                \"mimetype\",\n                \"page\",\n                \"text\",\n                \"source_url\",\n                \"owner\",\n                \"embedding_model\",\n                \"allowed_users\",\n                \"allowed_groups\",\n            ],\n            \"size\": limit,\n        }\n\n        if isinstance(score_threshold, (int, float)) and score_threshold > 0:\n            body[\"min_score\"] = score_threshold\n\n        logger.info(\n            f\"Executing multi-model hybrid search with {len(knn_queries_with_candidates)} embedding models\"\n        )\n\n        try:\n            resp = client.search(\n                index=self.index_name, body=body, params={\"terminate_after\": 0}\n            )\n        except RequestError as e:\n            error_message = str(e)\n            lowered = error_message.lower()\n            if use_num_candidates and \"num_candidates\" in lowered:\n                logger.warning(\n                    \"Retrying search without num_candidates parameter due to cluster capabilities\",\n                    error=error_message,\n                )\n                fallback_body = copy.deepcopy(body)\n                try:\n                    fallback_body[\"query\"][\"bool\"][\"should\"][0][\"dis_max\"][\"queries\"] = knn_queries_without_candidates\n                except (KeyError, IndexError, TypeError) as inner_err:\n                    raise e from inner_err\n                resp = client.search(\n                    index=self.index_name,\n                    body=fallback_body,\n                    params={\"terminate_after\": 0},\n                )\n            elif \"knn_vector\" in lowered or (\"field\" in lowered and \"knn\" in lowered):\n                fallback_vector = next(iter(query_embeddings.values()), None)\n                if fallback_vector is None:\n                    raise\n                fallback_field = legacy_vector_field or \"chunk_embedding\"\n                logger.warning(\n                    \"KNN search failed for dynamic fields; falling back to legacy field '%s'.\",\n                    fallback_field,\n                )\n                fallback_body = copy.deepcopy(body)\n                fallback_body[\"query\"][\"bool\"][\"filter\"] = filter_clauses\n                knn_fallback = {\n                    \"knn\": {\n                        fallback_field: {\n                            \"vector\": fallback_vector,\n                            \"k\": 50,\n                        }\n                    }\n                }\n                if use_num_candidates:\n                    knn_fallback[\"knn\"][fallback_field][\"num_candidates\"] = num_candidates\n                fallback_body[\"query\"][\"bool\"][\"should\"][0][\"dis_max\"][\"queries\"] = [knn_fallback]\n                resp = client.search(\n                    index=self.index_name,\n                    body=fallback_body,\n                    params={\"terminate_after\": 0},\n                )\n            else:\n                raise\n        hits = resp.get(\"hits\", {}).get(\"hits\", [])\n\n        logger.info(f\"Found {len(hits)} results\")\n\n        return [\n            {\n                \"page_content\": hit[\"_source\"].get(\"text\", \"\"),\n                \"metadata\": {k: v for k, v in hit[\"_source\"].items() if k != \"text\"},\n                \"score\": hit.get(\"_score\"),\n            }\n            for hit in hits\n        ]\n\n    def search_documents(self) -> list[Data]:\n        \"\"\"Search documents and return results as Data objects.\n\n        This is the main interface method that performs the multi-model search using the\n        configured search_query and returns results in Langflow's Data format.\n\n        Returns:\n            List of Data objects containing search results with text and metadata\n\n        Raises:\n            Exception: If search operation fails\n        \"\"\"\n        try:\n            raw = self.search(self.search_query or \"\")\n            return [Data(text=hit[\"page_content\"], **hit[\"metadata\"]) for hit in raw]\n            self.log(self.ingest_data)\n        except Exception as e:\n            self.log(f\"search_documents error: {e}\")\n            raise\n\n    # -------- dynamic UI handling (auth switch) --------\n    async def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None) -> dict:\n        \"\"\"Dynamically update component configuration based on field changes.\n\n        This method handles real-time UI updates, particularly for authentication\n        mode changes that show/hide relevant input fields.\n\n        Args:\n            build_config: Current component configuration\n            field_value: New value for the changed field\n            field_name: Name of the field that changed\n\n        Returns:\n            Updated build configuration with appropriate field visibility\n        \"\"\"\n        try:\n            if field_name == \"auth_mode\":\n                mode = (field_value or \"basic\").strip().lower()\n                is_basic = mode == \"basic\"\n                is_jwt = mode == \"jwt\"\n\n                build_config[\"username\"][\"show\"] = is_basic\n                build_config[\"password\"][\"show\"] = is_basic\n\n                build_config[\"jwt_token\"][\"show\"] = is_jwt\n                build_config[\"jwt_header\"][\"show\"] = is_jwt\n                build_config[\"bearer_prefix\"][\"show\"] = is_jwt\n\n                build_config[\"username\"][\"required\"] = is_basic\n                build_config[\"password\"][\"required\"] = is_basic\n\n                build_config[\"jwt_token\"][\"required\"] = is_jwt\n                build_config[\"jwt_header\"][\"required\"] = is_jwt\n                build_config[\"bearer_prefix\"][\"required\"] = False\n\n                if is_basic:\n                    build_config[\"jwt_token\"][\"value\"] = \"\"\n\n                return build_config\n\n        except (KeyError, ValueError) as e:\n            self.log(f\"update_build_config error: {e}\")\n\n        return build_config\n"
              },
              "docs_metadata": {
                "_input_type": "TableInput",
                "advanced": false,
                "display_name": "Document Metadata",
                "dynamic": false,
                "info": "Additional metadata key-value pairs to be added to all ingested documents. Useful for tagging documents with source information, categories, or other custom attributes.",
                "input_types": [
                  "Data"
                ],
                "is_list": true,
                "list_add_label": "Add More",
                "name": "docs_metadata",
                "placeholder": "",
                "required": false,
                "show": true,
                "table_icon": "Table",
                "table_schema": [
                  {
                    "description": "Key name",
                    "display_name": "Key",
                    "formatter": "text",
                    "name": "key",
                    "type": "str"
                  },
                  {
                    "description": "Value of the metadata",
                    "display_name": "Value",
                    "formatter": "text",
                    "name": "value",
                    "type": "str"
                  }
                ],
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "trigger_icon": "Table",
                "trigger_text": "Open table",
                "type": "table",
                "value": []
              },
              "ef_construction": {
                "_input_type": "IntInput",
                "advanced": true,
                "display_name": "EF Construction",
                "dynamic": false,
                "info": "Size of the dynamic candidate list during index construction. Higher values improve recall but increase indexing time and memory usage.",
                "list": false,
                "list_add_label": "Add More",
                "name": "ef_construction",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "int",
                "value": 512
              },
              "embedding": {
                "_input_type": "HandleInput",
                "advanced": false,
                "display_name": "Embedding",
                "dynamic": false,
                "info": "",
                "input_types": [
                  "Embeddings"
                ],
                "list": false,
                "list_add_label": "Add More",
                "name": "embedding",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "trace_as_metadata": true,
                "type": "other",
                "value": ""
              },
              "embedding_model_name": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "Embedding Model Name",
                "dynamic": false,
                "info": "Name of the embedding model being used (e.g., 'text-embedding-3-small'). Used to create dynamic vector field names and track which model embedded each document. Auto-detected from embedding component if not specified.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "embedding_model_name",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "engine": {
                "_input_type": "DropdownInput",
                "advanced": true,
                "combobox": false,
                "dialog_inputs": {},
                "display_name": "Vector Engine",
                "dynamic": false,
                "external_options": {},
                "info": "Vector search engine for similarity calculations. 'jvector' is recommended for most use cases. Note: Amazon OpenSearch Serverless only supports 'nmslib' or 'faiss'.",
                "load_from_db": false,
                "name": "engine",
                "options": [
                  "jvector",
                  "nmslib",
                  "faiss",
                  "lucene"
                ],
                "options_metadata": [],
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "toggle": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "jvector"
              },
              "filter_expression": {
                "_input_type": "MultilineInput",
                "advanced": false,
                "copy_field": false,
                "display_name": "Search Filters (JSON)",
                "dynamic": false,
                "info": "Optional JSON configuration for search filtering, result limits, and score thresholds.\n\nFormat 1 - Explicit filters:\n{\"filter\": [{\"term\": {\"filename\":\"doc.pdf\"}}, {\"terms\":{\"owner\":[\"user1\",\"user2\"]}}], \"limit\": 10, \"score_threshold\": 1.6}\n\nFormat 2 - Context-style mapping:\n{\"data_sources\":[\"file.pdf\"], \"document_types\":[\"application/pdf\"], \"owners\":[\"user123\"]}\n\nUse __IMPOSSIBLE_VALUE__ as placeholder to ignore specific filters.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "multiline": true,
                "name": "filter_expression",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "index_name": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "Index Name",
                "dynamic": false,
                "info": "The OpenSearch index name where documents will be stored and searched. Will be created automatically if it doesn't exist.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "index_name",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "documents"
              },
              "ingest_data": {
                "_input_type": "HandleInput",
                "advanced": false,
                "display_name": "Ingest Data",
                "dynamic": false,
                "info": "",
                "input_types": [
                  "Data",
                  "DataFrame"
                ],
                "list": true,
                "list_add_label": "Add More",
                "name": "ingest_data",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "trace_as_metadata": true,
                "type": "other",
                "value": ""
              },
              "jwt_header": {
                "_input_type": "StrInput",
                "advanced": true,
                "display_name": "JWT Header Name",
                "dynamic": false,
                "info": "",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "jwt_header",
                "placeholder": "",
                "required": true,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "Authorization"
              },
              "jwt_token": {
                "_input_type": "SecretStrInput",
                "advanced": false,
                "display_name": "JWT Token",
                "dynamic": false,
                "info": "Valid JSON Web Token for authentication. Will be sent in the Authorization header (with optional 'Bearer ' prefix).",
                "input_types": [],
                "load_from_db": false,
                "name": "jwt_token",
                "password": true,
                "placeholder": "",
                "required": true,
                "show": true,
                "title_case": false,
                "type": "str",
                "value": "jwt"
              },
              "m": {
                "_input_type": "IntInput",
                "advanced": true,
                "display_name": "M Parameter",
                "dynamic": false,
                "info": "Number of bidirectional connections for each vector in the HNSW graph. Higher values improve search quality but increase memory usage and indexing time.",
                "list": false,
                "list_add_label": "Add More",
                "name": "m",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "int",
                "value": 16
              },
              "number_of_results": {
                "_input_type": "IntInput",
                "advanced": true,
                "display_name": "Default Result Limit",
                "dynamic": false,
                "info": "Default maximum number of search results to return when no limit is specified in the filter expression.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "number_of_results",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "int",
                "value": 15
              },
              "opensearch_url": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "OpenSearch URL",
                "dynamic": false,
                "info": "The connection URL for your OpenSearch cluster (e.g., http://localhost:9200 for local development or your cloud endpoint).",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "opensearch_url",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "https://opensearch:9200"
              },
              "password": {
                "_input_type": "SecretStrInput",
                "advanced": false,
                "display_name": "OpenSearch Password",
                "dynamic": false,
                "info": "",
                "input_types": [],
                "load_from_db": false,
                "name": "password",
                "password": true,
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "type": "str",
                "value": ""
              },
              "search_query": {
                "_input_type": "QueryInput",
                "advanced": false,
                "display_name": "Search Query",
                "dynamic": false,
                "info": "Enter a query to run a similarity search.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "search_query",
                "placeholder": "Enter a query...",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": true,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "query",
                "value": ""
              },
              "should_cache_vector_store": {
                "_input_type": "BoolInput",
                "advanced": true,
                "display_name": "Cache Vector Store",
                "dynamic": false,
                "info": "If True, the vector store will be cached for the current build of the component. This is useful for components that have multiple output methods and want to share the same vector store.",
                "list": false,
                "list_add_label": "Add More",
                "name": "should_cache_vector_store",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": true
              },
              "space_type": {
                "_input_type": "DropdownInput",
                "advanced": true,
                "combobox": false,
                "dialog_inputs": {},
                "display_name": "Distance Metric",
                "dynamic": false,
                "external_options": {},
                "info": "Distance metric for calculating vector similarity. 'l2' (Euclidean) is most common, 'cosinesimil' for cosine similarity, 'innerproduct' for dot product.",
                "name": "space_type",
                "options": [
                  "l2",
                  "l1",
                  "cosinesimil",
                  "linf",
                  "innerproduct"
                ],
                "options_metadata": [],
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "toggle": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "l2"
              },
              "use_ssl": {
                "_input_type": "BoolInput",
                "advanced": true,
                "display_name": "Use SSL/TLS",
                "dynamic": false,
                "info": "Enable SSL/TLS encryption for secure connections to OpenSearch.",
                "list": false,
                "list_add_label": "Add More",
                "name": "use_ssl",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": true
              },
              "username": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "Username",
                "dynamic": false,
                "info": "",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "username",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "admin"
              },
              "vector_field": {
                "_input_type": "StrInput",
                "advanced": true,
                "display_name": "Legacy Vector Field Name",
                "dynamic": false,
                "info": "Legacy field name for backward compatibility. New documents use dynamic fields (chunk_embedding_{model_name}) based on the embedding_model_name.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "vector_field",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "chunk_embedding"
              },
              "verify_certs": {
                "_input_type": "BoolInput",
                "advanced": true,
                "display_name": "Verify SSL Certificates",
                "dynamic": false,
                "info": "Verify SSL certificates when connecting. Disable for self-signed certificates in development environments.",
                "list": false,
                "list_add_label": "Add More",
                "name": "verify_certs",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": false
              }
            },
            "tool_mode": false
          },
          "selected_output": "search_results",
          "showNode": true,
          "type": "OpenSearchVectorStoreComponent"
        },
        "dragging": false,
        "id": "OpenSearchHybrid-Ve6bS",
        "measured": {
          "height": 904,
          "width": 320
        },
        "position": {
          "x": 2218.9287723423276,
          "y": 1332.2598463956504
        },
        "selected": true,
        "type": "genericNode"
      },
      {
        "data": {
          "id": "AdvancedDynamicFormBuilder-81Exw",
          "node": {
            "base_classes": [
              "Data",
              "Message"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Creates dynamic input fields that can receive data from other components or manual input.",
            "display_name": "Create Data",
            "documentation": "",
            "edited": true,
            "field_order": [
              "form_fields",
              "include_metadata"
            ],
            "frozen": false,
            "icon": "braces",
            "last_updated": "2025-11-11T15:06:45.096Z",
            "legacy": false,
            "lf_version": "1.6.3.dev0",
            "metadata": {},
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "Data",
                "group_outputs": false,
                "hidden": null,
                "method": "process_form",
                "name": "form_data",
                "options": null,
                "required_inputs": null,
                "selected": "Data",
                "tool_mode": true,
                "types": [
                  "Data"
                ],
                "value": "__UNDEFINED__"
              },
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "Message",
                "group_outputs": false,
                "hidden": null,
                "method": "get_message",
                "name": "message",
                "options": null,
                "required_inputs": null,
                "selected": "Message",
                "tool_mode": true,
                "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 typing import Any\r\n\r\nfrom langflow.custom import Component\r\nfrom langflow.io import (\r\n    BoolInput,\r\n    FloatInput,\r\n    HandleInput,\r\n    IntInput,\r\n    MultilineInput,\r\n    Output,\r\n    StrInput,\r\n    TableInput,\r\n)\r\nfrom langflow.schema.data import Data\r\nfrom langflow.schema.message import Message\r\n\r\n\r\nclass CrateData(Component):\r\n    \"\"\"Dynamic Form Component\r\n\r\n    This component creates dynamic inputs that can receive data from other components\r\n    or be filled manually. It demonstrates advanced dynamic input functionality with\r\n    component connectivity.\r\n\r\n    ## Features\r\n    - **Dynamic Input Generation**: Create inputs based on table configuration\r\n    - **Component Connectivity**: Inputs can receive data from other components\r\n    - **Multiple Input Types**: Support for text, number, boolean, and handle inputs\r\n    - **Flexible Data Sources**: Manual input OR component connections\r\n    - **Real-time Updates**: Form fields update immediately when table changes\r\n         - **Multiple Output Formats**: Data and formatted Message outputs\r\n    - **JSON Output**: Collects all dynamic inputs into a structured JSON response\r\n\r\n    ## Use Cases\r\n    - Dynamic API parameter collection from multiple sources\r\n    - Variable data aggregation from different components\r\n    - Flexible pipeline configuration\r\n    - Multi-source data processing\r\n\r\n    ## Field Types Available\r\n    - **text**: Single-line text input (can connect to Text/String outputs)\r\n    - **multiline**: Multi-line text input (can connect to Text outputs)\r\n    - **number**: Integer input (can connect to Number outputs)\r\n    - **float**: Decimal number input (can connect to Number outputs)\r\n    - **boolean**: True/false checkbox (can connect to Boolean outputs)\r\n    - **handle**: Generic data input (can connect to any component output)\r\n    - **data**: Structured data input (can connect to Data outputs)\r\n\r\n    ## Input Types for Connections\r\n    - **Text**: Text/String data from components\r\n    - **Data**: Structured data objects\r\n    - **Message**: Message objects with text content\r\n    - **Number**: Numeric values\r\n    - **Boolean**: True/false values\r\n    - **Any**: Accepts any type of connection\r\n    - **Combinations**: Text,Message | Data,Text | Text,Data,Message | etc.\r\n    \"\"\"\r\n\r\n    display_name = \"Create Data\"\r\n    description = \"Creates dynamic input fields that can receive data from other components or manual input.\"\r\n    icon = \"braces\"\r\n    name = \"AdvancedDynamicFormBuilder\"\r\n\r\n    def __init__(self, **kwargs):\r\n        super().__init__(**kwargs)\r\n        self._dynamic_inputs = {}\r\n\r\n    inputs = [\r\n        TableInput(\r\n            name=\"form_fields\",\r\n            display_name=\"Input Configuration\",\r\n            info=\"Define the dynamic form fields. Each row creates a new input field that can connect to other components.\",\r\n            table_schema=[\r\n                {\r\n                    \"name\": \"field_name\",\r\n                    \"display_name\": \"Field Name\",\r\n                    \"type\": \"str\",\r\n                    \"description\": \"Name for the field (used as both internal name and display label)\",\r\n                },\r\n                {\r\n                    \"name\": \"field_type\",\r\n                    \"display_name\": \"Field Type\",\r\n                    \"type\": \"str\",\r\n                    \"description\": \"Type of input field to create\",\r\n                    \"options\": [\"Text\", \"Data\", \"Number\", \"Handle\", \"Boolean\"],\r\n                    \"value\": \"Text\",\r\n                },\r\n            ],\r\n            value=[{\"field_name\": \"field_name\", \"field_type\": \"Text\"}],\r\n            real_time_refresh=True,\r\n        ),\r\n        BoolInput(\r\n            name=\"include_metadata\",\r\n            display_name=\"Include Metadata\",\r\n            info=\"Include form configuration metadata in the output.\",\r\n            value=False,\r\n            advanced=True,\r\n        ),\r\n    ]\r\n\r\n    outputs = [\r\n        Output(display_name=\"Data\", name=\"form_data\", method=\"process_form\"),\r\n        Output(display_name=\"Message\", name=\"message\", method=\"get_message\"),\r\n    ]\r\n\r\n    def update_build_config(self, build_config: dict, field_value: Any, field_name: str = None) -> dict:\r\n        \"\"\"Update build configuration to add dynamic inputs that can connect to other components.\"\"\"\r\n        if field_name == \"form_fields\":\r\n            # Store current values before clearing dynamic inputs\r\n            current_values = {}\r\n            keys_to_remove = [key for key in build_config if key.startswith(\"dynamic_\")]\r\n            for key in keys_to_remove:\r\n                # Preserve the current value before deletion\r\n                if hasattr(self, key):\r\n                    current_values[key] = getattr(self, key)\r\n                del build_config[key]\r\n\r\n            # Add dynamic inputs based on table configuration\r\n            # Safety check to ensure field_value is not None and is iterable\r\n            if field_value is None:\r\n                field_value = []\r\n\r\n            for i, field_config in enumerate(field_value):\r\n                # Safety check to ensure field_config is not None\r\n                if field_config is None:\r\n                    continue\r\n\r\n                field_name = field_config.get(\"field_name\", f\"field_{i}\")\r\n                display_name = field_name  # Use field_name as display_name\r\n                field_type_option = field_config.get(\"field_type\", \"Text\")\r\n                default_value = \"\"  # All fields have empty default value\r\n                required = False  # All fields are optional by default\r\n                help_text = \"\"  # All fields have empty help text\r\n\r\n                # Map field type options to actual field types and input types\r\n                field_type_mapping = {\r\n                    \"Text\": {\"field_type\": \"multiline\", \"input_types\": [\"Text\", \"Message\"]},\r\n                    \"Data\": {\"field_type\": \"data\", \"input_types\": [\"Data\"]},\r\n                    \"Number\": {\"field_type\": \"number\", \"input_types\": [\"Text\", \"Message\"]},\r\n                    \"Handle\": {\"field_type\": \"handle\", \"input_types\": [\"Text\", \"Data\", \"Message\"]},\r\n                    \"Boolean\": {\"field_type\": \"boolean\", \"input_types\": None},\r\n                }\r\n\r\n                field_config_mapped = field_type_mapping.get(\r\n                    field_type_option, {\"field_type\": \"text\", \"input_types\": []}\r\n                )\r\n                field_type = field_config_mapped[\"field_type\"]\r\n                input_types_list = field_config_mapped[\"input_types\"]\r\n\r\n                # Create the appropriate input type based on field_type\r\n                dynamic_input_name = f\"dynamic_{field_name}\"\r\n\r\n                if field_type == \"text\":\r\n                    # Use preserved value if available, otherwise use default\r\n                    current_value = current_values.get(dynamic_input_name, default_value)\r\n                    if current_value is None:\r\n                        current_value = default_value\r\n                    \r\n                    if input_types_list:\r\n                        build_config[dynamic_input_name] = StrInput(\r\n                            name=dynamic_input_name,\r\n                            display_name=display_name,\r\n                            info=f\"{help_text} (Can connect to: {', '.join(input_types_list)})\",\r\n                            value=current_value,\r\n                            required=required,\r\n                            input_types=input_types_list,\r\n                        )\r\n                    else:\r\n                        build_config[dynamic_input_name] = StrInput(\r\n                            name=dynamic_input_name,\r\n                            display_name=display_name,\r\n                            info=help_text,\r\n                            value=current_value,\r\n                            required=required,\r\n                        )\r\n\r\n                elif field_type == \"multiline\":\r\n                    # Use preserved value if available, otherwise use default\r\n                    current_value = current_values.get(dynamic_input_name, default_value)\r\n                    if current_value is None:\r\n                        current_value = default_value\r\n                    \r\n                    if input_types_list:\r\n                        build_config[dynamic_input_name] = MultilineInput(\r\n                            name=dynamic_input_name,\r\n                            display_name=display_name,\r\n                            info=f\"{help_text} (Can connect to: {', '.join(input_types_list)})\",\r\n                            value=current_value,\r\n                            required=required,\r\n                            input_types=input_types_list,\r\n                        )\r\n                    else:\r\n                        build_config[dynamic_input_name] = MultilineInput(\r\n                            name=dynamic_input_name,\r\n                            display_name=display_name,\r\n                            info=help_text,\r\n                            value=current_value,\r\n                            required=required,\r\n                        )\r\n\r\n                elif field_type == \"number\":\r\n                    # Use preserved value if available, otherwise use default\r\n                    current_value = current_values.get(dynamic_input_name, default_value)\r\n                    if current_value is None:\r\n                        current_value = default_value\r\n                    \r\n                    try:\r\n                        if current_value:\r\n                            current_int = int(current_value)\r\n                        else:\r\n                            current_int = 0\r\n                    except (ValueError, TypeError):\r\n                        try:\r\n                            current_int = int(default_value) if default_value else 0\r\n                        except ValueError:\r\n                            current_int = 0\r\n\r\n                    if input_types_list:\r\n                        build_config[dynamic_input_name] = IntInput(\r\n                            name=dynamic_input_name,\r\n                            display_name=display_name,\r\n                            info=f\"{help_text} (Can connect to: {', '.join(input_types_list)})\",\r\n                            value=current_int,\r\n                            required=required,\r\n                            input_types=input_types_list,\r\n                        )\r\n                    else:\r\n                        build_config[dynamic_input_name] = IntInput(\r\n                            name=dynamic_input_name,\r\n                            display_name=display_name,\r\n                            info=help_text,\r\n                            value=current_int,\r\n                            required=required,\r\n                        )\r\n\r\n                elif field_type == \"float\":\r\n                    # Use preserved value if available, otherwise use default\r\n                    current_value = current_values.get(dynamic_input_name, default_value)\r\n                    if current_value is None:\r\n                        current_value = default_value\r\n                    \r\n                    try:\r\n                        if current_value:\r\n                            current_float = float(current_value)\r\n                        else:\r\n                            current_float = 0.0\r\n                    except (ValueError, TypeError):\r\n                        try:\r\n                            current_float = float(default_value) if default_value else 0.0\r\n                        except ValueError:\r\n                            current_float = 0.0\r\n\r\n                    if input_types_list:\r\n                        build_config[dynamic_input_name] = FloatInput(\r\n                            name=dynamic_input_name,\r\n                            display_name=display_name,\r\n                            info=f\"{help_text} (Can connect to: {', '.join(input_types_list)})\",\r\n                            value=current_float,\r\n                            required=required,\r\n                            input_types=input_types_list,\r\n                        )\r\n                    else:\r\n                        build_config[dynamic_input_name] = FloatInput(\r\n                            name=dynamic_input_name,\r\n                            display_name=display_name,\r\n                            info=help_text,\r\n                            value=current_float,\r\n                            required=required,\r\n                        )\r\n\r\n                elif field_type == \"boolean\":\r\n                    # Use preserved value if available, otherwise use default\r\n                    current_value = current_values.get(dynamic_input_name, default_value)\r\n                    if current_value is None:\r\n                        current_value = default_value\r\n                    \r\n                    # Convert current value to boolean\r\n                    if isinstance(current_value, bool):\r\n                        current_bool = current_value\r\n                    else:\r\n                        current_bool = str(current_value).lower() in [\"true\", \"1\", \"yes\"] if current_value else False\r\n\r\n                    # Boolean fields don't use input_types parameter to avoid errors\r\n                    build_config[dynamic_input_name] = BoolInput(\r\n                        name=dynamic_input_name,\r\n                        display_name=display_name,\r\n                        info=help_text,\r\n                        value=current_bool,\r\n                        input_types=[],\r\n                        required=required,\r\n                    )\r\n\r\n                elif field_type == \"handle\":\r\n                    # HandleInput for generic data connections\r\n                    build_config[dynamic_input_name] = HandleInput(\r\n                        name=dynamic_input_name,\r\n                        display_name=display_name,\r\n                        info=f\"{help_text} (Accepts: {', '.join(input_types_list) if input_types_list else 'Any'})\",\r\n                        input_types=input_types_list if input_types_list else [\"Data\", \"Text\", \"Message\"],\r\n                        required=required,\r\n                    )\r\n\r\n                elif field_type == \"data\":\r\n                    # Specialized for Data type connections\r\n                    build_config[dynamic_input_name] = HandleInput(\r\n                        name=dynamic_input_name,\r\n                        display_name=display_name,\r\n                        info=f\"{help_text} (Data input)\",\r\n                        input_types=[\"Data\"] if not input_types_list else input_types_list,\r\n                        required=required,\r\n                    )\r\n\r\n                else:\r\n                    # Default to text input for unknown types\r\n                    # Use preserved value if available, otherwise use default\r\n                    current_value = current_values.get(dynamic_input_name, default_value)\r\n                    if current_value is None:\r\n                        current_value = default_value\r\n                    \r\n                    build_config[dynamic_input_name] = StrInput(\r\n                        name=dynamic_input_name,\r\n                        display_name=display_name,\r\n                        info=f\"{help_text} (Unknown type '{field_type}', defaulting to text)\",\r\n                        value=current_value,\r\n                        required=required,\r\n                    )\r\n\r\n        return build_config\r\n\r\n    def get_dynamic_values(self) -> dict[str, Any]:\r\n        \"\"\"Extract simple values from all dynamic inputs, handling both manual and connected inputs.\"\"\"\r\n        dynamic_values = {}\r\n        connection_info = {}\r\n        form_fields = getattr(self, \"form_fields\", [])\r\n\r\n        for field_config in form_fields:\r\n            # Safety check to ensure field_config is not None\r\n            if field_config is None:\r\n                continue\r\n\r\n            field_name = field_config.get(\"field_name\", \"\")\r\n            if field_name:\r\n                dynamic_input_name = f\"dynamic_{field_name}\"\r\n                value = getattr(self, dynamic_input_name, None)\r\n\r\n                # Extract simple values from connections or manual input\r\n                if value is not None:\r\n                    try:\r\n                        extracted_value = self._extract_simple_value(value)\r\n                        dynamic_values[field_name] = extracted_value\r\n\r\n                        # Determine connection type for status\r\n                        if hasattr(value, \"text\") and hasattr(value, \"timestamp\"):\r\n                            connection_info[field_name] = \"Connected (Message)\"\r\n                        elif hasattr(value, \"data\"):\r\n                            connection_info[field_name] = \"Connected (Data)\"\r\n                        elif isinstance(value, (str, int, float, bool, list, dict)):\r\n                            connection_info[field_name] = \"Manual input\"\r\n                        else:\r\n                            connection_info[field_name] = \"Connected (Object)\"\r\n\r\n                    except Exception:\r\n                        # Fallback to string representation if all else fails\r\n                        dynamic_values[field_name] = str(value)\r\n                        connection_info[field_name] = \"Error\"\r\n                else:\r\n                    # Use empty default value if nothing connected\r\n                    dynamic_values[field_name] = \"\"\r\n                    connection_info[field_name] = \"Empty default\"\r\n\r\n        # Store connection info for status output\r\n        self._connection_info = connection_info\r\n        return dynamic_values\r\n\r\n    def _extract_simple_value(self, value: Any) -> Any:\r\n        \"\"\"Extract the simplest, most useful value from any input type.\"\"\"\r\n        # Handle None\r\n        if value is None:\r\n            return None\r\n\r\n        # Handle simple types directly\r\n        if isinstance(value, (str, int, float, bool)):\r\n            return value\r\n\r\n        # Handle lists and tuples - keep simple\r\n        if isinstance(value, (list, tuple)):\r\n            return [self._extract_simple_value(item) for item in value]\r\n\r\n        # Handle dictionaries - keep simple\r\n        if isinstance(value, dict):\r\n            return {str(k): self._extract_simple_value(v) for k, v in value.items()}\r\n\r\n        # Handle Message objects - extract only the text\r\n        if hasattr(value, \"text\"):\r\n            return str(value.text) if value.text is not None else \"\"\r\n\r\n        # Handle Data objects - extract the data content\r\n        if hasattr(value, \"data\") and value.data is not None:\r\n            return self._extract_simple_value(value.data)\r\n\r\n        # For any other object, convert to string\r\n        return str(value)\r\n\r\n    def process_form(self) -> Data:\r\n        \"\"\"Process all dynamic form inputs and return clean data with just field values.\"\"\"\r\n        # Get all dynamic values (just the key:value pairs)\r\n        dynamic_values = self.get_dynamic_values()\r\n\r\n        # Update status with connection info\r\n        connected_fields = len([v for v in getattr(self, \"_connection_info\", {}).values() if \"Connected\" in v])\r\n        total_fields = len(dynamic_values)\r\n\r\n        self.status = f\"Form processed successfully. {connected_fields}/{total_fields} fields connected to components.\"\r\n\r\n        # Return clean Data object with just the field values\r\n        return Data(data=dynamic_values)\r\n\r\n    def get_message(self) -> Message:\r\n        \"\"\"Return form data as a formatted text message.\"\"\"\r\n        # Get all dynamic values\r\n        dynamic_values = self.get_dynamic_values()\r\n\r\n        if not dynamic_values:\r\n            return Message(text=\"No form data available\")\r\n\r\n        # Format as text message\r\n        message_lines = [\"📋 Form Data:\"]\r\n        message_lines.append(\"=\" * 40)\r\n\r\n        for field_name, value in dynamic_values.items():\r\n            # Use field_name as display_name\r\n            display_name = field_name\r\n\r\n            message_lines.append(f\"• {display_name}: {value}\")\r\n\r\n        message_lines.append(\"=\" * 40)\r\n        message_lines.append(f\"Total fields: {len(dynamic_values)}\")\r\n\r\n        message_text = \"\\n\".join(message_lines)\r\n        self.status = f\"Message formatted with {len(dynamic_values)} fields\"\r\n\r\n        return Message(text=message_text)"
              },
              "dynamic_connector_type": {
                "_input_type": "MultilineInput",
                "advanced": false,
                "copy_field": false,
                "display_name": "connector_type",
                "dynamic": false,
                "helper_text": null,
                "info": " (Can connect to: Text, Message)",
                "input_types": [
                  "Text",
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "multiline": true,
                "name": "dynamic_connector_type",
                "placeholder": "",
                "real_time_refresh": null,
                "refresh_button": null,
                "refresh_button_text": null,
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "dynamic_owner": {
                "_input_type": "MultilineInput",
                "advanced": false,
                "copy_field": false,
                "display_name": "owner",
                "dynamic": false,
                "helper_text": null,
                "info": " (Can connect to: Text, Message)",
                "input_types": [
                  "Text",
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "multiline": true,
                "name": "dynamic_owner",
                "placeholder": "",
                "real_time_refresh": null,
                "refresh_button": null,
                "refresh_button_text": null,
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "dynamic_owner_email": {
                "_input_type": "MultilineInput",
                "advanced": false,
                "copy_field": false,
                "display_name": "owner_email",
                "dynamic": false,
                "helper_text": null,
                "info": " (Can connect to: Text, Message)",
                "input_types": [
                  "Text",
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "multiline": true,
                "name": "dynamic_owner_email",
                "placeholder": "",
                "real_time_refresh": null,
                "refresh_button": null,
                "refresh_button_text": null,
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "dynamic_owner_name": {
                "_input_type": "MultilineInput",
                "advanced": false,
                "copy_field": false,
                "display_name": "owner_name",
                "dynamic": false,
                "helper_text": null,
                "info": " (Can connect to: Text, Message)",
                "input_types": [
                  "Text",
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "multiline": true,
                "name": "dynamic_owner_name",
                "placeholder": "",
                "real_time_refresh": null,
                "refresh_button": null,
                "refresh_button_text": null,
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "form_fields": {
                "_input_type": "TableInput",
                "advanced": false,
                "display_name": "Input Configuration",
                "dynamic": false,
                "info": "Define the dynamic form fields. Each row creates a new input field that can connect to other components.",
                "is_list": true,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "form_fields",
                "placeholder": "",
                "real_time_refresh": true,
                "required": false,
                "show": true,
                "table_icon": "Table",
                "table_schema": {
                  "columns": [
                    {
                      "default": "None",
                      "description": "Name for the field (used as both internal name and display label)",
                      "disable_edit": false,
                      "display_name": "Field Name",
                      "edit_mode": "popover",
                      "filterable": true,
                      "formatter": "text",
                      "hidden": false,
                      "name": "field_name",
                      "sortable": true,
                      "type": "str"
                    },
                    {
                      "default": "None",
                      "description": "Type of input field to create",
                      "disable_edit": false,
                      "display_name": "Field Type",
                      "edit_mode": "popover",
                      "filterable": true,
                      "formatter": "text",
                      "hidden": false,
                      "name": "field_type",
                      "options": [
                        "Text",
                        "Data",
                        "Number",
                        "Handle",
                        "Boolean"
                      ],
                      "sortable": true,
                      "type": "str"
                    }
                  ]
                },
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "trigger_icon": "Table",
                "trigger_text": "Open table",
                "type": "table",
                "value": [
                  {
                    "field_name": "owner",
                    "field_type": "Text"
                  },
                  {
                    "field_name": "owner_name",
                    "field_type": "Text"
                  },
                  {
                    "field_name": "owner_email",
                    "field_type": "Text"
                  },
                  {
                    "field_name": "connector_type",
                    "field_type": "Text"
                  }
                ]
              },
              "include_metadata": {
                "_input_type": "BoolInput",
                "advanced": true,
                "display_name": "Include Metadata",
                "dynamic": false,
                "info": "Include form configuration metadata in the output.",
                "list": false,
                "list_add_label": "Add More",
                "name": "include_metadata",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": false
              }
            },
            "tool_mode": false
          },
          "selected_output": "form_data",
          "showNode": true,
          "type": "AdvancedDynamicFormBuilder"
        },
        "dragging": false,
        "id": "AdvancedDynamicFormBuilder-81Exw",
        "measured": {
          "height": 552,
          "width": 320
        },
        "position": {
          "x": 1363.7188885586695,
          "y": 1810.433145275832
        },
        "selected": false,
        "type": "genericNode"
      },
      {
        "data": {
          "id": "SecretInput-F34VJ",
          "node": {
            "base_classes": [
              "Message"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Allows the selection of a secret to be generated as output..",
            "display_name": "Secret Input",
            "documentation": "https://docs.langflow.org/components-io#text-input",
            "edited": true,
            "field_order": [
              "input_value"
            ],
            "frozen": false,
            "icon": "type",
            "legacy": false,
            "lf_version": "1.6.3.dev0",
            "metadata": {},
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "Output Text",
                "group_outputs": false,
                "hidden": null,
                "method": "text_response",
                "name": "text",
                "options": null,
                "required_inputs": null,
                "selected": "Message",
                "tool_mode": true,
                "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.base.io.text import TextComponent\r\nfrom langflow.io import MultilineInput, Output, SecretStrInput\r\nfrom langflow.schema.message import Message\r\n\r\n\r\nclass SecretInputComponent(TextComponent):\r\n    display_name = \"Secret Input\"\r\n    description = \"Allows the selection of a secret to be generated as output..\"\r\n    documentation: str = \"https://docs.langflow.org/components-io#text-input\"\r\n    icon = \"type\"\r\n    name = \"SecretInput\"\r\n\r\n    inputs = [\r\n        SecretStrInput(\r\n            name=\"input_value\",\r\n            display_name=\"Secret\",\r\n            info=\"Secret to be passed as input.\",\r\n        ),\r\n    ]\r\n    outputs = [\r\n        Output(display_name=\"Output Text\", name=\"text\", method=\"text_response\"),\r\n    ]\r\n\r\n    def text_response(self) -> Message:\r\n        return Message(\r\n            text=self.input_value,\r\n        )\r\n"
              },
              "input_value": {
                "_input_type": "SecretStrInput",
                "advanced": false,
                "display_name": "Secret",
                "dynamic": false,
                "info": "Secret to be passed as input.",
                "input_types": [],
                "load_from_db": true,
                "name": "input_value",
                "password": true,
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "type": "str",
                "value": "CONNECTOR_TYPE"
              }
            },
            "tool_mode": false
          },
          "showNode": true,
          "type": "SecretInput"
        },
        "dragging": false,
        "id": "SecretInput-F34VJ",
        "measured": {
          "height": 220,
          "width": 320
        },
        "position": {
          "x": 717.1931358375118,
          "y": 1935.3672380902274
        },
        "selected": false,
        "type": "genericNode"
      },
      {
        "data": {
          "id": "SecretInput-b2cab",
          "node": {
            "base_classes": [
              "Message"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Allows the selection of a secret to be generated as output..",
            "display_name": "Secret Input",
            "documentation": "https://docs.langflow.org/components-io#text-input",
            "edited": true,
            "field_order": [
              "input_value"
            ],
            "frozen": false,
            "icon": "type",
            "legacy": false,
            "lf_version": "1.6.3.dev0",
            "metadata": {},
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "Output Text",
                "group_outputs": false,
                "hidden": null,
                "method": "text_response",
                "name": "text",
                "options": null,
                "required_inputs": null,
                "selected": "Message",
                "tool_mode": true,
                "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.base.io.text import TextComponent\r\nfrom langflow.io import MultilineInput, Output, SecretStrInput\r\nfrom langflow.schema.message import Message\r\n\r\n\r\nclass SecretInputComponent(TextComponent):\r\n    display_name = \"Secret Input\"\r\n    description = \"Allows the selection of a secret to be generated as output..\"\r\n    documentation: str = \"https://docs.langflow.org/components-io#text-input\"\r\n    icon = \"type\"\r\n    name = \"SecretInput\"\r\n\r\n    inputs = [\r\n        SecretStrInput(\r\n            name=\"input_value\",\r\n            display_name=\"Secret\",\r\n            info=\"Secret to be passed as input.\",\r\n        ),\r\n    ]\r\n    outputs = [\r\n        Output(display_name=\"Output Text\", name=\"text\", method=\"text_response\"),\r\n    ]\r\n\r\n    def text_response(self) -> Message:\r\n        return Message(\r\n            text=self.input_value,\r\n        )\r\n"
              },
              "input_value": {
                "_input_type": "SecretStrInput",
                "advanced": false,
                "display_name": "Secret",
                "dynamic": false,
                "info": "Secret to be passed as input.",
                "input_types": [],
                "load_from_db": true,
                "name": "input_value",
                "password": true,
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "type": "str",
                "value": "OWNER"
              }
            },
            "tool_mode": false
          },
          "showNode": true,
          "type": "SecretInput"
        },
        "dragging": false,
        "id": "SecretInput-b2cab",
        "measured": {
          "height": 220,
          "width": 320
        },
        "position": {
          "x": 715.4359658918343,
          "y": 2198.0228056169435
        },
        "selected": false,
        "type": "genericNode"
      },
      {
        "data": {
          "id": "SecretInput-ZVfuS",
          "node": {
            "base_classes": [
              "Message"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Allows the selection of a secret to be generated as output..",
            "display_name": "Secret Input",
            "documentation": "https://docs.langflow.org/components-io#text-input",
            "edited": true,
            "field_order": [
              "input_value"
            ],
            "frozen": false,
            "icon": "type",
            "legacy": false,
            "lf_version": "1.6.3.dev0",
            "metadata": {},
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "Output Text",
                "group_outputs": false,
                "hidden": null,
                "method": "text_response",
                "name": "text",
                "options": null,
                "required_inputs": null,
                "selected": "Message",
                "tool_mode": true,
                "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.base.io.text import TextComponent\r\nfrom langflow.io import MultilineInput, Output, SecretStrInput\r\nfrom langflow.schema.message import Message\r\n\r\n\r\nclass SecretInputComponent(TextComponent):\r\n    display_name = \"Secret Input\"\r\n    description = \"Allows the selection of a secret to be generated as output..\"\r\n    documentation: str = \"https://docs.langflow.org/components-io#text-input\"\r\n    icon = \"type\"\r\n    name = \"SecretInput\"\r\n\r\n    inputs = [\r\n        SecretStrInput(\r\n            name=\"input_value\",\r\n            display_name=\"Secret\",\r\n            info=\"Secret to be passed as input.\",\r\n        ),\r\n    ]\r\n    outputs = [\r\n        Output(display_name=\"Output Text\", name=\"text\", method=\"text_response\"),\r\n    ]\r\n\r\n    def text_response(self) -> Message:\r\n        return Message(\r\n            text=self.input_value,\r\n        )\r\n"
              },
              "input_value": {
                "_input_type": "SecretStrInput",
                "advanced": false,
                "display_name": "Secret",
                "dynamic": false,
                "info": "Secret to be passed as input.",
                "input_types": [],
                "load_from_db": true,
                "name": "input_value",
                "password": true,
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "type": "str",
                "value": "OWNER_EMAIL"
              }
            },
            "tool_mode": false
          },
          "showNode": true,
          "type": "SecretInput"
        },
        "dragging": false,
        "id": "SecretInput-ZVfuS",
        "measured": {
          "height": 220,
          "width": 320
        },
        "position": {
          "x": 714.0740919106219,
          "y": 2445.0562064336955
        },
        "selected": false,
        "type": "genericNode"
      },
      {
        "data": {
          "id": "SecretInput-Iqtxd",
          "node": {
            "base_classes": [
              "Message"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Allows the selection of a secret to be generated as output..",
            "display_name": "Secret Input",
            "documentation": "https://docs.langflow.org/components-io#text-input",
            "edited": true,
            "field_order": [
              "input_value"
            ],
            "frozen": false,
            "icon": "type",
            "legacy": false,
            "lf_version": "1.6.3.dev0",
            "metadata": {},
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "Output Text",
                "group_outputs": false,
                "hidden": null,
                "method": "text_response",
                "name": "text",
                "options": null,
                "required_inputs": null,
                "selected": "Message",
                "tool_mode": true,
                "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.base.io.text import TextComponent\r\nfrom langflow.io import MultilineInput, Output, SecretStrInput\r\nfrom langflow.schema.message import Message\r\n\r\n\r\nclass SecretInputComponent(TextComponent):\r\n    display_name = \"Secret Input\"\r\n    description = \"Allows the selection of a secret to be generated as output..\"\r\n    documentation: str = \"https://docs.langflow.org/components-io#text-input\"\r\n    icon = \"type\"\r\n    name = \"SecretInput\"\r\n\r\n    inputs = [\r\n        SecretStrInput(\r\n            name=\"input_value\",\r\n            display_name=\"Secret\",\r\n            info=\"Secret to be passed as input.\",\r\n        ),\r\n    ]\r\n    outputs = [\r\n        Output(display_name=\"Output Text\", name=\"text\", method=\"text_response\"),\r\n    ]\r\n\r\n    def text_response(self) -> Message:\r\n        return Message(\r\n            text=self.input_value,\r\n        )\r\n"
              },
              "input_value": {
                "_input_type": "SecretStrInput",
                "advanced": false,
                "display_name": "Secret",
                "dynamic": false,
                "info": "Secret to be passed as input.",
                "input_types": [],
                "load_from_db": true,
                "name": "input_value",
                "password": true,
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "type": "str",
                "value": "OWNER_NAME"
              }
            },
            "tool_mode": false
          },
          "showNode": true,
          "type": "SecretInput"
        },
        "dragging": false,
        "id": "SecretInput-Iqtxd",
        "measured": {
          "height": 220,
          "width": 320
        },
        "position": {
          "x": 712.1292482141275,
          "y": 2691.2573524344616
        },
        "selected": false,
        "type": "genericNode"
      },
      {
        "data": {
          "id": "DoclingRemote-Dp3PX",
          "node": {
            "base_classes": [
              "DataFrame"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Uses Docling to process input documents connecting to your instance of Docling Serve.",
            "display_name": "Docling Serve",
            "documentation": "https://docling-project.github.io/docling/",
            "edited": false,
            "field_order": [
              "path",
              "file_path",
              "separator",
              "silent_errors",
              "delete_server_file_after_processing",
              "ignore_unsupported_extensions",
              "ignore_unspecified_files",
              "api_url",
              "max_concurrency",
              "max_poll_timeout",
              "api_headers",
              "docling_serve_opts"
            ],
            "frozen": false,
            "icon": "Docling",
            "legacy": false,
            "lf_version": "1.6.3.dev0",
            "metadata": {
              "code_hash": "26eeb513dded",
              "dependencies": {
                "dependencies": [
                  {
                    "name": "httpx",
                    "version": "0.28.1"
                  },
                  {
                    "name": "docling_core",
                    "version": "2.48.4"
                  },
                  {
                    "name": "pydantic",
                    "version": "2.10.6"
                  },
                  {
                    "name": "lfx",
                    "version": "0.1.12.dev31"
                  }
                ],
                "total_dependencies": 4
              },
              "module": "lfx.components.docling.docling_remote.DoclingRemoteComponent"
            },
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "Files",
                "group_outputs": false,
                "method": "load_files",
                "name": "dataframe",
                "selected": "DataFrame",
                "tool_mode": true,
                "types": [
                  "DataFrame"
                ],
                "value": "__UNDEFINED__"
              }
            ],
            "pinned": false,
            "template": {
              "_type": "Component",
              "api_headers": {
                "_input_type": "NestedDictInput",
                "advanced": true,
                "display_name": "HTTP headers",
                "dynamic": false,
                "info": "Optional dictionary of additional headers required for connecting to Docling Serve.",
                "list": false,
                "list_add_label": "Add More",
                "name": "api_headers",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "NestedDict",
                "value": {}
              },
              "api_url": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "Server address",
                "dynamic": false,
                "info": "URL of the Docling Serve instance.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "api_url",
                "placeholder": "",
                "required": true,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "http://localhost:5001"
              },
              "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": "import base64\nimport time\nfrom concurrent.futures import Future, ThreadPoolExecutor\nfrom pathlib import Path\nfrom typing import Any\n\nimport httpx\nfrom docling_core.types.doc import DoclingDocument\nfrom pydantic import ValidationError\n\nfrom lfx.base.data import BaseFileComponent\nfrom lfx.inputs import IntInput, NestedDictInput, StrInput\nfrom lfx.inputs.inputs import FloatInput\nfrom lfx.schema import Data\nfrom lfx.utils.util import transform_localhost_url\n\n\nclass DoclingRemoteComponent(BaseFileComponent):\n    display_name = \"Docling Serve\"\n    description = \"Uses Docling to process input documents connecting to your instance of Docling Serve.\"\n    documentation = \"https://docling-project.github.io/docling/\"\n    trace_type = \"tool\"\n    icon = \"Docling\"\n    name = \"DoclingRemote\"\n\n    MAX_500_RETRIES = 5\n\n    # https://docling-project.github.io/docling/usage/supported_formats/\n    VALID_EXTENSIONS = [\n        \"adoc\",\n        \"asciidoc\",\n        \"asc\",\n        \"bmp\",\n        \"csv\",\n        \"dotx\",\n        \"dotm\",\n        \"docm\",\n        \"docx\",\n        \"htm\",\n        \"html\",\n        \"jpeg\",\n        \"json\",\n        \"md\",\n        \"pdf\",\n        \"png\",\n        \"potx\",\n        \"ppsx\",\n        \"pptm\",\n        \"potm\",\n        \"ppsm\",\n        \"pptx\",\n        \"tiff\",\n        \"txt\",\n        \"xls\",\n        \"xlsx\",\n        \"xhtml\",\n        \"xml\",\n        \"webp\",\n    ]\n\n    inputs = [\n        *BaseFileComponent.get_base_inputs(),\n        StrInput(\n            name=\"api_url\",\n            display_name=\"Server address\",\n            info=\"URL of the Docling Serve instance.\",\n            required=True,\n        ),\n        IntInput(\n            name=\"max_concurrency\",\n            display_name=\"Concurrency\",\n            info=\"Maximum number of concurrent requests for the server.\",\n            advanced=True,\n            value=2,\n        ),\n        FloatInput(\n            name=\"max_poll_timeout\",\n            display_name=\"Maximum poll time\",\n            info=\"Maximum waiting time for the document conversion to complete.\",\n            advanced=True,\n            value=3600,\n        ),\n        NestedDictInput(\n            name=\"api_headers\",\n            display_name=\"HTTP headers\",\n            advanced=True,\n            required=False,\n            info=(\"Optional dictionary of additional headers required for connecting to Docling Serve.\"),\n        ),\n        NestedDictInput(\n            name=\"docling_serve_opts\",\n            display_name=\"Docling options\",\n            advanced=True,\n            required=False,\n            info=(\n                \"Optional dictionary of additional options. \"\n                \"See https://github.com/docling-project/docling-serve/blob/main/docs/usage.md for more information.\"\n            ),\n        ),\n    ]\n\n    outputs = [\n        *BaseFileComponent.get_base_outputs(),\n    ]\n\n    def process_files(self, file_list: list[BaseFileComponent.BaseFile]) -> list[BaseFileComponent.BaseFile]:\n        # Transform localhost URLs to container-accessible hosts when running in a container\n        transformed_url = transform_localhost_url(self.api_url)\n        base_url = f\"{transformed_url}/v1\"\n\n        def _convert_document(client: httpx.Client, file_path: Path, options: dict[str, Any]) -> Data | None:\n            encoded_doc = base64.b64encode(file_path.read_bytes()).decode()\n            payload = {\n                \"options\": options,\n                \"sources\": [{\"kind\": \"file\", \"base64_string\": encoded_doc, \"filename\": file_path.name}],\n            }\n\n            response = client.post(f\"{base_url}/convert/source/async\", json=payload)\n            response.raise_for_status()\n            task = response.json()\n\n            http_failures = 0\n            retry_status_start = 500\n            retry_status_end = 600\n            start_wait_time = time.monotonic()\n            while task[\"task_status\"] not in (\"success\", \"failure\"):\n                # Check if processing exceeds the maximum poll timeout\n                processing_time = time.monotonic() - start_wait_time\n                if processing_time >= self.max_poll_timeout:\n                    msg = (\n                        f\"Processing time {processing_time=} exceeds the maximum poll timeout {self.max_poll_timeout=}.\"\n                        \"Please increase the max_poll_timeout parameter or review why the processing \"\n                        \"takes long on the server.\"\n                    )\n                    self.log(msg)\n                    raise RuntimeError(msg)\n\n                # Call for a new status update\n                time.sleep(2)\n                response = client.get(f\"{base_url}/status/poll/{task['task_id']}\")\n\n                # Check if the status call gets into 5xx errors and retry\n                if retry_status_start <= response.status_code < retry_status_end:\n                    http_failures += 1\n                    if http_failures > self.MAX_500_RETRIES:\n                        self.log(f\"The status requests got a http response {response.status_code} too many times.\")\n                        return None\n                    continue\n\n                # Update task status\n                task = response.json()\n\n            result_resp = client.get(f\"{base_url}/result/{task['task_id']}\")\n            result_resp.raise_for_status()\n            result = result_resp.json()\n\n            if \"json_content\" not in result[\"document\"] or result[\"document\"][\"json_content\"] is None:\n                self.log(\"No JSON DoclingDocument found in the result.\")\n                return None\n\n            try:\n                doc = DoclingDocument.model_validate(result[\"document\"][\"json_content\"])\n                return Data(data={\"doc\": doc, \"file_path\": str(file_path)})\n            except ValidationError as e:\n                self.log(f\"Error validating the document. {e}\")\n                return None\n\n        docling_options = {\n            \"to_formats\": [\"json\"],\n            \"image_export_mode\": \"placeholder\",\n            **(self.docling_serve_opts or {}),\n        }\n\n        processed_data: list[Data | None] = []\n        with (\n            httpx.Client(headers=self.api_headers) as client,\n            ThreadPoolExecutor(max_workers=self.max_concurrency) as executor,\n        ):\n            futures: list[tuple[int, Future]] = []\n            for i, file in enumerate(file_list):\n                if file.path is None:\n                    processed_data.append(None)\n                    continue\n\n                futures.append((i, executor.submit(_convert_document, client, file.path, docling_options)))\n\n            for _index, future in futures:\n                try:\n                    result_data = future.result()\n                    processed_data.append(result_data)\n                except (httpx.HTTPStatusError, httpx.RequestError, KeyError, ValueError) as exc:\n                    self.log(f\"Docling remote processing failed: {exc}\")\n                    raise\n\n        return self.rollup_data(file_list, processed_data)\n"
              },
              "delete_server_file_after_processing": {
                "_input_type": "BoolInput",
                "advanced": true,
                "display_name": "Delete Server File After Processing",
                "dynamic": false,
                "info": "If true, the Server File Path will be deleted after processing.",
                "list": false,
                "list_add_label": "Add More",
                "name": "delete_server_file_after_processing",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": true
              },
              "docling_serve_opts": {
                "_input_type": "NestedDictInput",
                "advanced": false,
                "display_name": "Docling options",
                "dynamic": false,
                "info": "Optional dictionary of additional options. See https://github.com/docling-project/docling-serve/blob/main/docs/usage.md for more information.",
                "list": false,
                "list_add_label": "Add More",
                "name": "docling_serve_opts",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "NestedDict",
                "value": {
                  "do_ocr": false
                }
              },
              "file_path": {
                "_input_type": "HandleInput",
                "advanced": true,
                "display_name": "Server File Path",
                "dynamic": false,
                "info": "Data object with a 'file_path' property pointing to server file or a Message object with a path to the file. Supercedes 'Path' but supports same file types.",
                "input_types": [
                  "Data",
                  "Message"
                ],
                "list": true,
                "list_add_label": "Add More",
                "name": "file_path",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "trace_as_metadata": true,
                "type": "other",
                "value": ""
              },
              "ignore_unspecified_files": {
                "_input_type": "BoolInput",
                "advanced": true,
                "display_name": "Ignore Unspecified Files",
                "dynamic": false,
                "info": "If true, Data with no 'file_path' property will be ignored.",
                "list": false,
                "list_add_label": "Add More",
                "name": "ignore_unspecified_files",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": false
              },
              "ignore_unsupported_extensions": {
                "_input_type": "BoolInput",
                "advanced": true,
                "display_name": "Ignore Unsupported Extensions",
                "dynamic": false,
                "info": "If true, files with unsupported extensions will not be processed.",
                "list": false,
                "list_add_label": "Add More",
                "name": "ignore_unsupported_extensions",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": true
              },
              "max_concurrency": {
                "_input_type": "IntInput",
                "advanced": false,
                "display_name": "Concurrency",
                "dynamic": false,
                "info": "Maximum number of concurrent requests for the server.",
                "list": false,
                "list_add_label": "Add More",
                "name": "max_concurrency",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "int",
                "value": 2
              },
              "max_poll_timeout": {
                "_input_type": "FloatInput",
                "advanced": true,
                "display_name": "Maximum poll time",
                "dynamic": false,
                "info": "Maximum waiting time for the document conversion to complete.",
                "list": false,
                "list_add_label": "Add More",
                "name": "max_poll_timeout",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "float",
                "value": 3600
              },
              "path": {
                "_input_type": "FileInput",
                "advanced": false,
                "display_name": "Files",
                "dynamic": false,
                "fileTypes": [
                  "adoc",
                  "asciidoc",
                  "asc",
                  "bmp",
                  "csv",
                  "dotx",
                  "dotm",
                  "docm",
                  "docx",
                  "htm",
                  "html",
                  "jpeg",
                  "json",
                  "md",
                  "pdf",
                  "png",
                  "potx",
                  "ppsx",
                  "pptm",
                  "potm",
                  "ppsm",
                  "pptx",
                  "tiff",
                  "txt",
                  "xls",
                  "xlsx",
                  "xhtml",
                  "xml",
                  "webp",
                  "zip",
                  "tar",
                  "tgz",
                  "bz2",
                  "gz"
                ],
                "file_path": [],
                "info": "Supported file extensions: adoc, asciidoc, asc, bmp, csv, dotx, dotm, docm, docx, htm, html, jpeg, json, md, pdf, png, potx, ppsx, pptm, potm, ppsm, pptx, tiff, txt, xls, xlsx, xhtml, xml, webp; optionally bundled in file extensions: zip, tar, tgz, bz2, gz",
                "list": true,
                "list_add_label": "Add More",
                "name": "path",
                "placeholder": "",
                "required": false,
                "show": true,
                "temp_file": false,
                "title_case": false,
                "trace_as_metadata": true,
                "type": "file",
                "value": ""
              },
              "separator": {
                "_input_type": "StrInput",
                "advanced": true,
                "display_name": "Separator",
                "dynamic": false,
                "info": "Specify the separator to use between multiple outputs in Message format.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "separator",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "\n\n"
              },
              "silent_errors": {
                "_input_type": "BoolInput",
                "advanced": true,
                "display_name": "Silent Errors",
                "dynamic": false,
                "info": "If true, errors will not raise an exception.",
                "list": false,
                "list_add_label": "Add More",
                "name": "silent_errors",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": false
              }
            },
            "tool_mode": false
          },
          "showNode": true,
          "type": "DoclingRemote"
        },
        "dragging": false,
        "id": "DoclingRemote-Dp3PX",
        "measured": {
          "height": 475,
          "width": 320
        },
        "position": {
          "x": -248.47065093890868,
          "y": 1040.3002495758292
        },
        "selected": false,
        "type": "genericNode"
      },
      {
        "data": {
          "id": "ExportDoclingDocument-zZdRg",
          "node": {
            "base_classes": [
              "Data",
              "DataFrame"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Export DoclingDocument to markdown, html or other formats.",
            "display_name": "Export DoclingDocument",
            "documentation": "https://docling-project.github.io/docling/",
            "edited": false,
            "field_order": [
              "data_inputs",
              "export_format",
              "image_mode",
              "md_image_placeholder",
              "md_page_break_placeholder",
              "doc_key"
            ],
            "frozen": false,
            "icon": "Docling",
            "last_updated": "2025-10-04T01:42:10.290Z",
            "legacy": false,
            "lf_version": "1.6.3.dev0",
            "metadata": {
              "code_hash": "4de16ddd37ac",
              "dependencies": {
                "dependencies": [
                  {
                    "name": "docling_core",
                    "version": "2.48.4"
                  },
                  {
                    "name": "lfx",
                    "version": "0.1.12.dev31"
                  }
                ],
                "total_dependencies": 2
              },
              "module": "lfx.components.docling.export_docling_document.ExportDoclingDocumentComponent"
            },
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "Exported data",
                "group_outputs": false,
                "method": "export_document",
                "name": "data",
                "options": null,
                "required_inputs": null,
                "selected": "Data",
                "tool_mode": true,
                "types": [
                  "Data"
                ],
                "value": "__UNDEFINED__"
              },
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "DataFrame",
                "group_outputs": false,
                "method": "as_dataframe",
                "name": "dataframe",
                "options": null,
                "required_inputs": null,
                "selected": "DataFrame",
                "tool_mode": true,
                "types": [
                  "DataFrame"
                ],
                "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 typing import Any\n\nfrom docling_core.types.doc import ImageRefMode\n\nfrom lfx.base.data.docling_utils import extract_docling_documents\nfrom lfx.custom import Component\nfrom lfx.io import DropdownInput, HandleInput, MessageTextInput, Output, StrInput\nfrom lfx.schema import Data, DataFrame\n\n\nclass ExportDoclingDocumentComponent(Component):\n    display_name: str = \"Export DoclingDocument\"\n    description: str = \"Export DoclingDocument to markdown, html or other formats.\"\n    documentation = \"https://docling-project.github.io/docling/\"\n    icon = \"Docling\"\n    name = \"ExportDoclingDocument\"\n\n    inputs = [\n        HandleInput(\n            name=\"data_inputs\",\n            display_name=\"Data or DataFrame\",\n            info=\"The data with documents to export.\",\n            input_types=[\"Data\", \"DataFrame\"],\n            required=True,\n        ),\n        DropdownInput(\n            name=\"export_format\",\n            display_name=\"Export format\",\n            options=[\"Markdown\", \"HTML\", \"Plaintext\", \"DocTags\"],\n            info=\"Select the export format to convert the input.\",\n            value=\"Markdown\",\n            real_time_refresh=True,\n        ),\n        DropdownInput(\n            name=\"image_mode\",\n            display_name=\"Image export mode\",\n            options=[\"placeholder\", \"embedded\"],\n            info=(\n                \"Specify how images are exported in the output. Placeholder will replace the images with a string, \"\n                \"whereas Embedded will include them as base64 encoded images.\"\n            ),\n            value=\"placeholder\",\n        ),\n        StrInput(\n            name=\"md_image_placeholder\",\n            display_name=\"Image placeholder\",\n            info=\"Specify the image placeholder for markdown exports.\",\n            value=\"<!-- image -->\",\n            advanced=True,\n        ),\n        StrInput(\n            name=\"md_page_break_placeholder\",\n            display_name=\"Page break placeholder\",\n            info=\"Add this placeholder betweek pages in the markdown output.\",\n            value=\"\",\n            advanced=True,\n        ),\n        MessageTextInput(\n            name=\"doc_key\",\n            display_name=\"Doc Key\",\n            info=\"The key to use for the DoclingDocument column.\",\n            value=\"doc\",\n            advanced=True,\n        ),\n    ]\n\n    outputs = [\n        Output(display_name=\"Exported data\", name=\"data\", method=\"export_document\"),\n        Output(display_name=\"DataFrame\", name=\"dataframe\", method=\"as_dataframe\"),\n    ]\n\n    def update_build_config(self, build_config: dict, field_value: Any, field_name: str | None = None) -> dict:\n        if field_name == \"export_format\" and field_value == \"Markdown\":\n            build_config[\"md_image_placeholder\"][\"show\"] = True\n            build_config[\"md_page_break_placeholder\"][\"show\"] = True\n            build_config[\"image_mode\"][\"show\"] = True\n        elif field_name == \"export_format\" and field_value == \"HTML\":\n            build_config[\"md_image_placeholder\"][\"show\"] = False\n            build_config[\"md_page_break_placeholder\"][\"show\"] = False\n            build_config[\"image_mode\"][\"show\"] = True\n        elif field_name == \"export_format\" and field_value in {\"Plaintext\", \"DocTags\"}:\n            build_config[\"md_image_placeholder\"][\"show\"] = False\n            build_config[\"md_page_break_placeholder\"][\"show\"] = False\n            build_config[\"image_mode\"][\"show\"] = False\n\n        return build_config\n\n    def export_document(self) -> list[Data]:\n        documents = extract_docling_documents(self.data_inputs, self.doc_key)\n\n        results: list[Data] = []\n        try:\n            image_mode = ImageRefMode(self.image_mode)\n            for doc in documents:\n                content = \"\"\n                if self.export_format == \"Markdown\":\n                    content = doc.export_to_markdown(\n                        image_mode=image_mode,\n                        image_placeholder=self.md_image_placeholder,\n                        page_break_placeholder=self.md_page_break_placeholder,\n                    )\n                elif self.export_format == \"HTML\":\n                    content = doc.export_to_html(image_mode=image_mode)\n                elif self.export_format == \"Plaintext\":\n                    content = doc.export_to_text()\n                elif self.export_format == \"DocTags\":\n                    content = doc.export_to_doctags()\n\n                results.append(Data(text=content))\n        except Exception as e:\n            msg = f\"Error splitting text: {e}\"\n            raise TypeError(msg) from e\n\n        return results\n\n    def as_dataframe(self) -> DataFrame:\n        return DataFrame(self.export_document())\n"
              },
              "data_inputs": {
                "_input_type": "HandleInput",
                "advanced": false,
                "display_name": "Data or DataFrame",
                "dynamic": false,
                "info": "The data with documents to export.",
                "input_types": [
                  "Data",
                  "DataFrame"
                ],
                "list": false,
                "list_add_label": "Add More",
                "name": "data_inputs",
                "placeholder": "",
                "required": true,
                "show": true,
                "title_case": false,
                "trace_as_metadata": true,
                "type": "other",
                "value": ""
              },
              "doc_key": {
                "_input_type": "MessageTextInput",
                "advanced": true,
                "display_name": "Doc Key",
                "dynamic": false,
                "info": "The key to use for the DoclingDocument column.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "doc_key",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": "doc"
              },
              "export_format": {
                "_input_type": "DropdownInput",
                "advanced": false,
                "combobox": false,
                "dialog_inputs": {},
                "display_name": "Export format",
                "dynamic": false,
                "external_options": {},
                "info": "Select the export format to convert the input.",
                "name": "export_format",
                "options": [
                  "Markdown",
                  "HTML",
                  "Plaintext",
                  "DocTags"
                ],
                "options_metadata": [],
                "placeholder": "",
                "real_time_refresh": true,
                "required": false,
                "show": true,
                "title_case": false,
                "toggle": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "Markdown"
              },
              "image_mode": {
                "_input_type": "DropdownInput",
                "advanced": false,
                "combobox": false,
                "dialog_inputs": {},
                "display_name": "Image export mode",
                "dynamic": false,
                "external_options": {},
                "info": "Specify how images are exported in the output. Placeholder will replace the images with a string, whereas Embedded will include them as base64 encoded images.",
                "name": "image_mode",
                "options": [
                  "placeholder",
                  "embedded"
                ],
                "options_metadata": [],
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "toggle": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "placeholder"
              },
              "md_image_placeholder": {
                "_input_type": "StrInput",
                "advanced": true,
                "display_name": "Image placeholder",
                "dynamic": false,
                "info": "Specify the image placeholder for markdown exports.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "md_image_placeholder",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "<!-- image -->"
              },
              "md_page_break_placeholder": {
                "_input_type": "StrInput",
                "advanced": true,
                "display_name": "Page break placeholder",
                "dynamic": false,
                "info": "Add this placeholder betweek pages in the markdown output.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "md_page_break_placeholder",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              }
            },
            "tool_mode": false
          },
          "selected_output": "dataframe",
          "showNode": true,
          "type": "ExportDoclingDocument"
        },
        "dragging": false,
        "id": "ExportDoclingDocument-zZdRg",
        "measured": {
          "height": 347,
          "width": 320
        },
        "position": {
          "x": 134.00431977210877,
          "y": 1065.2709317561028
        },
        "selected": false,
        "type": "genericNode"
      },
      {
        "data": {
          "id": "DataFrameOperations-1BWXB",
          "node": {
            "base_classes": [
              "DataFrame"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Perform various operations on a DataFrame.",
            "display_name": "DataFrame Operations",
            "documentation": "https://docs.langflow.org/components-processing#dataframe-operations",
            "edited": false,
            "field_order": [
              "df",
              "operation",
              "column_name",
              "filter_value",
              "filter_operator",
              "ascending",
              "new_column_name",
              "new_column_value",
              "columns_to_select",
              "num_rows",
              "replace_value",
              "replacement_value"
            ],
            "frozen": false,
            "icon": "table",
            "last_updated": "2025-11-11T15:06:45.203Z",
            "legacy": false,
            "lf_version": "1.6.3.dev0",
            "metadata": {
              "code_hash": "b4d6b19b6eef",
              "dependencies": {
                "dependencies": [
                  {
                    "name": "pandas",
                    "version": "2.2.3"
                  },
                  {
                    "name": "lfx",
                    "version": "0.1.12.dev31"
                  }
                ],
                "total_dependencies": 2
              },
              "module": "lfx.components.processing.dataframe_operations.DataFrameOperationsComponent"
            },
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "DataFrame",
                "group_outputs": false,
                "method": "perform_operation",
                "name": "output",
                "options": null,
                "required_inputs": null,
                "selected": "DataFrame",
                "tool_mode": true,
                "types": [
                  "DataFrame"
                ],
                "value": "__UNDEFINED__"
              }
            ],
            "pinned": false,
            "template": {
              "_type": "Component",
              "ascending": {
                "_input_type": "BoolInput",
                "advanced": false,
                "display_name": "Sort Ascending",
                "dynamic": true,
                "info": "Whether to sort in ascending order.",
                "list": false,
                "list_add_label": "Add More",
                "name": "ascending",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": true
              },
              "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": "import pandas as pd\n\nfrom lfx.custom.custom_component.component import Component\nfrom lfx.inputs import SortableListInput\nfrom lfx.io import BoolInput, DataFrameInput, DropdownInput, IntInput, MessageTextInput, Output, StrInput\nfrom lfx.log.logger import logger\nfrom lfx.schema.dataframe import DataFrame\n\n\nclass DataFrameOperationsComponent(Component):\n    display_name = \"DataFrame Operations\"\n    description = \"Perform various operations on a DataFrame.\"\n    documentation: str = \"https://docs.langflow.org/components-processing#dataframe-operations\"\n    icon = \"table\"\n    name = \"DataFrameOperations\"\n\n    OPERATION_CHOICES = [\n        \"Add Column\",\n        \"Drop Column\",\n        \"Filter\",\n        \"Head\",\n        \"Rename Column\",\n        \"Replace Value\",\n        \"Select Columns\",\n        \"Sort\",\n        \"Tail\",\n        \"Drop Duplicates\",\n    ]\n\n    inputs = [\n        DataFrameInput(\n            name=\"df\",\n            display_name=\"DataFrame\",\n            info=\"The input DataFrame to operate on.\",\n            required=True,\n        ),\n        SortableListInput(\n            name=\"operation\",\n            display_name=\"Operation\",\n            placeholder=\"Select Operation\",\n            info=\"Select the DataFrame operation to perform.\",\n            options=[\n                {\"name\": \"Add Column\", \"icon\": \"plus\"},\n                {\"name\": \"Drop Column\", \"icon\": \"minus\"},\n                {\"name\": \"Filter\", \"icon\": \"filter\"},\n                {\"name\": \"Head\", \"icon\": \"arrow-up\"},\n                {\"name\": \"Rename Column\", \"icon\": \"pencil\"},\n                {\"name\": \"Replace Value\", \"icon\": \"replace\"},\n                {\"name\": \"Select Columns\", \"icon\": \"columns\"},\n                {\"name\": \"Sort\", \"icon\": \"arrow-up-down\"},\n                {\"name\": \"Tail\", \"icon\": \"arrow-down\"},\n                {\"name\": \"Drop Duplicates\", \"icon\": \"copy-x\"},\n            ],\n            real_time_refresh=True,\n            limit=1,\n        ),\n        StrInput(\n            name=\"column_name\",\n            display_name=\"Column Name\",\n            info=\"The column name to use for the operation.\",\n            dynamic=True,\n            show=False,\n        ),\n        MessageTextInput(\n            name=\"filter_value\",\n            display_name=\"Filter Value\",\n            info=\"The value to filter rows by.\",\n            dynamic=True,\n            show=False,\n        ),\n        DropdownInput(\n            name=\"filter_operator\",\n            display_name=\"Filter Operator\",\n            options=[\n                \"equals\",\n                \"not equals\",\n                \"contains\",\n                \"not contains\",\n                \"starts with\",\n                \"ends with\",\n                \"greater than\",\n                \"less than\",\n            ],\n            value=\"equals\",\n            info=\"The operator to apply for filtering rows.\",\n            advanced=False,\n            dynamic=True,\n            show=False,\n        ),\n        BoolInput(\n            name=\"ascending\",\n            display_name=\"Sort Ascending\",\n            info=\"Whether to sort in ascending order.\",\n            dynamic=True,\n            show=False,\n            value=True,\n        ),\n        StrInput(\n            name=\"new_column_name\",\n            display_name=\"New Column Name\",\n            info=\"The new column name when renaming or adding a column.\",\n            dynamic=True,\n            show=False,\n        ),\n        MessageTextInput(\n            name=\"new_column_value\",\n            display_name=\"New Column Value\",\n            info=\"The value to populate the new column with.\",\n            dynamic=True,\n            show=False,\n        ),\n        StrInput(\n            name=\"columns_to_select\",\n            display_name=\"Columns to Select\",\n            dynamic=True,\n            is_list=True,\n            show=False,\n        ),\n        IntInput(\n            name=\"num_rows\",\n            display_name=\"Number of Rows\",\n            info=\"Number of rows to return (for head/tail).\",\n            dynamic=True,\n            show=False,\n            value=5,\n        ),\n        MessageTextInput(\n            name=\"replace_value\",\n            display_name=\"Value to Replace\",\n            info=\"The value to replace in the column.\",\n            dynamic=True,\n            show=False,\n        ),\n        MessageTextInput(\n            name=\"replacement_value\",\n            display_name=\"Replacement Value\",\n            info=\"The value to replace with.\",\n            dynamic=True,\n            show=False,\n        ),\n    ]\n\n    outputs = [\n        Output(\n            display_name=\"DataFrame\",\n            name=\"output\",\n            method=\"perform_operation\",\n            info=\"The resulting DataFrame after the operation.\",\n        )\n    ]\n\n    def update_build_config(self, build_config, field_value, field_name=None):\n        dynamic_fields = [\n            \"column_name\",\n            \"filter_value\",\n            \"filter_operator\",\n            \"ascending\",\n            \"new_column_name\",\n            \"new_column_value\",\n            \"columns_to_select\",\n            \"num_rows\",\n            \"replace_value\",\n            \"replacement_value\",\n        ]\n        for field in dynamic_fields:\n            build_config[field][\"show\"] = False\n\n        if field_name == \"operation\":\n            # Handle SortableListInput format\n            if isinstance(field_value, list):\n                operation_name = field_value[0].get(\"name\", \"\") if field_value else \"\"\n            else:\n                operation_name = field_value or \"\"\n\n            # If no operation selected, all dynamic fields stay hidden (already set to False above)\n            if not operation_name:\n                return build_config\n\n            if operation_name == \"Filter\":\n                build_config[\"column_name\"][\"show\"] = True\n                build_config[\"filter_value\"][\"show\"] = True\n                build_config[\"filter_operator\"][\"show\"] = True\n            elif operation_name == \"Sort\":\n                build_config[\"column_name\"][\"show\"] = True\n                build_config[\"ascending\"][\"show\"] = True\n            elif operation_name == \"Drop Column\":\n                build_config[\"column_name\"][\"show\"] = True\n            elif operation_name == \"Rename Column\":\n                build_config[\"column_name\"][\"show\"] = True\n                build_config[\"new_column_name\"][\"show\"] = True\n            elif operation_name == \"Add Column\":\n                build_config[\"new_column_name\"][\"show\"] = True\n                build_config[\"new_column_value\"][\"show\"] = True\n            elif operation_name == \"Select Columns\":\n                build_config[\"columns_to_select\"][\"show\"] = True\n            elif operation_name in {\"Head\", \"Tail\"}:\n                build_config[\"num_rows\"][\"show\"] = True\n            elif operation_name == \"Replace Value\":\n                build_config[\"column_name\"][\"show\"] = True\n                build_config[\"replace_value\"][\"show\"] = True\n                build_config[\"replacement_value\"][\"show\"] = True\n            elif operation_name == \"Drop Duplicates\":\n                build_config[\"column_name\"][\"show\"] = True\n\n        return build_config\n\n    def perform_operation(self) -> DataFrame:\n        df_copy = self.df.copy()\n\n        # Handle SortableListInput format for operation\n        operation_input = getattr(self, \"operation\", [])\n        if isinstance(operation_input, list) and len(operation_input) > 0:\n            op = operation_input[0].get(\"name\", \"\")\n        else:\n            op = \"\"\n\n        # If no operation selected, return original DataFrame\n        if not op:\n            return df_copy\n\n        if op == \"Filter\":\n            return self.filter_rows_by_value(df_copy)\n        if op == \"Sort\":\n            return self.sort_by_column(df_copy)\n        if op == \"Drop Column\":\n            return self.drop_column(df_copy)\n        if op == \"Rename Column\":\n            return self.rename_column(df_copy)\n        if op == \"Add Column\":\n            return self.add_column(df_copy)\n        if op == \"Select Columns\":\n            return self.select_columns(df_copy)\n        if op == \"Head\":\n            return self.head(df_copy)\n        if op == \"Tail\":\n            return self.tail(df_copy)\n        if op == \"Replace Value\":\n            return self.replace_values(df_copy)\n        if op == \"Drop Duplicates\":\n            return self.drop_duplicates(df_copy)\n        msg = f\"Unsupported operation: {op}\"\n        logger.error(msg)\n        raise ValueError(msg)\n\n    def filter_rows_by_value(self, df: DataFrame) -> DataFrame:\n        column = df[self.column_name]\n        filter_value = self.filter_value\n\n        # Handle regular DropdownInput format (just a string value)\n        operator = getattr(self, \"filter_operator\", \"equals\")  # Default to equals for backward compatibility\n\n        if operator == \"equals\":\n            mask = column == filter_value\n        elif operator == \"not equals\":\n            mask = column != filter_value\n        elif operator == \"contains\":\n            mask = column.astype(str).str.contains(str(filter_value), na=False)\n        elif operator == \"not contains\":\n            mask = ~column.astype(str).str.contains(str(filter_value), na=False)\n        elif operator == \"starts with\":\n            mask = column.astype(str).str.startswith(str(filter_value), na=False)\n        elif operator == \"ends with\":\n            mask = column.astype(str).str.endswith(str(filter_value), na=False)\n        elif operator == \"greater than\":\n            try:\n                # Try to convert filter_value to numeric for comparison\n                numeric_value = pd.to_numeric(filter_value)\n                mask = column > numeric_value\n            except (ValueError, TypeError):\n                # If conversion fails, compare as strings\n                mask = column.astype(str) > str(filter_value)\n        elif operator == \"less than\":\n            try:\n                # Try to convert filter_value to numeric for comparison\n                numeric_value = pd.to_numeric(filter_value)\n                mask = column < numeric_value\n            except (ValueError, TypeError):\n                # If conversion fails, compare as strings\n                mask = column.astype(str) < str(filter_value)\n        else:\n            mask = column == filter_value  # Fallback to equals\n\n        return DataFrame(df[mask])\n\n    def sort_by_column(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.sort_values(by=self.column_name, ascending=self.ascending))\n\n    def drop_column(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.drop(columns=[self.column_name]))\n\n    def rename_column(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.rename(columns={self.column_name: self.new_column_name}))\n\n    def add_column(self, df: DataFrame) -> DataFrame:\n        df[self.new_column_name] = [self.new_column_value] * len(df)\n        return DataFrame(df)\n\n    def select_columns(self, df: DataFrame) -> DataFrame:\n        columns = [col.strip() for col in self.columns_to_select]\n        return DataFrame(df[columns])\n\n    def head(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.head(self.num_rows))\n\n    def tail(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.tail(self.num_rows))\n\n    def replace_values(self, df: DataFrame) -> DataFrame:\n        df[self.column_name] = df[self.column_name].replace(self.replace_value, self.replacement_value)\n        return DataFrame(df)\n\n    def drop_duplicates(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.drop_duplicates(subset=self.column_name))\n"
              },
              "column_name": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "Column Name",
                "dynamic": true,
                "info": "The column name to use for the operation.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "column_name",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "columns_to_select": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "Columns to Select",
                "dynamic": true,
                "info": "",
                "list": true,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "columns_to_select",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "df": {
                "_input_type": "DataFrameInput",
                "advanced": false,
                "display_name": "DataFrame",
                "dynamic": false,
                "info": "The input DataFrame to operate on.",
                "input_types": [
                  "DataFrame"
                ],
                "list": false,
                "list_add_label": "Add More",
                "name": "df",
                "placeholder": "",
                "required": true,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "other",
                "value": ""
              },
              "filter_operator": {
                "_input_type": "DropdownInput",
                "advanced": false,
                "combobox": false,
                "dialog_inputs": {},
                "display_name": "Filter Operator",
                "dynamic": true,
                "external_options": {},
                "info": "The operator to apply for filtering rows.",
                "name": "filter_operator",
                "options": [
                  "equals",
                  "not equals",
                  "contains",
                  "not contains",
                  "starts with",
                  "ends with",
                  "greater than",
                  "less than"
                ],
                "options_metadata": [],
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "toggle": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "equals"
              },
              "filter_value": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "Filter Value",
                "dynamic": true,
                "info": "The value to filter rows by.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "filter_value",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "new_column_name": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "New Column Name",
                "dynamic": true,
                "info": "The new column name when renaming or adding a column.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "new_column_name",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "filename"
              },
              "new_column_value": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "New Column Value",
                "dynamic": true,
                "info": "The value to populate the new column with.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": true,
                "name": "new_column_value",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": "FILENAME"
              },
              "num_rows": {
                "_input_type": "IntInput",
                "advanced": false,
                "display_name": "Number of Rows",
                "dynamic": true,
                "info": "Number of rows to return (for head/tail).",
                "list": false,
                "list_add_label": "Add More",
                "name": "num_rows",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "int",
                "value": 5
              },
              "operation": {
                "_input_type": "SortableListInput",
                "advanced": false,
                "display_name": "Operation",
                "dynamic": false,
                "info": "Select the DataFrame operation to perform.",
                "limit": 1,
                "name": "operation",
                "options": [
                  {
                    "icon": "plus",
                    "name": "Add Column"
                  },
                  {
                    "icon": "minus",
                    "name": "Drop Column"
                  },
                  {
                    "icon": "filter",
                    "name": "Filter"
                  },
                  {
                    "icon": "arrow-up",
                    "name": "Head"
                  },
                  {
                    "icon": "pencil",
                    "name": "Rename Column"
                  },
                  {
                    "icon": "replace",
                    "name": "Replace Value"
                  },
                  {
                    "icon": "columns",
                    "name": "Select Columns"
                  },
                  {
                    "icon": "arrow-up-down",
                    "name": "Sort"
                  },
                  {
                    "icon": "arrow-down",
                    "name": "Tail"
                  },
                  {
                    "icon": "copy-x",
                    "name": "Drop Duplicates"
                  }
                ],
                "placeholder": "Select Operation",
                "real_time_refresh": true,
                "required": false,
                "search_category": [],
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "sortableList",
                "value": [
                  {
                    "chosen": false,
                    "icon": "plus",
                    "name": "Add Column",
                    "selected": false
                  }
                ]
              },
              "replace_value": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "Value to Replace",
                "dynamic": true,
                "info": "The value to replace in the column.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "replace_value",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "replacement_value": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "Replacement Value",
                "dynamic": true,
                "info": "The value to replace with.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "replacement_value",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              }
            },
            "tool_mode": false
          },
          "showNode": true,
          "type": "DataFrameOperations"
        },
        "dragging": false,
        "id": "DataFrameOperations-1BWXB",
        "measured": {
          "height": 399,
          "width": 320
        },
        "position": {
          "x": 513.7675419899799,
          "y": 1088.8324804581666
        },
        "selected": false,
        "type": "genericNode"
      },
      {
        "data": {
          "id": "DataFrameOperations-N80fC",
          "node": {
            "base_classes": [
              "DataFrame"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Perform various operations on a DataFrame.",
            "display_name": "DataFrame Operations",
            "documentation": "https://docs.langflow.org/components-processing#dataframe-operations",
            "edited": false,
            "field_order": [
              "df",
              "operation",
              "column_name",
              "filter_value",
              "filter_operator",
              "ascending",
              "new_column_name",
              "new_column_value",
              "columns_to_select",
              "num_rows",
              "replace_value",
              "replacement_value"
            ],
            "frozen": false,
            "icon": "table",
            "last_updated": "2025-11-11T15:06:45.204Z",
            "legacy": false,
            "lf_version": "1.6.3.dev0",
            "metadata": {
              "code_hash": "b4d6b19b6eef",
              "dependencies": {
                "dependencies": [
                  {
                    "name": "pandas",
                    "version": "2.2.3"
                  },
                  {
                    "name": "lfx",
                    "version": "0.1.12.dev31"
                  }
                ],
                "total_dependencies": 2
              },
              "module": "lfx.components.processing.dataframe_operations.DataFrameOperationsComponent"
            },
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "DataFrame",
                "group_outputs": false,
                "method": "perform_operation",
                "name": "output",
                "options": null,
                "required_inputs": null,
                "selected": "DataFrame",
                "tool_mode": true,
                "types": [
                  "DataFrame"
                ],
                "value": "__UNDEFINED__"
              }
            ],
            "pinned": false,
            "template": {
              "_type": "Component",
              "ascending": {
                "_input_type": "BoolInput",
                "advanced": false,
                "display_name": "Sort Ascending",
                "dynamic": true,
                "info": "Whether to sort in ascending order.",
                "list": false,
                "list_add_label": "Add More",
                "name": "ascending",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": true
              },
              "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": "import pandas as pd\n\nfrom lfx.custom.custom_component.component import Component\nfrom lfx.inputs import SortableListInput\nfrom lfx.io import BoolInput, DataFrameInput, DropdownInput, IntInput, MessageTextInput, Output, StrInput\nfrom lfx.log.logger import logger\nfrom lfx.schema.dataframe import DataFrame\n\n\nclass DataFrameOperationsComponent(Component):\n    display_name = \"DataFrame Operations\"\n    description = \"Perform various operations on a DataFrame.\"\n    documentation: str = \"https://docs.langflow.org/components-processing#dataframe-operations\"\n    icon = \"table\"\n    name = \"DataFrameOperations\"\n\n    OPERATION_CHOICES = [\n        \"Add Column\",\n        \"Drop Column\",\n        \"Filter\",\n        \"Head\",\n        \"Rename Column\",\n        \"Replace Value\",\n        \"Select Columns\",\n        \"Sort\",\n        \"Tail\",\n        \"Drop Duplicates\",\n    ]\n\n    inputs = [\n        DataFrameInput(\n            name=\"df\",\n            display_name=\"DataFrame\",\n            info=\"The input DataFrame to operate on.\",\n            required=True,\n        ),\n        SortableListInput(\n            name=\"operation\",\n            display_name=\"Operation\",\n            placeholder=\"Select Operation\",\n            info=\"Select the DataFrame operation to perform.\",\n            options=[\n                {\"name\": \"Add Column\", \"icon\": \"plus\"},\n                {\"name\": \"Drop Column\", \"icon\": \"minus\"},\n                {\"name\": \"Filter\", \"icon\": \"filter\"},\n                {\"name\": \"Head\", \"icon\": \"arrow-up\"},\n                {\"name\": \"Rename Column\", \"icon\": \"pencil\"},\n                {\"name\": \"Replace Value\", \"icon\": \"replace\"},\n                {\"name\": \"Select Columns\", \"icon\": \"columns\"},\n                {\"name\": \"Sort\", \"icon\": \"arrow-up-down\"},\n                {\"name\": \"Tail\", \"icon\": \"arrow-down\"},\n                {\"name\": \"Drop Duplicates\", \"icon\": \"copy-x\"},\n            ],\n            real_time_refresh=True,\n            limit=1,\n        ),\n        StrInput(\n            name=\"column_name\",\n            display_name=\"Column Name\",\n            info=\"The column name to use for the operation.\",\n            dynamic=True,\n            show=False,\n        ),\n        MessageTextInput(\n            name=\"filter_value\",\n            display_name=\"Filter Value\",\n            info=\"The value to filter rows by.\",\n            dynamic=True,\n            show=False,\n        ),\n        DropdownInput(\n            name=\"filter_operator\",\n            display_name=\"Filter Operator\",\n            options=[\n                \"equals\",\n                \"not equals\",\n                \"contains\",\n                \"not contains\",\n                \"starts with\",\n                \"ends with\",\n                \"greater than\",\n                \"less than\",\n            ],\n            value=\"equals\",\n            info=\"The operator to apply for filtering rows.\",\n            advanced=False,\n            dynamic=True,\n            show=False,\n        ),\n        BoolInput(\n            name=\"ascending\",\n            display_name=\"Sort Ascending\",\n            info=\"Whether to sort in ascending order.\",\n            dynamic=True,\n            show=False,\n            value=True,\n        ),\n        StrInput(\n            name=\"new_column_name\",\n            display_name=\"New Column Name\",\n            info=\"The new column name when renaming or adding a column.\",\n            dynamic=True,\n            show=False,\n        ),\n        MessageTextInput(\n            name=\"new_column_value\",\n            display_name=\"New Column Value\",\n            info=\"The value to populate the new column with.\",\n            dynamic=True,\n            show=False,\n        ),\n        StrInput(\n            name=\"columns_to_select\",\n            display_name=\"Columns to Select\",\n            dynamic=True,\n            is_list=True,\n            show=False,\n        ),\n        IntInput(\n            name=\"num_rows\",\n            display_name=\"Number of Rows\",\n            info=\"Number of rows to return (for head/tail).\",\n            dynamic=True,\n            show=False,\n            value=5,\n        ),\n        MessageTextInput(\n            name=\"replace_value\",\n            display_name=\"Value to Replace\",\n            info=\"The value to replace in the column.\",\n            dynamic=True,\n            show=False,\n        ),\n        MessageTextInput(\n            name=\"replacement_value\",\n            display_name=\"Replacement Value\",\n            info=\"The value to replace with.\",\n            dynamic=True,\n            show=False,\n        ),\n    ]\n\n    outputs = [\n        Output(\n            display_name=\"DataFrame\",\n            name=\"output\",\n            method=\"perform_operation\",\n            info=\"The resulting DataFrame after the operation.\",\n        )\n    ]\n\n    def update_build_config(self, build_config, field_value, field_name=None):\n        dynamic_fields = [\n            \"column_name\",\n            \"filter_value\",\n            \"filter_operator\",\n            \"ascending\",\n            \"new_column_name\",\n            \"new_column_value\",\n            \"columns_to_select\",\n            \"num_rows\",\n            \"replace_value\",\n            \"replacement_value\",\n        ]\n        for field in dynamic_fields:\n            build_config[field][\"show\"] = False\n\n        if field_name == \"operation\":\n            # Handle SortableListInput format\n            if isinstance(field_value, list):\n                operation_name = field_value[0].get(\"name\", \"\") if field_value else \"\"\n            else:\n                operation_name = field_value or \"\"\n\n            # If no operation selected, all dynamic fields stay hidden (already set to False above)\n            if not operation_name:\n                return build_config\n\n            if operation_name == \"Filter\":\n                build_config[\"column_name\"][\"show\"] = True\n                build_config[\"filter_value\"][\"show\"] = True\n                build_config[\"filter_operator\"][\"show\"] = True\n            elif operation_name == \"Sort\":\n                build_config[\"column_name\"][\"show\"] = True\n                build_config[\"ascending\"][\"show\"] = True\n            elif operation_name == \"Drop Column\":\n                build_config[\"column_name\"][\"show\"] = True\n            elif operation_name == \"Rename Column\":\n                build_config[\"column_name\"][\"show\"] = True\n                build_config[\"new_column_name\"][\"show\"] = True\n            elif operation_name == \"Add Column\":\n                build_config[\"new_column_name\"][\"show\"] = True\n                build_config[\"new_column_value\"][\"show\"] = True\n            elif operation_name == \"Select Columns\":\n                build_config[\"columns_to_select\"][\"show\"] = True\n            elif operation_name in {\"Head\", \"Tail\"}:\n                build_config[\"num_rows\"][\"show\"] = True\n            elif operation_name == \"Replace Value\":\n                build_config[\"column_name\"][\"show\"] = True\n                build_config[\"replace_value\"][\"show\"] = True\n                build_config[\"replacement_value\"][\"show\"] = True\n            elif operation_name == \"Drop Duplicates\":\n                build_config[\"column_name\"][\"show\"] = True\n\n        return build_config\n\n    def perform_operation(self) -> DataFrame:\n        df_copy = self.df.copy()\n\n        # Handle SortableListInput format for operation\n        operation_input = getattr(self, \"operation\", [])\n        if isinstance(operation_input, list) and len(operation_input) > 0:\n            op = operation_input[0].get(\"name\", \"\")\n        else:\n            op = \"\"\n\n        # If no operation selected, return original DataFrame\n        if not op:\n            return df_copy\n\n        if op == \"Filter\":\n            return self.filter_rows_by_value(df_copy)\n        if op == \"Sort\":\n            return self.sort_by_column(df_copy)\n        if op == \"Drop Column\":\n            return self.drop_column(df_copy)\n        if op == \"Rename Column\":\n            return self.rename_column(df_copy)\n        if op == \"Add Column\":\n            return self.add_column(df_copy)\n        if op == \"Select Columns\":\n            return self.select_columns(df_copy)\n        if op == \"Head\":\n            return self.head(df_copy)\n        if op == \"Tail\":\n            return self.tail(df_copy)\n        if op == \"Replace Value\":\n            return self.replace_values(df_copy)\n        if op == \"Drop Duplicates\":\n            return self.drop_duplicates(df_copy)\n        msg = f\"Unsupported operation: {op}\"\n        logger.error(msg)\n        raise ValueError(msg)\n\n    def filter_rows_by_value(self, df: DataFrame) -> DataFrame:\n        column = df[self.column_name]\n        filter_value = self.filter_value\n\n        # Handle regular DropdownInput format (just a string value)\n        operator = getattr(self, \"filter_operator\", \"equals\")  # Default to equals for backward compatibility\n\n        if operator == \"equals\":\n            mask = column == filter_value\n        elif operator == \"not equals\":\n            mask = column != filter_value\n        elif operator == \"contains\":\n            mask = column.astype(str).str.contains(str(filter_value), na=False)\n        elif operator == \"not contains\":\n            mask = ~column.astype(str).str.contains(str(filter_value), na=False)\n        elif operator == \"starts with\":\n            mask = column.astype(str).str.startswith(str(filter_value), na=False)\n        elif operator == \"ends with\":\n            mask = column.astype(str).str.endswith(str(filter_value), na=False)\n        elif operator == \"greater than\":\n            try:\n                # Try to convert filter_value to numeric for comparison\n                numeric_value = pd.to_numeric(filter_value)\n                mask = column > numeric_value\n            except (ValueError, TypeError):\n                # If conversion fails, compare as strings\n                mask = column.astype(str) > str(filter_value)\n        elif operator == \"less than\":\n            try:\n                # Try to convert filter_value to numeric for comparison\n                numeric_value = pd.to_numeric(filter_value)\n                mask = column < numeric_value\n            except (ValueError, TypeError):\n                # If conversion fails, compare as strings\n                mask = column.astype(str) < str(filter_value)\n        else:\n            mask = column == filter_value  # Fallback to equals\n\n        return DataFrame(df[mask])\n\n    def sort_by_column(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.sort_values(by=self.column_name, ascending=self.ascending))\n\n    def drop_column(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.drop(columns=[self.column_name]))\n\n    def rename_column(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.rename(columns={self.column_name: self.new_column_name}))\n\n    def add_column(self, df: DataFrame) -> DataFrame:\n        df[self.new_column_name] = [self.new_column_value] * len(df)\n        return DataFrame(df)\n\n    def select_columns(self, df: DataFrame) -> DataFrame:\n        columns = [col.strip() for col in self.columns_to_select]\n        return DataFrame(df[columns])\n\n    def head(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.head(self.num_rows))\n\n    def tail(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.tail(self.num_rows))\n\n    def replace_values(self, df: DataFrame) -> DataFrame:\n        df[self.column_name] = df[self.column_name].replace(self.replace_value, self.replacement_value)\n        return DataFrame(df)\n\n    def drop_duplicates(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.drop_duplicates(subset=self.column_name))\n"
              },
              "column_name": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "Column Name",
                "dynamic": true,
                "info": "The column name to use for the operation.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "column_name",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "columns_to_select": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "Columns to Select",
                "dynamic": true,
                "info": "",
                "list": true,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "columns_to_select",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "df": {
                "_input_type": "DataFrameInput",
                "advanced": false,
                "display_name": "DataFrame",
                "dynamic": false,
                "info": "The input DataFrame to operate on.",
                "input_types": [
                  "DataFrame"
                ],
                "list": false,
                "list_add_label": "Add More",
                "name": "df",
                "placeholder": "",
                "required": true,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "other",
                "value": ""
              },
              "filter_operator": {
                "_input_type": "DropdownInput",
                "advanced": false,
                "combobox": false,
                "dialog_inputs": {},
                "display_name": "Filter Operator",
                "dynamic": true,
                "external_options": {},
                "info": "The operator to apply for filtering rows.",
                "name": "filter_operator",
                "options": [
                  "equals",
                  "not equals",
                  "contains",
                  "not contains",
                  "starts with",
                  "ends with",
                  "greater than",
                  "less than"
                ],
                "options_metadata": [],
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "toggle": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "equals"
              },
              "filter_value": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "Filter Value",
                "dynamic": true,
                "info": "The value to filter rows by.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "filter_value",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "new_column_name": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "New Column Name",
                "dynamic": true,
                "info": "The new column name when renaming or adding a column.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "new_column_name",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "mimetype"
              },
              "new_column_value": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "New Column Value",
                "dynamic": true,
                "info": "The value to populate the new column with.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": true,
                "name": "new_column_value",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": "MIMETYPE"
              },
              "num_rows": {
                "_input_type": "IntInput",
                "advanced": false,
                "display_name": "Number of Rows",
                "dynamic": true,
                "info": "Number of rows to return (for head/tail).",
                "list": false,
                "list_add_label": "Add More",
                "name": "num_rows",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "int",
                "value": 5
              },
              "operation": {
                "_input_type": "SortableListInput",
                "advanced": false,
                "display_name": "Operation",
                "dynamic": false,
                "info": "Select the DataFrame operation to perform.",
                "limit": 1,
                "name": "operation",
                "options": [
                  {
                    "icon": "plus",
                    "name": "Add Column"
                  },
                  {
                    "icon": "minus",
                    "name": "Drop Column"
                  },
                  {
                    "icon": "filter",
                    "name": "Filter"
                  },
                  {
                    "icon": "arrow-up",
                    "name": "Head"
                  },
                  {
                    "icon": "pencil",
                    "name": "Rename Column"
                  },
                  {
                    "icon": "replace",
                    "name": "Replace Value"
                  },
                  {
                    "icon": "columns",
                    "name": "Select Columns"
                  },
                  {
                    "icon": "arrow-up-down",
                    "name": "Sort"
                  },
                  {
                    "icon": "arrow-down",
                    "name": "Tail"
                  },
                  {
                    "icon": "copy-x",
                    "name": "Drop Duplicates"
                  }
                ],
                "placeholder": "Select Operation",
                "real_time_refresh": true,
                "required": false,
                "search_category": [],
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "sortableList",
                "value": [
                  {
                    "chosen": false,
                    "icon": "plus",
                    "name": "Add Column",
                    "selected": false
                  }
                ]
              },
              "replace_value": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "Value to Replace",
                "dynamic": true,
                "info": "The value to replace in the column.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "replace_value",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "replacement_value": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "Replacement Value",
                "dynamic": true,
                "info": "The value to replace with.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "replacement_value",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              }
            },
            "tool_mode": false
          },
          "showNode": true,
          "type": "DataFrameOperations"
        },
        "dragging": false,
        "id": "DataFrameOperations-N80fC",
        "measured": {
          "height": 399,
          "width": 320
        },
        "position": {
          "x": 1314.7870797625949,
          "y": 1135.9990962860586
        },
        "selected": false,
        "type": "genericNode"
      },
      {
        "data": {
          "id": "DataFrameOperations-9vMrp",
          "node": {
            "base_classes": [
              "DataFrame"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Perform various operations on a DataFrame.",
            "display_name": "DataFrame Operations",
            "documentation": "https://docs.langflow.org/components-processing#dataframe-operations",
            "edited": false,
            "field_order": [
              "df",
              "operation",
              "column_name",
              "filter_value",
              "filter_operator",
              "ascending",
              "new_column_name",
              "new_column_value",
              "columns_to_select",
              "num_rows",
              "replace_value",
              "replacement_value"
            ],
            "frozen": false,
            "icon": "table",
            "last_updated": "2025-11-11T15:06:45.205Z",
            "legacy": false,
            "lf_version": "1.6.3.dev0",
            "metadata": {
              "code_hash": "b4d6b19b6eef",
              "dependencies": {
                "dependencies": [
                  {
                    "name": "pandas",
                    "version": "2.2.3"
                  },
                  {
                    "name": "lfx",
                    "version": "0.1.12.dev31"
                  }
                ],
                "total_dependencies": 2
              },
              "module": "lfx.components.processing.dataframe_operations.DataFrameOperationsComponent"
            },
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "DataFrame",
                "group_outputs": false,
                "method": "perform_operation",
                "name": "output",
                "options": null,
                "required_inputs": null,
                "selected": "DataFrame",
                "tool_mode": true,
                "types": [
                  "DataFrame"
                ],
                "value": "__UNDEFINED__"
              }
            ],
            "pinned": false,
            "template": {
              "_type": "Component",
              "ascending": {
                "_input_type": "BoolInput",
                "advanced": false,
                "display_name": "Sort Ascending",
                "dynamic": true,
                "info": "Whether to sort in ascending order.",
                "list": false,
                "list_add_label": "Add More",
                "name": "ascending",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": true
              },
              "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": "import pandas as pd\n\nfrom lfx.custom.custom_component.component import Component\nfrom lfx.inputs import SortableListInput\nfrom lfx.io import BoolInput, DataFrameInput, DropdownInput, IntInput, MessageTextInput, Output, StrInput\nfrom lfx.log.logger import logger\nfrom lfx.schema.dataframe import DataFrame\n\n\nclass DataFrameOperationsComponent(Component):\n    display_name = \"DataFrame Operations\"\n    description = \"Perform various operations on a DataFrame.\"\n    documentation: str = \"https://docs.langflow.org/components-processing#dataframe-operations\"\n    icon = \"table\"\n    name = \"DataFrameOperations\"\n\n    OPERATION_CHOICES = [\n        \"Add Column\",\n        \"Drop Column\",\n        \"Filter\",\n        \"Head\",\n        \"Rename Column\",\n        \"Replace Value\",\n        \"Select Columns\",\n        \"Sort\",\n        \"Tail\",\n        \"Drop Duplicates\",\n    ]\n\n    inputs = [\n        DataFrameInput(\n            name=\"df\",\n            display_name=\"DataFrame\",\n            info=\"The input DataFrame to operate on.\",\n            required=True,\n        ),\n        SortableListInput(\n            name=\"operation\",\n            display_name=\"Operation\",\n            placeholder=\"Select Operation\",\n            info=\"Select the DataFrame operation to perform.\",\n            options=[\n                {\"name\": \"Add Column\", \"icon\": \"plus\"},\n                {\"name\": \"Drop Column\", \"icon\": \"minus\"},\n                {\"name\": \"Filter\", \"icon\": \"filter\"},\n                {\"name\": \"Head\", \"icon\": \"arrow-up\"},\n                {\"name\": \"Rename Column\", \"icon\": \"pencil\"},\n                {\"name\": \"Replace Value\", \"icon\": \"replace\"},\n                {\"name\": \"Select Columns\", \"icon\": \"columns\"},\n                {\"name\": \"Sort\", \"icon\": \"arrow-up-down\"},\n                {\"name\": \"Tail\", \"icon\": \"arrow-down\"},\n                {\"name\": \"Drop Duplicates\", \"icon\": \"copy-x\"},\n            ],\n            real_time_refresh=True,\n            limit=1,\n        ),\n        StrInput(\n            name=\"column_name\",\n            display_name=\"Column Name\",\n            info=\"The column name to use for the operation.\",\n            dynamic=True,\n            show=False,\n        ),\n        MessageTextInput(\n            name=\"filter_value\",\n            display_name=\"Filter Value\",\n            info=\"The value to filter rows by.\",\n            dynamic=True,\n            show=False,\n        ),\n        DropdownInput(\n            name=\"filter_operator\",\n            display_name=\"Filter Operator\",\n            options=[\n                \"equals\",\n                \"not equals\",\n                \"contains\",\n                \"not contains\",\n                \"starts with\",\n                \"ends with\",\n                \"greater than\",\n                \"less than\",\n            ],\n            value=\"equals\",\n            info=\"The operator to apply for filtering rows.\",\n            advanced=False,\n            dynamic=True,\n            show=False,\n        ),\n        BoolInput(\n            name=\"ascending\",\n            display_name=\"Sort Ascending\",\n            info=\"Whether to sort in ascending order.\",\n            dynamic=True,\n            show=False,\n            value=True,\n        ),\n        StrInput(\n            name=\"new_column_name\",\n            display_name=\"New Column Name\",\n            info=\"The new column name when renaming or adding a column.\",\n            dynamic=True,\n            show=False,\n        ),\n        MessageTextInput(\n            name=\"new_column_value\",\n            display_name=\"New Column Value\",\n            info=\"The value to populate the new column with.\",\n            dynamic=True,\n            show=False,\n        ),\n        StrInput(\n            name=\"columns_to_select\",\n            display_name=\"Columns to Select\",\n            dynamic=True,\n            is_list=True,\n            show=False,\n        ),\n        IntInput(\n            name=\"num_rows\",\n            display_name=\"Number of Rows\",\n            info=\"Number of rows to return (for head/tail).\",\n            dynamic=True,\n            show=False,\n            value=5,\n        ),\n        MessageTextInput(\n            name=\"replace_value\",\n            display_name=\"Value to Replace\",\n            info=\"The value to replace in the column.\",\n            dynamic=True,\n            show=False,\n        ),\n        MessageTextInput(\n            name=\"replacement_value\",\n            display_name=\"Replacement Value\",\n            info=\"The value to replace with.\",\n            dynamic=True,\n            show=False,\n        ),\n    ]\n\n    outputs = [\n        Output(\n            display_name=\"DataFrame\",\n            name=\"output\",\n            method=\"perform_operation\",\n            info=\"The resulting DataFrame after the operation.\",\n        )\n    ]\n\n    def update_build_config(self, build_config, field_value, field_name=None):\n        dynamic_fields = [\n            \"column_name\",\n            \"filter_value\",\n            \"filter_operator\",\n            \"ascending\",\n            \"new_column_name\",\n            \"new_column_value\",\n            \"columns_to_select\",\n            \"num_rows\",\n            \"replace_value\",\n            \"replacement_value\",\n        ]\n        for field in dynamic_fields:\n            build_config[field][\"show\"] = False\n\n        if field_name == \"operation\":\n            # Handle SortableListInput format\n            if isinstance(field_value, list):\n                operation_name = field_value[0].get(\"name\", \"\") if field_value else \"\"\n            else:\n                operation_name = field_value or \"\"\n\n            # If no operation selected, all dynamic fields stay hidden (already set to False above)\n            if not operation_name:\n                return build_config\n\n            if operation_name == \"Filter\":\n                build_config[\"column_name\"][\"show\"] = True\n                build_config[\"filter_value\"][\"show\"] = True\n                build_config[\"filter_operator\"][\"show\"] = True\n            elif operation_name == \"Sort\":\n                build_config[\"column_name\"][\"show\"] = True\n                build_config[\"ascending\"][\"show\"] = True\n            elif operation_name == \"Drop Column\":\n                build_config[\"column_name\"][\"show\"] = True\n            elif operation_name == \"Rename Column\":\n                build_config[\"column_name\"][\"show\"] = True\n                build_config[\"new_column_name\"][\"show\"] = True\n            elif operation_name == \"Add Column\":\n                build_config[\"new_column_name\"][\"show\"] = True\n                build_config[\"new_column_value\"][\"show\"] = True\n            elif operation_name == \"Select Columns\":\n                build_config[\"columns_to_select\"][\"show\"] = True\n            elif operation_name in {\"Head\", \"Tail\"}:\n                build_config[\"num_rows\"][\"show\"] = True\n            elif operation_name == \"Replace Value\":\n                build_config[\"column_name\"][\"show\"] = True\n                build_config[\"replace_value\"][\"show\"] = True\n                build_config[\"replacement_value\"][\"show\"] = True\n            elif operation_name == \"Drop Duplicates\":\n                build_config[\"column_name\"][\"show\"] = True\n\n        return build_config\n\n    def perform_operation(self) -> DataFrame:\n        df_copy = self.df.copy()\n\n        # Handle SortableListInput format for operation\n        operation_input = getattr(self, \"operation\", [])\n        if isinstance(operation_input, list) and len(operation_input) > 0:\n            op = operation_input[0].get(\"name\", \"\")\n        else:\n            op = \"\"\n\n        # If no operation selected, return original DataFrame\n        if not op:\n            return df_copy\n\n        if op == \"Filter\":\n            return self.filter_rows_by_value(df_copy)\n        if op == \"Sort\":\n            return self.sort_by_column(df_copy)\n        if op == \"Drop Column\":\n            return self.drop_column(df_copy)\n        if op == \"Rename Column\":\n            return self.rename_column(df_copy)\n        if op == \"Add Column\":\n            return self.add_column(df_copy)\n        if op == \"Select Columns\":\n            return self.select_columns(df_copy)\n        if op == \"Head\":\n            return self.head(df_copy)\n        if op == \"Tail\":\n            return self.tail(df_copy)\n        if op == \"Replace Value\":\n            return self.replace_values(df_copy)\n        if op == \"Drop Duplicates\":\n            return self.drop_duplicates(df_copy)\n        msg = f\"Unsupported operation: {op}\"\n        logger.error(msg)\n        raise ValueError(msg)\n\n    def filter_rows_by_value(self, df: DataFrame) -> DataFrame:\n        column = df[self.column_name]\n        filter_value = self.filter_value\n\n        # Handle regular DropdownInput format (just a string value)\n        operator = getattr(self, \"filter_operator\", \"equals\")  # Default to equals for backward compatibility\n\n        if operator == \"equals\":\n            mask = column == filter_value\n        elif operator == \"not equals\":\n            mask = column != filter_value\n        elif operator == \"contains\":\n            mask = column.astype(str).str.contains(str(filter_value), na=False)\n        elif operator == \"not contains\":\n            mask = ~column.astype(str).str.contains(str(filter_value), na=False)\n        elif operator == \"starts with\":\n            mask = column.astype(str).str.startswith(str(filter_value), na=False)\n        elif operator == \"ends with\":\n            mask = column.astype(str).str.endswith(str(filter_value), na=False)\n        elif operator == \"greater than\":\n            try:\n                # Try to convert filter_value to numeric for comparison\n                numeric_value = pd.to_numeric(filter_value)\n                mask = column > numeric_value\n            except (ValueError, TypeError):\n                # If conversion fails, compare as strings\n                mask = column.astype(str) > str(filter_value)\n        elif operator == \"less than\":\n            try:\n                # Try to convert filter_value to numeric for comparison\n                numeric_value = pd.to_numeric(filter_value)\n                mask = column < numeric_value\n            except (ValueError, TypeError):\n                # If conversion fails, compare as strings\n                mask = column.astype(str) < str(filter_value)\n        else:\n            mask = column == filter_value  # Fallback to equals\n\n        return DataFrame(df[mask])\n\n    def sort_by_column(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.sort_values(by=self.column_name, ascending=self.ascending))\n\n    def drop_column(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.drop(columns=[self.column_name]))\n\n    def rename_column(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.rename(columns={self.column_name: self.new_column_name}))\n\n    def add_column(self, df: DataFrame) -> DataFrame:\n        df[self.new_column_name] = [self.new_column_value] * len(df)\n        return DataFrame(df)\n\n    def select_columns(self, df: DataFrame) -> DataFrame:\n        columns = [col.strip() for col in self.columns_to_select]\n        return DataFrame(df[columns])\n\n    def head(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.head(self.num_rows))\n\n    def tail(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.tail(self.num_rows))\n\n    def replace_values(self, df: DataFrame) -> DataFrame:\n        df[self.column_name] = df[self.column_name].replace(self.replace_value, self.replacement_value)\n        return DataFrame(df)\n\n    def drop_duplicates(self, df: DataFrame) -> DataFrame:\n        return DataFrame(df.drop_duplicates(subset=self.column_name))\n"
              },
              "column_name": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "Column Name",
                "dynamic": true,
                "info": "The column name to use for the operation.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "column_name",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "columns_to_select": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "Columns to Select",
                "dynamic": true,
                "info": "",
                "list": true,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "columns_to_select",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "df": {
                "_input_type": "DataFrameInput",
                "advanced": false,
                "display_name": "DataFrame",
                "dynamic": false,
                "info": "The input DataFrame to operate on.",
                "input_types": [
                  "DataFrame"
                ],
                "list": false,
                "list_add_label": "Add More",
                "name": "df",
                "placeholder": "",
                "required": true,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "other",
                "value": ""
              },
              "filter_operator": {
                "_input_type": "DropdownInput",
                "advanced": false,
                "combobox": false,
                "dialog_inputs": {},
                "display_name": "Filter Operator",
                "dynamic": true,
                "external_options": {},
                "info": "The operator to apply for filtering rows.",
                "name": "filter_operator",
                "options": [
                  "equals",
                  "not equals",
                  "contains",
                  "not contains",
                  "starts with",
                  "ends with",
                  "greater than",
                  "less than"
                ],
                "options_metadata": [],
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "toggle": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "equals"
              },
              "filter_value": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "Filter Value",
                "dynamic": true,
                "info": "The value to filter rows by.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "filter_value",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "new_column_name": {
                "_input_type": "StrInput",
                "advanced": false,
                "display_name": "New Column Name",
                "dynamic": true,
                "info": "The new column name when renaming or adding a column.",
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "new_column_name",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "file_size"
              },
              "new_column_value": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "New Column Value",
                "dynamic": true,
                "info": "The value to populate the new column with.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": true,
                "name": "new_column_value",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": "FILESIZE"
              },
              "num_rows": {
                "_input_type": "IntInput",
                "advanced": false,
                "display_name": "Number of Rows",
                "dynamic": true,
                "info": "Number of rows to return (for head/tail).",
                "list": false,
                "list_add_label": "Add More",
                "name": "num_rows",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "int",
                "value": 5
              },
              "operation": {
                "_input_type": "SortableListInput",
                "advanced": false,
                "display_name": "Operation",
                "dynamic": false,
                "info": "Select the DataFrame operation to perform.",
                "limit": 1,
                "name": "operation",
                "options": [
                  {
                    "icon": "plus",
                    "name": "Add Column"
                  },
                  {
                    "icon": "minus",
                    "name": "Drop Column"
                  },
                  {
                    "icon": "filter",
                    "name": "Filter"
                  },
                  {
                    "icon": "arrow-up",
                    "name": "Head"
                  },
                  {
                    "icon": "pencil",
                    "name": "Rename Column"
                  },
                  {
                    "icon": "replace",
                    "name": "Replace Value"
                  },
                  {
                    "icon": "columns",
                    "name": "Select Columns"
                  },
                  {
                    "icon": "arrow-up-down",
                    "name": "Sort"
                  },
                  {
                    "icon": "arrow-down",
                    "name": "Tail"
                  },
                  {
                    "icon": "copy-x",
                    "name": "Drop Duplicates"
                  }
                ],
                "placeholder": "Select Operation",
                "real_time_refresh": true,
                "required": false,
                "search_category": [],
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "sortableList",
                "value": [
                  {
                    "chosen": false,
                    "icon": "plus",
                    "name": "Add Column",
                    "selected": false
                  }
                ]
              },
              "replace_value": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "Value to Replace",
                "dynamic": true,
                "info": "The value to replace in the column.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "replace_value",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "replacement_value": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "Replacement Value",
                "dynamic": true,
                "info": "The value to replace with.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "replacement_value",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              }
            },
            "tool_mode": false
          },
          "showNode": true,
          "type": "DataFrameOperations"
        },
        "dragging": false,
        "id": "DataFrameOperations-9vMrp",
        "measured": {
          "height": 399,
          "width": 320
        },
        "position": {
          "x": 956.3345099816677,
          "y": 1077.3618931222093
        },
        "selected": false,
        "type": "genericNode"
      },
      {
        "data": {
          "id": "note-DCu9M",
          "node": {
            "description": "## README\n\nThis flow transforms raw documents into searchable knowledge stored in an OpenSearch vector database.\nThis [knowledge](https://docs.openr.ag/knowledge) serves as context that your [agents](https://docs.openr.ag/agents) draw upon to answer questions and perform tasks.\n\n* Data sources: This flow ingests data from OAuth connectors or can load from your local machine. For more, see [Ingest Knowledge](https://docs.openr.ag/knowledge#ingest-knowledge).\n* Docling ingestion: The [**Docling Serve** component](https://docs.openr.ag/ingestion) processes input documents by connecting to your instance of Docling serve. For more, see [Docling Ingestion](https://docs.openr.ag/ingestion).\n* Processing: The flow adds metadata through three [**DataFrame Operations** components](https://docs.langflow.org/components-processing#dataframe-operations) that add `filename`, `file_size`, and `mimetype` columns.\nThe **Split Text** component then splits the processed text into uniform, easily searchable chunks.\n* Embedding generation:The [**Embedding Model** component](https://docs.langflow.org/components-embedding-models) generates vector embeddings with the model you selected at [Application onboarding](https://docs.openr.ag/install#application-onboarding), and the [**OpenSearch** component](https://docs.langflow.org/bundles-elastic#opensearch) stores the processed documents and their embeddings in the documents index.\n* Metadata and ownership: The **Secret Input** components provide user context that is stored as metadata in OpenSearch. These fields are populated from OAuth configuration values, and enable multi-tenant document isolation in OpenSearch, so each user's documents remain private and traceable.\n\nFor more information, see the [OpenRAG docs](https://docs.openr.ag/ingestion#knowledge-ingestion-flows).\n",
            "display_name": "",
            "documentation": "",
            "template": {}
          },
          "type": "note"
        },
        "dragging": false,
        "height": 439,
        "id": "note-DCu9M",
        "measured": {
          "height": 439,
          "width": 1000
        },
        "position": {
          "x": -538.3997974029603,
          "y": 1984.9915833571447
        },
        "resizing": true,
        "selected": false,
        "type": "noteNode",
        "width": 1000
      },
      {
        "data": {
          "id": "EmbeddingModel-WIe3H",
          "node": {
            "base_classes": [
              "Embeddings"
            ],
            "beta": false,
            "conditional_paths": [],
            "custom_fields": {},
            "description": "Generate embeddings using a specified provider.",
            "display_name": "Embedding Model",
            "documentation": "https://docs.langflow.org/components-embedding-models",
            "edited": false,
            "field_order": [
              "provider",
              "api_base",
              "ollama_base_url",
              "base_url_ibm_watsonx",
              "model",
              "api_key",
              "project_id",
              "dimensions",
              "chunk_size",
              "request_timeout",
              "max_retries",
              "show_progress_bar",
              "model_kwargs"
            ],
            "frozen": false,
            "icon": "binary",
            "last_updated": "2025-11-11T15:06:53.974Z",
            "legacy": false,
            "metadata": {
              "code_hash": "bb03f97be707",
              "dependencies": {
                "dependencies": [
                  {
                    "name": "langchain_openai",
                    "version": "0.3.23"
                  },
                  {
                    "name": "lfx",
                    "version": null
                  },
                  {
                    "name": "langchain_ollama",
                    "version": "0.3.10"
                  },
                  {
                    "name": "langchain_community",
                    "version": "0.3.21"
                  },
                  {
                    "name": "langchain_ibm",
                    "version": "0.3.19"
                  }
                ],
                "total_dependencies": 5
              },
              "module": "lfx.components.models.embedding_model.EmbeddingModelComponent"
            },
            "minimized": false,
            "output_types": [],
            "outputs": [
              {
                "allows_loop": false,
                "cache": true,
                "display_name": "Embedding Model",
                "group_outputs": false,
                "method": "build_embeddings",
                "name": "embeddings",
                "options": null,
                "required_inputs": null,
                "selected": "Embeddings",
                "tool_mode": true,
                "types": [
                  "Embeddings"
                ],
                "value": "__UNDEFINED__"
              }
            ],
            "pinned": false,
            "template": {
              "_type": "Component",
              "api_base": {
                "_input_type": "MessageTextInput",
                "advanced": true,
                "display_name": "API Base URL",
                "dynamic": false,
                "info": "Base URL for the API. Leave empty for default.",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "api_base",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "api_key": {
                "_input_type": "SecretStrInput",
                "advanced": false,
                "display_name": "OpenAI API Key",
                "dynamic": false,
                "info": "Model Provider API key",
                "input_types": [],
                "load_from_db": true,
                "name": "api_key",
                "password": true,
                "placeholder": "",
                "real_time_refresh": true,
                "required": true,
                "show": true,
                "title_case": false,
                "type": "str",
                "value": "OPENAI_API_KEY"
              },
              "base_url_ibm_watsonx": {
                "_input_type": "DropdownInput",
                "advanced": false,
                "combobox": false,
                "dialog_inputs": {},
                "display_name": "watsonx API Endpoint",
                "dynamic": false,
                "external_options": {},
                "info": "The base URL of the API (IBM watsonx.ai only)",
                "name": "base_url_ibm_watsonx",
                "options": [
                  "https://us-south.ml.cloud.ibm.com",
                  "https://eu-de.ml.cloud.ibm.com",
                  "https://eu-gb.ml.cloud.ibm.com",
                  "https://au-syd.ml.cloud.ibm.com",
                  "https://jp-tok.ml.cloud.ibm.com",
                  "https://ca-tor.ml.cloud.ibm.com"
                ],
                "options_metadata": [],
                "placeholder": "",
                "real_time_refresh": true,
                "required": false,
                "show": false,
                "title_case": false,
                "toggle": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "https://us-south.ml.cloud.ibm.com"
              },
              "chunk_size": {
                "_input_type": "IntInput",
                "advanced": true,
                "display_name": "Chunk Size",
                "dynamic": false,
                "info": "",
                "list": false,
                "list_add_label": "Add More",
                "name": "chunk_size",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "int",
                "value": 1000
              },
              "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 typing import Any\n\nfrom langchain_openai import OpenAIEmbeddings\n\nfrom lfx.base.embeddings.model import LCEmbeddingsModel\nfrom lfx.base.models.model_utils import get_ollama_models, is_valid_ollama_url\nfrom lfx.base.models.openai_constants import OPENAI_EMBEDDING_MODEL_NAMES\nfrom lfx.base.models.watsonx_constants import IBM_WATSONX_URLS, WATSONX_EMBEDDING_MODEL_NAMES\nfrom lfx.field_typing import Embeddings\nfrom lfx.io import (\n    BoolInput,\n    DictInput,\n    DropdownInput,\n    FloatInput,\n    IntInput,\n    MessageTextInput,\n    SecretStrInput,\n)\nfrom lfx.log.logger import logger\nfrom lfx.schema.dotdict import dotdict\nfrom lfx.utils.util import transform_localhost_url\n\n# Ollama API constants\nHTTP_STATUS_OK = 200\nJSON_MODELS_KEY = \"models\"\nJSON_NAME_KEY = \"name\"\nJSON_CAPABILITIES_KEY = \"capabilities\"\nDESIRED_CAPABILITY = \"embedding\"\nDEFAULT_OLLAMA_URL = \"http://localhost:11434\"\n\n\nclass EmbeddingModelComponent(LCEmbeddingsModel):\n    display_name = \"Embedding Model\"\n    description = \"Generate embeddings using a specified provider.\"\n    documentation: str = \"https://docs.langflow.org/components-embedding-models\"\n    icon = \"binary\"\n    name = \"EmbeddingModel\"\n    category = \"models\"\n\n    inputs = [\n        DropdownInput(\n            name=\"provider\",\n            display_name=\"Model Provider\",\n            options=[\"OpenAI\", \"Ollama\", \"IBM watsonx.ai\"],\n            value=\"OpenAI\",\n            info=\"Select the embedding model provider\",\n            real_time_refresh=True,\n            options_metadata=[{\"icon\": \"OpenAI\"}, {\"icon\": \"Ollama\"}, {\"icon\": \"WatsonxAI\"}],\n        ),\n        MessageTextInput(\n            name=\"api_base\",\n            display_name=\"API Base URL\",\n            info=\"Base URL for the API. Leave empty for default.\",\n            advanced=True,\n        ),\n        MessageTextInput(\n            name=\"ollama_base_url\",\n            display_name=\"Ollama API URL\",\n            info=f\"Endpoint of the Ollama API (Ollama only). Defaults to {DEFAULT_OLLAMA_URL}\",\n            value=DEFAULT_OLLAMA_URL,\n            show=False,\n            real_time_refresh=True,\n            load_from_db=True,\n        ),\n        DropdownInput(\n            name=\"base_url_ibm_watsonx\",\n            display_name=\"watsonx API Endpoint\",\n            info=\"The base URL of the API (IBM watsonx.ai only)\",\n            options=IBM_WATSONX_URLS,\n            value=IBM_WATSONX_URLS[0],\n            show=False,\n            real_time_refresh=True,\n        ),\n        DropdownInput(\n            name=\"model\",\n            display_name=\"Model Name\",\n            options=OPENAI_EMBEDDING_MODEL_NAMES,\n            value=OPENAI_EMBEDDING_MODEL_NAMES[0],\n            info=\"Select the embedding model to use\",\n        ),\n        SecretStrInput(\n            name=\"api_key\",\n            display_name=\"OpenAI API Key\",\n            info=\"Model Provider API key\",\n            required=True,\n            show=True,\n            real_time_refresh=True,\n        ),\n        # Watson-specific inputs\n        MessageTextInput(\n            name=\"project_id\",\n            display_name=\"Project ID\",\n            info=\"IBM watsonx.ai Project ID (required for IBM watsonx.ai)\",\n            show=False,\n        ),\n        IntInput(\n            name=\"dimensions\",\n            display_name=\"Dimensions\",\n            info=\"The number of dimensions the resulting output embeddings should have. \"\n            \"Only supported by certain models.\",\n            advanced=True,\n        ),\n        IntInput(name=\"chunk_size\", display_name=\"Chunk Size\", advanced=True, value=1000),\n        FloatInput(name=\"request_timeout\", display_name=\"Request Timeout\", advanced=True),\n        IntInput(name=\"max_retries\", display_name=\"Max Retries\", advanced=True, value=3),\n        BoolInput(name=\"show_progress_bar\", display_name=\"Show Progress Bar\", advanced=True),\n        DictInput(\n            name=\"model_kwargs\",\n            display_name=\"Model Kwargs\",\n            advanced=True,\n            info=\"Additional keyword arguments to pass to the model.\",\n        ),\n    ]\n\n    def build_embeddings(self) -> Embeddings:\n        provider = self.provider\n        model = self.model\n        api_key = self.api_key\n        api_base = self.api_base\n        base_url_ibm_watsonx = self.base_url_ibm_watsonx\n        ollama_base_url = self.ollama_base_url\n        dimensions = self.dimensions\n        chunk_size = self.chunk_size\n        request_timeout = self.request_timeout\n        max_retries = self.max_retries\n        show_progress_bar = self.show_progress_bar\n        model_kwargs = self.model_kwargs or {}\n\n        if provider == \"OpenAI\":\n            if not api_key:\n                msg = \"OpenAI API key is required when using OpenAI provider\"\n                raise ValueError(msg)\n            return OpenAIEmbeddings(\n                model=model,\n                dimensions=dimensions or None,\n                base_url=api_base or None,\n                api_key=api_key,\n                chunk_size=chunk_size,\n                max_retries=max_retries,\n                timeout=request_timeout or None,\n                show_progress_bar=show_progress_bar,\n                model_kwargs=model_kwargs,\n            )\n\n        if provider == \"Ollama\":\n            try:\n                from langchain_ollama import OllamaEmbeddings\n            except ImportError:\n                try:\n                    from langchain_community.embeddings import OllamaEmbeddings\n                except ImportError:\n                    msg = \"Please install langchain-ollama: pip install langchain-ollama\"\n                    raise ImportError(msg) from None\n\n            transformed_base_url = transform_localhost_url(ollama_base_url)\n\n            # Check if URL contains /v1 suffix (OpenAI-compatible mode)\n            if transformed_base_url and transformed_base_url.rstrip(\"/\").endswith(\"/v1\"):\n                # Strip /v1 suffix and log warning\n                transformed_base_url = transformed_base_url.rstrip(\"/\").removesuffix(\"/v1\")\n                logger.warning(\n                    \"Detected '/v1' suffix in base URL. The Ollama component uses the native Ollama API, \"\n                    \"not the OpenAI-compatible API. The '/v1' suffix has been automatically removed. \"\n                    \"If you want to use the OpenAI-compatible API, please use the OpenAI component instead. \"\n                    \"Learn more at https://docs.ollama.com/openai#openai-compatibility\"\n                )\n\n            return OllamaEmbeddings(\n                model=model,\n                base_url=transformed_base_url or \"http://localhost:11434\",\n                **model_kwargs,\n            )\n\n        if provider == \"IBM watsonx.ai\":\n            try:\n                from langchain_ibm import WatsonxEmbeddings\n            except ImportError:\n                msg = \"Please install langchain-ibm: pip install langchain-ibm\"\n                raise ImportError(msg) from None\n\n            if not api_key:\n                msg = \"IBM watsonx.ai API key is required when using IBM watsonx.ai provider\"\n                raise ValueError(msg)\n\n            project_id = self.project_id\n\n            if not project_id:\n                msg = \"Project ID is required for IBM watsonx.ai provider\"\n                raise ValueError(msg)\n\n            params = {\n                \"model_id\": model,\n                \"url\": base_url_ibm_watsonx or \"https://us-south.ml.cloud.ibm.com\",\n                \"apikey\": api_key,\n            }\n\n            params[\"project_id\"] = project_id\n\n            return WatsonxEmbeddings(**params)\n\n        msg = f\"Unknown provider: {provider}\"\n        raise ValueError(msg)\n\n    async def update_build_config(\n        self, build_config: dotdict, field_value: Any, field_name: str | None = None\n    ) -> dotdict:\n        if field_name == \"provider\":\n            if field_value == \"OpenAI\":\n                build_config[\"model\"][\"options\"] = OPENAI_EMBEDDING_MODEL_NAMES\n                build_config[\"model\"][\"value\"] = OPENAI_EMBEDDING_MODEL_NAMES[0]\n                build_config[\"api_key\"][\"display_name\"] = \"OpenAI API Key\"\n                build_config[\"api_key\"][\"required\"] = True\n                build_config[\"api_key\"][\"show\"] = True\n                build_config[\"api_base\"][\"display_name\"] = \"OpenAI API Base URL\"\n                build_config[\"api_base\"][\"advanced\"] = True\n                build_config[\"api_base\"][\"show\"] = True\n                build_config[\"ollama_base_url\"][\"show\"] = False\n                build_config[\"project_id\"][\"show\"] = False\n                build_config[\"base_url_ibm_watsonx\"][\"show\"] = False\n\n            elif field_value == \"Ollama\":\n                build_config[\"ollama_base_url\"][\"show\"] = True\n\n                if await is_valid_ollama_url(url=self.ollama_base_url):\n                    try:\n                        models = await get_ollama_models(\n                            base_url_value=self.ollama_base_url,\n                            desired_capability=DESIRED_CAPABILITY,\n                            json_models_key=JSON_MODELS_KEY,\n                            json_name_key=JSON_NAME_KEY,\n                            json_capabilities_key=JSON_CAPABILITIES_KEY,\n                        )\n                        build_config[\"model\"][\"options\"] = models\n                        build_config[\"model\"][\"value\"] = models[0] if models else \"\"\n                    except ValueError:\n                        build_config[\"model\"][\"options\"] = []\n                        build_config[\"model\"][\"value\"] = \"\"\n                else:\n                    build_config[\"model\"][\"options\"] = []\n                    build_config[\"model\"][\"value\"] = \"\"\n\n                build_config[\"api_key\"][\"display_name\"] = \"API Key (Optional)\"\n                build_config[\"api_key\"][\"required\"] = False\n                build_config[\"api_key\"][\"show\"] = False\n                build_config[\"api_base\"][\"show\"] = False\n                build_config[\"project_id\"][\"show\"] = False\n                build_config[\"base_url_ibm_watsonx\"][\"show\"] = False\n\n            elif field_value == \"IBM watsonx.ai\":\n                build_config[\"model\"][\"options\"] = WATSONX_EMBEDDING_MODEL_NAMES\n                build_config[\"model\"][\"value\"] = WATSONX_EMBEDDING_MODEL_NAMES[0]\n                build_config[\"api_key\"][\"display_name\"] = \"IBM watsonx.ai API Key\"\n                build_config[\"api_key\"][\"required\"] = True\n                build_config[\"api_key\"][\"show\"] = True\n                build_config[\"api_base\"][\"show\"] = False\n                build_config[\"ollama_base_url\"][\"show\"] = False\n                build_config[\"base_url_ibm_watsonx\"][\"show\"] = True\n                build_config[\"project_id\"][\"show\"] = True\n\n        elif field_name == \"ollama_base_url\":\n            # # Refresh Ollama models when base URL changes\n            # if hasattr(self, \"provider\") and self.provider == \"Ollama\":\n            # Use field_value if provided, otherwise fall back to instance attribute\n            ollama_url = self.ollama_base_url\n            if await is_valid_ollama_url(url=ollama_url):\n                try:\n                    models = await get_ollama_models(\n                        base_url_value=ollama_url,\n                        desired_capability=DESIRED_CAPABILITY,\n                        json_models_key=JSON_MODELS_KEY,\n                        json_name_key=JSON_NAME_KEY,\n                        json_capabilities_key=JSON_CAPABILITIES_KEY,\n                    )\n                    build_config[\"model\"][\"options\"] = models\n                    build_config[\"model\"][\"value\"] = models[0] if models else \"\"\n                except ValueError:\n                    await logger.awarning(\"Failed to fetch Ollama embedding models.\")\n                    build_config[\"model\"][\"options\"] = []\n                    build_config[\"model\"][\"value\"] = \"\"\n\n        elif field_name == \"model\" and self.provider == \"Ollama\":\n            ollama_url = self.ollama_base_url\n            if await is_valid_ollama_url(url=ollama_url):\n                try:\n                    models = await get_ollama_models(\n                        base_url_value=ollama_url,\n                        desired_capability=DESIRED_CAPABILITY,\n                        json_models_key=JSON_MODELS_KEY,\n                        json_name_key=JSON_NAME_KEY,\n                        json_capabilities_key=JSON_CAPABILITIES_KEY,\n                    )\n                    build_config[\"model\"][\"options\"] = models\n                except ValueError:\n                    await logger.awarning(\"Failed to refresh Ollama embedding models.\")\n                    build_config[\"model\"][\"options\"] = []\n\n        return build_config\n"
              },
              "dimensions": {
                "_input_type": "IntInput",
                "advanced": true,
                "display_name": "Dimensions",
                "dynamic": false,
                "info": "The number of dimensions the resulting output embeddings should have. Only supported by certain models.",
                "list": false,
                "list_add_label": "Add More",
                "name": "dimensions",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "int",
                "value": ""
              },
              "max_retries": {
                "_input_type": "IntInput",
                "advanced": true,
                "display_name": "Max Retries",
                "dynamic": false,
                "info": "",
                "list": false,
                "list_add_label": "Add More",
                "name": "max_retries",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "int",
                "value": 3
              },
              "model": {
                "_input_type": "DropdownInput",
                "advanced": false,
                "combobox": false,
                "dialog_inputs": {},
                "display_name": "Model Name",
                "dynamic": false,
                "external_options": {},
                "info": "Select the embedding model to use",
                "name": "model",
                "options": [
                  "text-embedding-3-small",
                  "text-embedding-3-large",
                  "text-embedding-ada-002"
                ],
                "options_metadata": [],
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "toggle": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "text-embedding-3-small"
              },
              "model_kwargs": {
                "_input_type": "DictInput",
                "advanced": true,
                "display_name": "Model Kwargs",
                "dynamic": false,
                "info": "Additional keyword arguments to pass to the model.",
                "list": false,
                "list_add_label": "Add More",
                "name": "model_kwargs",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "type": "dict",
                "value": {}
              },
              "ollama_base_url": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "Ollama API URL",
                "dynamic": false,
                "info": "Endpoint of the Ollama API (Ollama only). Defaults to http://localhost:11434",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "ollama_base_url",
                "placeholder": "",
                "real_time_refresh": true,
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "project_id": {
                "_input_type": "MessageTextInput",
                "advanced": false,
                "display_name": "Project ID",
                "dynamic": false,
                "info": "IBM watsonx.ai Project ID (required for IBM watsonx.ai)",
                "input_types": [
                  "Message"
                ],
                "list": false,
                "list_add_label": "Add More",
                "load_from_db": false,
                "name": "project_id",
                "placeholder": "",
                "required": false,
                "show": false,
                "title_case": false,
                "tool_mode": false,
                "trace_as_input": true,
                "trace_as_metadata": true,
                "type": "str",
                "value": ""
              },
              "provider": {
                "_input_type": "DropdownInput",
                "advanced": false,
                "combobox": false,
                "dialog_inputs": {},
                "display_name": "Model Provider",
                "dynamic": false,
                "external_options": {},
                "info": "Select the embedding model provider",
                "name": "provider",
                "options": [
                  "OpenAI",
                  "Ollama",
                  "IBM watsonx.ai"
                ],
                "options_metadata": [
                  {
                    "icon": "OpenAI"
                  },
                  {
                    "icon": "Ollama"
                  },
                  {
                    "icon": "WatsonxAI"
                  }
                ],
                "placeholder": "",
                "real_time_refresh": true,
                "required": false,
                "show": true,
                "title_case": false,
                "toggle": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "str",
                "value": "OpenAI"
              },
              "request_timeout": {
                "_input_type": "FloatInput",
                "advanced": true,
                "display_name": "Request Timeout",
                "dynamic": false,
                "info": "",
                "list": false,
                "list_add_label": "Add More",
                "name": "request_timeout",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "float",
                "value": ""
              },
              "show_progress_bar": {
                "_input_type": "BoolInput",
                "advanced": true,
                "display_name": "Show Progress Bar",
                "dynamic": false,
                "info": "",
                "list": false,
                "list_add_label": "Add More",
                "name": "show_progress_bar",
                "placeholder": "",
                "required": false,
                "show": true,
                "title_case": false,
                "tool_mode": false,
                "trace_as_metadata": true,
                "type": "bool",
                "value": false
              }
            },
            "tool_mode": false
          },
          "showNode": true,
          "type": "EmbeddingModel"
        },
        "dragging": false,
        "id": "EmbeddingModel-WIe3H",
        "measured": {
          "height": 369,
          "width": 320
        },
        "position": {
          "x": 1801.4066878627907,
          "y": 1817.9066615159154
        },
        "selected": false,
        "type": "genericNode"
      }
    ],
    "viewport": {
      "x": -35.55006677196684,
      "y": -678.0353419327157,
      "zoom": 0.5646686365360081
    }
  },
  "description": "Load your data for chat context with Retrieval Augmented Generation.",
  "endpoint_name": null,
  "id": "5488df7c-b93f-4f87-a446-b67028bc0813",
  "is_component": false,
  "last_tested_version": "1.7.0",
  "name": "OpenSearch Ingestion Flow",
  "tags": [
    "openai",
    "astradb",
    "rag",
    "q-a"
  ]
}