Compare commits

...

2 Commits

Author SHA1 Message Date
Logan Markewich 687dde834b changeset 2025-12-02 12:05:23 -06:00
Logan Markewich fa17acf590 line-level bbox support 2025-12-02 12:04:53 -06:00
3 changed files with 35 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"llama-cloud-services-py": patch
---
Add line-level bbox support
+7
View File
@@ -564,6 +564,10 @@ class LlamaParse(BasePydanticReader):
default=None,
description="Whether to extract the printed page numbers from pages in the document.",
)
line_level_bounding_box: Optional[bool] = Field(
default=False,
description="If set to true, the parser will include line-level bounding boxes in the result.",
)
# Deprecated
bounding_box: Optional[str] = Field(
@@ -1118,6 +1122,9 @@ class LlamaParse(BasePydanticReader):
if self.extract_printed_page_number is not None:
data["extract_printed_page_number"] = self.extract_printed_page_number
if self.line_level_bounding_box is not None:
data["line_level_bounding_box"] = self.line_level_bounding_box
# Deprecated
if self.bounding_box is not None:
data["bounding_box"] = self.bounding_box
+23
View File
@@ -115,6 +115,26 @@ class BBox(SafeBaseModel):
)
class LineLevelBboxItem(SafeBaseModel):
"""A line-level bounding box item."""
md: Optional[str] = Field(
default=None, description="The markdown-formatted content of the line."
)
text: Optional[str] = Field(
default=None, description="The text content of the line."
)
bBox: Optional[BBox] = Field(
default=None, description="The bounding box of the line."
)
startIndex: Optional[int] = Field(
default=None, description="The start index of the line in the page text."
)
endIndex: Optional[int] = Field(
default=None, description="The end index of the line in the page text."
)
class PageItem(SafeBaseModel):
"""An item in a page."""
@@ -138,6 +158,9 @@ class PageItem(SafeBaseModel):
default=None,
description="The HTML-formatted content of the item. Only applicable for table items when output_tables_as_HTML=True.",
)
lines: Optional[List[LineLevelBboxItem]] = Field(
default=None, description="The line-level bounding box items of the item."
)
class ImageItem(SafeBaseModel):