Skip to content

Commit 33fec21

Browse files
committed
Enable structured output in Parsera class
1 parent ae32444 commit 33fec21

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

parsera/parsera.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from parsera.engine.api_extractor import APIExtractor, Extractor
88
from parsera.engine.chunks_extractor import ChunksTabularExtractor
9+
from parsera.engine.structured_extractor import StructuredExtractor
910
from parsera.page import PageLoader
1011

1112

@@ -17,6 +18,7 @@ def __init__(
1718
initial_script: Callable[[Page], Awaitable[Page]] | None = None,
1819
stealth: bool = True,
1920
custom_cookies: list[dict] | None = None,
21+
typed: bool = False,
2022
):
2123
"""Initialize Parsera
2224
@@ -35,7 +37,10 @@ def __init__(
3537
self.extractor = APIExtractor()
3638
elif model and extractor is None:
3739
self.model = model
38-
self.extractor = ChunksTabularExtractor(model=self.model)
40+
if typed:
41+
self.extractor = StructuredExtractor(model=self.model)
42+
else:
43+
self.extractor = ChunksTabularExtractor(model=self.model)
3944
elif model is None and extractor:
4045
self.extractor = extractor
4146
else:

0 commit comments

Comments
 (0)