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

import typing_extensions
from ..core.serialization import FieldMetadata
from ..types.parse_config_engine import ParseConfigEngine
from ..types.parse_config_target import ParseConfigTarget
from .parse_config_advanced_options import ParseConfigAdvancedOptionsParams
from .parse_config_block_options import ParseConfigBlockOptionsParams
from .parse_config_chunking_strategy import ParseConfigChunkingStrategyParams


class ParseConfigParams(typing_extensions.TypedDict):
    """
    Configuration options for the parsing process. Defaults depend on the selected parser engine and version.
    """

    target: typing_extensions.NotRequired[ParseConfigTarget]
    """
    The target format for the parsed content.
    
    Supported values:
    
    * `markdown`: True markdown with logical reading order (headings, lists, tables, checkboxes). Best default for LLMs/RAG and enables section-based chunking.
    * `spatial`: Layout/position-preserving text that uses markdown elements for block types but is not strictly markdown due to whitespace/tabs used to maintain placement. Only page-based chunking is supported.
    
    Guidance:
    
    * Prefer `markdown` for most documents, multi-column reading order, and retrieval use cases
    * Prefer `spatial` for messy/scanned/handwritten or skewed documents, when you need near 1:1 layout fidelity, or for BOL-like logistics docs
    
    See “Markdown vs Spatial” in the [Parse guide](https://docs.extend.ai/2026-02-09/product/parsing/configuration-options#target-format) for details.
    """

    chunking_strategy: typing_extensions.NotRequired[
        typing_extensions.Annotated[ParseConfigChunkingStrategyParams, FieldMetadata(alias="chunkingStrategy")]
    ]
    """
    Strategy for dividing the document into chunks.
    """

    engine: typing_extensions.NotRequired[ParseConfigEngine]
    """
    The parsing engine to use. Supported values:
    * `parse_performance`: Full-featured parsing engine with highest accuracy (default)
    * `parse_light`: Lightweight parsing engine optimized for speed. This does not have robust layout support and does not support markdown layout target.
    """

    engine_version: typing_extensions.NotRequired[
        typing_extensions.Annotated[str, FieldMetadata(alias="engineVersion")]
    ]
    """
    Pin a specific parser engine version for reproducibility. When set to `latest`, the most recent stable version of the selected engine is used.
    """

    block_options: typing_extensions.NotRequired[
        typing_extensions.Annotated[ParseConfigBlockOptionsParams, FieldMetadata(alias="blockOptions")]
    ]
    """
    Options for controlling how different block types are processed.
    """

    advanced_options: typing_extensions.NotRequired[
        typing_extensions.Annotated[ParseConfigAdvancedOptionsParams, FieldMetadata(alias="advancedOptions")]
    ]
