Skip to content

Commit 8aa9a61

Browse files
Use Field(default_factory=list) for Page.lines and Page.paragraphs
Pre-existing Optional[List[...]] = [] defaults silently parsed an explicit JSON null to None, which would cause a TypeError when the confidence evaluator iterates page.lines (line 132). Switch to the same Field(default_factory=list) pattern used for the other Page collections so these fields fail loudly at parse time on a malformed response and remain safe to iterate at every call site. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ab1cccb commit 8aa9a61

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/ContentProcessor/src/libs/azure_helper/model/content_understanding.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ class Page(BaseModel):
105105
height: float
106106
spans: List[Span] = Field(default_factory=list)
107107
words: List[Word] = Field(default_factory=list)
108-
lines: Optional[List[Line]] = []
109-
paragraphs: Optional[List[Paragraph]] = []
108+
lines: List[Line] = Field(default_factory=list)
109+
paragraphs: List[Paragraph] = Field(default_factory=list)
110110

111111

112112
class DocumentContent(BaseModel):

0 commit comments

Comments
 (0)