Class Chunk.Builder
java.lang.Object
ai.docling.serve.api.chunk.response.Chunk.Builder
- Enclosing class:
- Chunk
Builder for creating
Chunk instances.
Generated by Lombok's @Builder annotation.
Builder methods:
filename(String)- Set the filename of the source documentchunkIndex(int)- Set the zero-based chunk indextext(String)- Set the formatted chunk textrawText(String)- Set the raw chunk textnumTokens(Integer)- Set the number of tokensheading(String)- Add a single heading (use with @Singular)headings(List<String>)- Set the list of headingscaption(String)- Add a single caption (use with @Singular)captions(List<String>)- Set the list of captionsdocItem(String)- Add a single doc item reference (use with @Singular)docItems(List<String>)- Set the list of doc itemspageNumber(Integer)- Add a single page number (use with @Singular)pageNumbers(List<Integer>)- Set the list of page numbersmetadata(String, Object)- Add a single metadata entry (use with @Singular)metadata(Map<String, Object>)- Set the metadata map
-
Method Summary
Modifier and TypeMethodDescription@NonNull Chunkbuild()@NonNull Chunk.Builder@NonNull Chunk.Buildercaptions(@NonNull Collection<? extends String> captions) @NonNull Chunk.BuilderchunkIndex(int chunkIndex) Index of this chunk within the document.@NonNull Chunk.Builder@NonNull Chunk.Builder@NonNull Chunk.Builder@NonNull Chunk.Builder@NonNull Chunk.Builder@NonNull Chunk.Builder@NonNull Chunk.BuilderdocItems(@NonNull Collection<? extends String> docItems) @NonNull Chunk.BuilderFilename of the source document.@NonNull Chunk.Builder@NonNull Chunk.Builderheadings(@NonNull Collection<? extends String> headings) @NonNull Chunk.Builder@NonNull Chunk.Builder@NonNull Chunk.BuilderNumber of tokens in the text, if the chunker is aware of tokens.@NonNull Chunk.BuilderpageNumber(Integer pageNumber) @NonNull Chunk.BuilderpageNumbers(@NonNull Collection<? extends Integer> pageNumbers) @NonNull Chunk.BuilderRaw chunk text without additional formatting or context.@NonNull Chunk.BuilderThe chunk text with structural context (headers, formatting).@NonNull StringtoString()
-
Method Details
-
filename
Filename of the source document.- Parameters:
filename- the filename of the source document- Returns:
this.
-
chunkIndex
Index of this chunk within the document.- Parameters:
chunkIndex- the zero-based chunk index- Returns:
this.
-
text
The chunk text with structural context (headers, formatting).- Parameters:
text- the formatted chunk text- Returns:
this.
-
rawText
Raw chunk text without additional formatting or context.- Parameters:
rawText- the raw chunk text, or null if not included- Returns:
this.
-
numTokens
Number of tokens in the text, if the chunker is aware of tokens.- Parameters:
numTokens- the number of tokens, or null if not calculated- Returns:
this.
-
heading
-
headings
-
clearHeadings
-
caption
-
captions
-
clearCaptions
-
docItem
-
docItems
-
clearDocItems
-
pageNumber
-
pageNumbers
-
clearPageNumbers
-
metadata
-
metadata
-
clearMetadata
-
build
-
toString
-