Home / Function/ _complete_chunk_doc() — langchain Function Reference

_complete_chunk_doc() — langchain Function Reference

Architecture documentation for the _complete_chunk_doc() function in markdown.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  b10a7aa1_da71_adf1_c53e_7aa30fa1d45c["_complete_chunk_doc()"]
  cd7394a9_9856_dc15_cb00_078cf42f0529["ExperimentalMarkdownSyntaxTextSplitter"]
  b10a7aa1_da71_adf1_c53e_7aa30fa1d45c -->|defined in| cd7394a9_9856_dc15_cb00_078cf42f0529
  ca4b44a0_217b_9ee3_738c_a86f47cf5d13["split_text()"]
  ca4b44a0_217b_9ee3_738c_a86f47cf5d13 -->|calls| b10a7aa1_da71_adf1_c53e_7aa30fa1d45c
  style b10a7aa1_da71_adf1_c53e_7aa30fa1d45c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/text-splitters/langchain_text_splitters/markdown.py lines 451–461

    def _complete_chunk_doc(self) -> None:
        chunk_content = self.current_chunk.page_content
        # Discard any empty documents
        if chunk_content and not chunk_content.isspace():
            # Apply the header stack as metadata
            for depth, value in self.current_header_stack:
                header_key = self.splittable_headers.get("#" * depth)
                self.current_chunk.metadata[header_key] = value
            self.chunks.append(self.current_chunk)
        # Reset the current chunk
        self.current_chunk = Document(page_content="")

Subdomains

Called By

Frequently Asked Questions

What does _complete_chunk_doc() do?
_complete_chunk_doc() is a function in the langchain codebase, defined in libs/text-splitters/langchain_text_splitters/markdown.py.
Where is _complete_chunk_doc() defined?
_complete_chunk_doc() is defined in libs/text-splitters/langchain_text_splitters/markdown.py at line 451.
What calls _complete_chunk_doc()?
_complete_chunk_doc() is called by 1 function(s): split_text.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free