Skip to content

Commit

Permalink
add cache option to unstructured parser (#7653)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: b18a2e2449552fd5e80e13c331c52b733075fc06
  • Loading branch information
berkecanrizai authored and Manul from Pathway committed Nov 14, 2024
1 parent ffe2fc7 commit f923730
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/pathway/xpacks/llm/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,15 @@ class ParseUnstructured(pw.UDF):

def __init__(
self,
mode: str = "single",
mode: Literal["single", "elements", "paged"] = "single",
post_processors: list[Callable] | None = None,
cache_strategy: udfs.CacheStrategy | None = None,
**unstructured_kwargs: Any,
):
with optional_imports("xpack-llm-docs"):
import unstructured.partition.auto # noqa:F401

super().__init__()
super().__init__(cache_strategy=cache_strategy)
_valid_modes = {"single", "elements", "paged"}
if mode not in _valid_modes:
raise ValueError(
Expand Down

0 comments on commit f923730

Please sign in to comment.