Update CoNLLULoaderComponent configuration
This commit is contained in:
parent
2d2fd9a2ae
commit
cbacf55955
1 changed files with 9 additions and 9 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
from langflow import CustomComponent
|
from langflow import CustomComponent
|
||||||
from langchain.documents import Document
|
from langchain.docstore.document import Document
|
||||||
from typing import Optional, Dict
|
from typing import Optional, Dict
|
||||||
from langflow.field_typing import TemplateField
|
from langflow.field_typing import TemplateField
|
||||||
|
|
||||||
|
|
@ -11,13 +11,13 @@ class CoNLLULoaderComponent(CustomComponent):
|
||||||
|
|
||||||
def build_config(self):
|
def build_config(self):
|
||||||
return {
|
return {
|
||||||
"file_path": TemplateField(
|
"file_path": {
|
||||||
display_name="File Path",
|
"display_name": "File Path",
|
||||||
required=True,
|
"required": True,
|
||||||
type="file",
|
"suffixes": [".conllu"],
|
||||||
file_types=["conllu"],
|
"file_types": ["conllu"],
|
||||||
suffixes=[".conllu"],
|
"field_type": "file",
|
||||||
),
|
},
|
||||||
"metadata": TemplateField(
|
"metadata": TemplateField(
|
||||||
display_name="Metadata",
|
display_name="Metadata",
|
||||||
required=False,
|
required=False,
|
||||||
|
|
@ -25,7 +25,7 @@ class CoNLLULoaderComponent(CustomComponent):
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
def build(self, file_path: str, metadata: Optional[Dict[str, str]] = None) -> Document:
|
def build(self, file_path: str, metadata: dict) -> Document:
|
||||||
# Here, you would use the actual class that loads CoNLL-U files.
|
# Here, you would use the actual class that loads CoNLL-U files.
|
||||||
# As I don't have the specific class, I'm returning an instance of Document.
|
# As I don't have the specific class, I'm returning an instance of Document.
|
||||||
# In a real scenario, you should replace the below Document with the actual loader class.
|
# In a real scenario, you should replace the below Document with the actual loader class.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue