
    Ng                     V    d dl mZmZ d dlmZ d dlmZ d dlmZ  G d de          Z	dS )    )IteratorOptional)Document)
BaseLoader)WikipediaAPIWrapperc                   t    e Zd ZdZ	 	 	 	 ddededee         d	ee         d
ee         f
dZde	e
         fdZdS )WikipediaLoaderzLoad from `Wikipedia`.

    The hard limit on the length of the query is 300 for now.

    Each wiki page represents one Document.
    en   F  querylangload_max_docsload_all_available_metadoc_content_chars_maxc                 L    || _         || _        || _        || _        || _        dS )a  
        Initializes a new instance of the WikipediaLoader class.

        Args:
            query (str): The query string to search on Wikipedia.
            lang (str, optional): The language code for the Wikipedia language edition.
                Defaults to "en".
            load_max_docs (int, optional): The maximum number of documents to load.
                Defaults to 100.
            load_all_available_meta (bool, optional): Indicates whether to load all
                available metadata for each document. Defaults to False.
            doc_content_chars_max (int, optional): The maximum number of characters
                for the document content. Defaults to 4000.
        N)r   r   r   r   r   )selfr   r   r   r   r   s         j/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/document_loaders/wikipedia.py__init__zWikipediaLoader.__init__   s0    , 
	*'>$%:"""    returnc              #      K   t          | j        | j        | j        | j                  }|                    | j                  E d{V  dS )z
        Loads the query result from Wikipedia into a list of Documents.

        Returns:
            A list of Document objects representing the loaded
                Wikipedia pages.
        )r   top_k_resultsr   r   N)r   r   r   r   r   loadr   )r   clients     r   	lazy_loadzWikipediaLoader.lazy_load-   sa       %,$($@"&"<	
 
 
 ;;tz***********r   N)r
   r   Fr   )__name__
__module____qualname____doc__strr   intboolr   r   r   r    r   r   r	   r	   	   s          ')27/3; ;; ;  }	;
 "*$;  (}; ; ; ;8+8H- + + + + + +r   r	   N)
typingr   r   langchain_core.documentsr   )langchain_community.document_loaders.baser   'langchain_community.utilities.wikipediar   r	   r$   r   r   <module>r)      s    % % % % % % % % - - - - - - @ @ @ @ @ @ G G G G G G2+ 2+ 2+ 2+ 2+j 2+ 2+ 2+ 2+ 2+r   