diff --git a/src/backend/langflow/components/utilities/TextToRecord.py b/src/backend/langflow/components/utilities/TextToRecord.py new file mode 100644 index 000000000..e176e15f5 --- /dev/null +++ b/src/backend/langflow/components/utilities/TextToRecord.py @@ -0,0 +1,29 @@ +from typing import Optional + +from langflow import CustomComponent +from langflow.field_typing import Text +from langflow.schema import Record + + +class TextToRecordComponent(CustomComponent): + display_name = "Text to Record" + description = "Converts text to a Record." + + def build_config(self): + return { + "text": { + "display_name": "Text", + "info": "The text to convert to a record.", + }, + "data": { + "display_name": "Data", + "info": "The optional data to include in the record.", + }, + } + + def build( + self, + text: Text, + data: Optional[dict] = {}, + ) -> Record: + return Record(text=text, data=data)