Ë
    µŒj   ã                   ó„   — d dl mZmZmZmZ d dlmZ d dlmZ d dl	m
Z
mZ d dlmZ  eddd¬	«       G d
„ dee
«      «       Zy)é    )ÚAnyÚCallableÚDictÚList)Ú
deprecated)ÚDocument)Ú	BaseModelÚmodel_validator)Ú
BaseLoaderz0.3.18zÌThis class is deprecated and will be removed in a future version. You can swap to using the `ApifyDatasetLoader` implementation in `langchain_apify` package. See <https://github.com/apify/langchain-apify>z"langchain_apify.ApifyDatasetLoader)ÚsinceÚmessageÚalternative_importc                   ó®   ‡ — e Zd ZU dZeed<   	 eed<   	 eege	f   ed<   	 dedeege	f   fˆ fd„Z
 ed¬«      eded	efd
„«       «       Zd	ee	   fd„Zˆ xZS )ÚApifyDatasetLoadera¡  Load datasets from `Apify` web scraping, crawling, and data extraction platform.

    For details, see https://docs.apify.com/platform/integrations/langchain

    Example:
        .. code-block:: python

            from langchain_community.document_loaders import ApifyDatasetLoader
            from langchain_core.documents import Document

            loader = ApifyDatasetLoader(
                dataset_id="YOUR-DATASET-ID",
                dataset_mapping_function=lambda dataset_item: Document(
                    page_content=dataset_item["text"], metadata={"source": dataset_item["url"]}
                ),
            )
            documents = loader.load()
    Úapify_clientÚ
dataset_idÚdataset_mapping_functionc                 ó(   •— t         ‰| �  ||¬«       y)ar  Initialize the loader with an Apify dataset ID and a mapping function.

        Args:
            dataset_id (str): The ID of the dataset on the Apify platform.
            dataset_mapping_function (Callable): A function that takes a single
                dictionary (an Apify dataset item) and converts it to an instance
                of the Document class.
        )r   r   N)ÚsuperÚ__init__)Úselfr   r   Ú	__class__s      €ú|/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/langchain_community/document_loaders/apify_dataset.pyr   zApifyDatasetLoader.__init__0   s   ø€ ô 	‰ÑØ!Ð<Tð 	õ 	
ó    Úbefore)ÚmodeÚvaluesÚreturnc                 óº   — 	 ddl m}  |«       }t        |j                  d«      x}r|j                  dxx   dz  cc<   ||d<   |S # t
        $ r t        d«      ‚w xY w)zYValidate environment.

        Args:
            values: The values to validate.
        r   )ÚApifyClientÚhttpx_clientz
user-agentz; Origin/langchainr   z`Could not import apify-client Python package. Please install it with `pip install apify-client`.)r   r    ÚgetattrÚhttp_clientÚheadersÚImportError)Úclsr   r    Úclientr!   s        r   Úvalidate_environmentz'ApifyDatasetLoader.validate_environment?   su   € ð	Ý0á “]ˆFÜ& v×'9Ñ'9¸>ÓJÐJˆ|ÐJØ×$Ñ$ \Ó2Ð6JÑJÓ2à%+ˆF�>Ñ"ð ˆøô ò 	ÜðEóð ð	ús   ‚AA ÁAc                 ó¾   — | j                   j                  | j                  «      j                  d¬«      j                  }t        t        | j                  |«      «      S )zLoad documents.T)Úclean)r   Údatasetr   Ú
list_itemsÚitemsÚlistÚmapr   )r   Údataset_itemss     r   ÚloadzApifyDatasetLoader.loadX   sO   € ð ×Ñ×%Ñ% d§o¡oÓ6×AÑAÈÐAÓM×SÑSð 	ô ”C˜×5Ñ5°}ÓEÓFÐFr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__Ústrr   r   r   r   r
   Úclassmethodr(   r   r1   Ú__classcell__)r   s   @r   r   r   
   s”   ø… ñð& ÓØTØƒOØ6Ø&¨ v¨xÐ'7Ñ8Ó8ð>ð
Øð
Ø9AÀ4À&È(ÐBRÑ9Sõ
ñ ˜(Ô#Øð¨$ð °3ò ó ó $ðð.G�d˜8‘n÷ Gr   r   N)Útypingr   r   r   r   Úlangchain_core._apir   Úlangchain_core.documentsr   Úpydanticr	   r
   Ú)langchain_community.document_loaders.baser   r   © r   r   Ú<module>r@      sL   ðß ,Ó ,å *Ý -ß /å @ñ Ø
ð	9ð
 <ô	ôIG˜ Yó IGó	ñIGr   