Skip to content

Commit

Permalink
chore: annotate kwargs across BaseChunker class hierarchy (#116)
Browse files Browse the repository at this point in the history
* chore: add missing type hint for HybridChunker.chunk

Signed-off-by: Eugene <[email protected]>

* chore: apply typing to whole hierarchy

Signed-off-by: Panos Vagenas <[email protected]>

---------

Signed-off-by: Eugene <[email protected]>
Signed-off-by: Panos Vagenas <[email protected]>
Co-authored-by: Panos Vagenas <[email protected]>
  • Loading branch information
Fogapod and vagenas authored Jan 21, 2025
1 parent b741eea commit f10b228
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docling_core/transforms/chunker/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class BaseChunker(BaseModel, ABC):
delim: str = DFLT_DELIM

@abstractmethod
def chunk(self, dl_doc: DLDocument, **kwargs) -> Iterator[BaseChunk]:
def chunk(self, dl_doc: DLDocument, **kwargs: Any) -> Iterator[BaseChunk]:
"""Chunk the provided document.
Args:
Expand Down
4 changes: 2 additions & 2 deletions docling_core/transforms/chunker/hybrid_chunker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""Hybrid chunker implementation leveraging both doc structure & token awareness."""

import warnings
from typing import Iterable, Iterator, Optional, Union
from typing import Any, Iterable, Iterator, Optional, Union

from pydantic import BaseModel, ConfigDict, PositiveInt, TypeAdapter, model_validator
from typing_extensions import Self
Expand Down Expand Up @@ -231,7 +231,7 @@ def _merge_chunks_with_matching_metadata(self, chunks: list[DocChunk]):

return output_chunks

def chunk(self, dl_doc: DoclingDocument, **kwargs) -> Iterator[BaseChunk]:
def chunk(self, dl_doc: DoclingDocument, **kwargs: Any) -> Iterator[BaseChunk]:
r"""Chunk the provided document.
Args:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ module = [
"jsonref.*",
"jsonschema.*",
"requests.*",
"semchunk.*",
"tabulate.*",
"transformers.*",
"yaml.*",
Expand Down

0 comments on commit f10b228

Please sign in to comment.