Skip to content

Commit

Permalink
chore: Fix unstructured import (#1083)
Browse files Browse the repository at this point in the history
  • Loading branch information
lightaime authored Oct 18, 2024
1 parent c66fde5 commit 3013db3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions camel/loaders/unstructured_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import warnings
from io import IOBase
from typing import (
TYPE_CHECKING,
Any,
Dict,
List,
Expand All @@ -24,7 +25,8 @@
Union,
)

from unstructured.documents.elements import Element
if TYPE_CHECKING:
from unstructured.documents.elements import Element


class UnstructuredIO:
Expand All @@ -47,7 +49,7 @@ def create_element_from_text(
last_modified: Optional[str] = None,
filetype: Optional[str] = None,
parent_id: Optional[Union[str, uuid.UUID]] = None,
) -> Element:
) -> "Element":
r"""Creates a Text element from a given text input, with optional
metadata and embeddings.
Expand Down Expand Up @@ -93,7 +95,7 @@ def create_element_from_text(
def parse_file_or_url(
input_path: str,
**kwargs: Any,
) -> Union[List[Element], None]:
) -> Union[List["Element"], None]:
r"""Loads a file or a URL and parses its contents into elements.
Args:
Expand Down Expand Up @@ -154,7 +156,9 @@ def parse_file_or_url(
return None

@staticmethod
def parse_bytes(file: IOBase, **kwargs: Any) -> Union[List[Element], None]:
def parse_bytes(
file: IOBase, **kwargs: Any
) -> Union[List["Element"], None]:
r"""Parses a bytes stream and converts its contents into elements.
Args:
Expand Down Expand Up @@ -441,7 +445,7 @@ def stage_elements(
@staticmethod
def chunk_elements(
elements: List[Any], chunk_type: str, **kwargs
) -> List[Element]:
) -> List["Element"]:
r"""Chunks elements by titles.
Args:
Expand Down

0 comments on commit 3013db3

Please sign in to comment.