# This file was auto-generated by Fern from our API Definition.

from ..core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from .llm import Llm
from .node_parser import NodeParser
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class MarkdownElementNodeParser(UniversalBaseModel):
    """
    Markdown element node parser.

    Splits a markdown document into Text Nodes and Index Nodes corresponding to embedded objects
    (e.g. tables).
    """

    include_metadata: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether or not to consider metadata when splitting.
    """

    include_prev_next_rel: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Include prev/next node relationships.
    """

    callback_manager: typing.Optional[typing.Optional[typing.Any]] = None
    id_func: typing.Optional[str] = pydantic.Field(default=None)
    """
    Function to generate node IDs.
    """

    llm: typing.Optional[Llm] = pydantic.Field(default=None)
    """
    LLM model to use for summarization.
    """

    summary_query_str: typing.Optional[str] = pydantic.Field(default=None)
    """
    Query string to use for summarization.
    """

    num_workers: typing.Optional[int] = pydantic.Field(default=None)
    """
    Num of workers for async jobs.
    """

    show_progress: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether to show progress.
    """

    nested_node_parser: typing.Optional[NodeParser] = pydantic.Field(default=None)
    """
    Other types of node parsers to handle some types of nodes.
    """

    class_name: typing.Optional[str] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
