
    NgJ                     R    d dl mZ d dlmZmZmZ d dlmZmZ  G d de          Z	dS )    )Path)AnyListUnion)UnstructuredFileLoadervalidate_unstructured_versionc                   P     e Zd ZdZ	 d	deeef         dedef fdZde	fdZ
 xZS )
UnstructuredODTLoadera"  Load `OpenOffice ODT` files using `Unstructured`.

    You can run the loader in one of two modes: "single" and "elements".
    If you use "single" mode, the document will be returned as a single
    langchain Document object. If you use "elements" mode, the unstructured
    library will split the document into elements such as Title and NarrativeText.
    You can pass in additional unstructured kwargs after mode to apply
    different unstructured settings.

    Examples
    --------
    from langchain_community.document_loaders import UnstructuredODTLoader

    loader = UnstructuredODTLoader(
        "example.odt", mode="elements", strategy="fast",
    )
    docs = loader.load()

    References
    ----------
    https://unstructured-io.github.io/unstructured/bricks.html#partition-odt
    single	file_pathmodeunstructured_kwargsc                 `    t          d            t                      j        d||d| dS )a!  

        Args:
            file_path: The path to the file to load.
            mode: The mode to use when loading the file. Can be one of "single",
                "multi", or "all". Default is "single".
            **unstructured_kwargs: Any kwargs to pass to the unstructured.
        z0.6.3)min_unstructured_version)r   r   N )r   super__init__)selfr   r   r   	__class__s       d/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/document_loaders/odt.pyr   zUnstructuredODTLoader.__init__"   sA     	&wGGGGO94OO;NOOOOO    returnc                 6    ddl m}  |dd| j        i| j        S )Nr   )partition_odtfilenamer   )unstructured.partition.odtr   r   r   )r   r   s     r   _get_elementsz#UnstructuredODTLoader._get_elements3   s4    <<<<<<}QQdnQ8PQQQr   )r   )__name__
__module____qualname____doc__r   strr   r   r   r   r   __classcell__)r   s   @r   r
   r
   
   s         4 P Pd#P P  #	P P P P P P"Rt R R R R R R R Rr   r
   N)
pathlibr   typingr   r   r   1langchain_community.document_loaders.unstructuredr   r   r
   r   r   r   <module>r'      s          # # # # # # # # # #       ,R ,R ,R ,R ,R2 ,R ,R ,R ,R ,Rr   