Update CSVLoader imports and metadata parameter
This commit is contained in:
parent
5087a503f2
commit
2d2fd9a2ae
1 changed files with 5 additions and 4 deletions
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
from langchain import CustomComponent
|
from langflow import CustomComponent
|
||||||
from typing import Optional, Dict, List
|
from typing import Optional, Dict, List
|
||||||
from langchain.loaders import CSVLoader
|
from langchain_community.document_loaders.csv_loader import CSVLoader
|
||||||
from langchain.documents import Document
|
from langchain.docstore.document import Document
|
||||||
|
|
||||||
class CSVLoaderComponent(CustomComponent):
|
class CSVLoaderComponent(CustomComponent):
|
||||||
display_name = "CSVLoader"
|
display_name = "CSVLoader"
|
||||||
|
|
@ -15,6 +15,7 @@ class CSVLoaderComponent(CustomComponent):
|
||||||
"required": True,
|
"required": True,
|
||||||
"suffixes": [".csv"],
|
"suffixes": [".csv"],
|
||||||
"file_types": ["csv"],
|
"file_types": ["csv"],
|
||||||
|
"field_type": "file",
|
||||||
},
|
},
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"display_name": "Metadata",
|
"display_name": "Metadata",
|
||||||
|
|
@ -25,6 +26,6 @@ class CSVLoaderComponent(CustomComponent):
|
||||||
def build(
|
def build(
|
||||||
self,
|
self,
|
||||||
file_path: str,
|
file_path: str,
|
||||||
metadata: Optional[Dict[str, str]] = None,
|
metadata: dict
|
||||||
) -> List[Document]:
|
) -> List[Document]:
|
||||||
return CSVLoader(file_path=file_path, metadata=metadata).load()
|
return CSVLoader(file_path=file_path, metadata=metadata).load()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue