Update imports and field types in FacebookChatLoader.py

This commit is contained in:
carlosrcoelho 2024-01-09 19:52:23 -03:00
commit aa2aa1da51

View file

@ -1,6 +1,6 @@
from langflow import CustomComponent
from langchain.documents import Document
from langchain.docstore.document import Document
from typing import Optional, Dict
class FacebookChatLoaderComponent(CustomComponent):
@ -15,10 +15,12 @@ class FacebookChatLoaderComponent(CustomComponent):
"required": True,
"suffixes": [".json"],
"file_types": ["json"],
"field_type": "file",
},
"metadata": {
"display_name": "Metadata",
"required": False,
"field_type": "dict",
},
}
@ -27,4 +29,4 @@ class FacebookChatLoaderComponent(CustomComponent):
# and returns a Document object. Replace 'FacebookChatLoader' with the actual class name.
# As per the JSON, the output type is 'Document', which is part of langchain.documents.
# Therefore, the 'FacebookChatLoader' should be imported or defined elsewhere in the codebase.
return FacebookChatLoader(file_path=file_path, metadata=metadata)
return FacebookChatLoader(file_path=file_path, metadata=metadata)