Add field type for metadata in ReadTheDocsLoaderComponent
This commit is contained in:
parent
1425714ce9
commit
f086f31e79
1 changed files with 4 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
from langflow import CustomComponent
|
from langflow import CustomComponent
|
||||||
from langflow.field_typing import Document
|
|
||||||
from typing import Dict, Optional
|
from typing import Dict, Optional
|
||||||
|
from langchain_community.document_loaders.readthedocs import ReadTheDocsLoader
|
||||||
|
|
||||||
|
|
||||||
class ReadTheDocsLoaderComponent(CustomComponent):
|
class ReadTheDocsLoaderComponent(CustomComponent):
|
||||||
|
|
@ -9,7 +9,7 @@ class ReadTheDocsLoaderComponent(CustomComponent):
|
||||||
|
|
||||||
def build_config(self):
|
def build_config(self):
|
||||||
return {
|
return {
|
||||||
"metadata": {"display_name": "Metadata", "default": {}},
|
"metadata": {"display_name": "Metadata", "default": {},"field_type": "dict"},
|
||||||
"path": {"display_name": "Local directory", "required": True},
|
"path": {"display_name": "Local directory", "required": True},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -17,5 +17,5 @@ class ReadTheDocsLoaderComponent(CustomComponent):
|
||||||
self,
|
self,
|
||||||
path: str,
|
path: str,
|
||||||
metadata: Optional[Dict] = None,
|
metadata: Optional[Dict] = None,
|
||||||
) -> Document:
|
) -> ReadTheDocsLoader:
|
||||||
return Document(path=path, metadata=metadata or {})
|
return ReadTheDocsLoader(path=path, metadata=metadata or {}).load()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue