Ë
    µŒjw$  ã                   ó–   — d dl mZmZmZmZmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZmZ erd dlmZ  eddd	¬
«       G d„ de«      «       Zy)é    )ÚTYPE_CHECKINGÚAnyÚCallableÚDictÚOptional)Ú
deprecated)ÚDocument)Úget_from_dict_or_env)Ú	BaseModelÚmodel_validator©ÚApifyDatasetLoaderz0.3.18zÆThis class is deprecated and will be removed in a future version. You can swap to using the `ApifyWrapper` implementation in `langchain_apify` package. See <https://github.com/apify/langchain-apify>zlangchain_apify.ApifyWrapper)ÚsinceÚmessageÚalternative_importc                   óœ  — e Zd ZU dZeed<   eed<   dZee   ed<    e	d¬«      e
ded	efd
„«       «       Zddddœdededeegef   dee   dee   dee   d	dfd„Zddddœdededeegef   dee   dee   dee   d	dfd„Zddddœdededeegef   dee   dee   dee   d	dfd„Zddddœdededeegef   dee   dee   dee   d	dfd„Zy)ÚApifyWrapperzøWrapper around Apify.
    To use, you should have the ``apify-client`` python package installed,
    and the environment variable ``APIFY_API_TOKEN`` set with your API key, or pass
    `apify_api_token` as a named parameter to the constructor.
    Úapify_clientÚapify_client_asyncNÚapify_api_tokenÚbefore)ÚmodeÚvaluesÚreturnc                 óR  — t        |dd«      }	 ddlm}m}  ||«      }t	        |j
                  d«      x}r|j                  dxx   dz  cc<    ||«      }t	        |j
                  d«      x}r|j                  dxx   dz  cc<   ||d	<   ||d
<   |S # t        $ r t        d«      ‚w xY w)z�Validate environment.
        Validate that an Apify API token is set and the apify-client
        Python package exists in the current environment.
        r   ÚAPIFY_API_TOKENr   )ÚApifyClientÚApifyClientAsyncÚhttpx_clientz
user-agentz; Origin/langchainÚhttpx_async_clientr   r   z`Could not import apify-client Python package. Please install it with `pip install apify-client`.)r
   r   r   r   ÚgetattrÚhttp_clientÚheadersÚImportError)	Úclsr   r   r   r   Úclientr   Úasync_clientr    s	            úm/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/langchain_community/utilities/apify.pyÚvalidate_environmentz!ApifyWrapper.validate_environment!   sÜ   € ô /ØÐ%Ð'8ó
ˆð	ßBá  Ó1ˆFÜ& v×'9Ñ'9¸>ÓJÐJˆ|ÐJØ×$Ñ$ \Ó2Ð6JÑJÓ2á+¨OÓ<ˆLÜ%,Ø×(Ñ(Ð*>ó&ð Ð!ð ð #×*Ñ*¨<Ó8Ð<PÑPÓ8à%+ˆF�>Ñ"Ø+7ˆFÐ'Ñ(ð ˆøô ò 	ÜðEóð ð	ús   �B B ÂB&)ÚbuildÚmemory_mbytesÚtimeout_secsÚactor_idÚ	run_inputÚdataset_mapping_functionr*   r+   r,   r   c                ó„   — ddl m} | j                  j                  |«      j	                  ||||¬«      } ||d   |¬«      S )a¤  Run an Actor on the Apify platform and wait for results to be ready.
        Args:
            actor_id (str): The ID or name of the Actor on the Apify platform.
            run_input (Dict): The input object of the Actor that you're trying to run.
            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.
            build (str, optional): Optionally specifies the actor build to run.
                It can be either a build tag or build number.
            memory_mbytes (int, optional): Optional memory limit for the run,
                in megabytes.
            timeout_secs (int, optional): Optional timeout for the run, in seconds.
        Returns:
            ApifyDatasetLoader: A loader that will fetch the records from the
                Actor run's default dataset.
        r   r   ©r.   r*   r+   r,   ÚdefaultDatasetId©Ú
dataset_idr/   )Ú$langchain_community.document_loadersr   r   ÚactorÚcall©	Úselfr-   r.   r/   r*   r+   r,   r   Ú
actor_calls	            r(   Ú
call_actorzApifyWrapper.call_actorC   sU   € õ4 	Là×&Ñ&×,Ñ,¨XÓ6×;Ñ;ØØØ'Ø%ð	 <ó 
ˆ
ñ "Ø!Ð"4Ñ5Ø%=ô
ð 	
ó    c             ƒ   ó    K  — ddl m} | j                  j                  |«      j	                  ||||¬«      ƒ d{  –—† } ||d   |¬«      S 7 Œ­w)a¤  Run an Actor on the Apify platform and wait for results to be ready.
        Args:
            actor_id (str): The ID or name of the Actor on the Apify platform.
            run_input (Dict): The input object of the Actor that you're trying to run.
            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.
            build (str, optional): Optionally specifies the actor build to run.
                It can be either a build tag or build number.
            memory_mbytes (int, optional): Optional memory limit for the run,
                in megabytes.
            timeout_secs (int, optional): Optional timeout for the run, in seconds.
        Returns:
            ApifyDatasetLoader: A loader that will fetch the records from the
                Actor run's default dataset.
        r   r   r1   Nr2   r3   )r5   r   r   r6   r7   r8   s	            r(   Úacall_actorzApifyWrapper.acall_actork   sd   è ø€ õ4 	Là×2Ñ2×8Ñ8¸ÓB×GÑGØØØ'Ø%ð	 Hó 
÷ 
ˆ
ñ "Ø!Ð"4Ñ5Ø%=ô
ð 	
ð
úó   ‚8AºA»AÚtask_idÚ
task_inputc                ó„   — ddl m} | j                  j                  |«      j	                  ||||¬«      } ||d   |¬«      S )áÐ  Run a saved Actor task on Apify and wait for results to be ready.
        Args:
            task_id (str): The ID or name of the task on the Apify platform.
            task_input (Dict): The input object of the task that you're trying to run.
                Overrides the task's saved input.
            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.
            build (str, optional): Optionally specifies the actor build to run.
                It can be either a build tag or build number.
            memory_mbytes (int, optional): Optional memory limit for the run,
                in megabytes.
            timeout_secs (int, optional): Optional timeout for the run, in seconds.
        Returns:
            ApifyDatasetLoader: A loader that will fetch the records from the
                task run's default dataset.
        r   r   ©rA   r*   r+   r,   r2   r3   )r5   r   r   Útaskr7   ©	r9   r@   rA   r/   r*   r+   r,   r   Ú	task_calls	            r(   Úcall_actor_taskzApifyWrapper.call_actor_task“   sU   € õ6 	Là×%Ñ%×*Ñ*¨7Ó3×8Ñ8Ø!ØØ'Ø%ð	 9ó 
ˆ	ñ "Ø Ð!3Ñ4Ø%=ô
ð 	
r<   c             ƒ   ó    K  — ddl m} | j                  j                  |«      j	                  ||||¬«      ƒ d{  –—† } ||d   |¬«      S 7 Œ­w)rC   r   r   rD   Nr2   r3   )r5   r   r   rE   r7   rF   s	            r(   Úacall_actor_taskzApifyWrapper.acall_actor_task¼   sd   è ø€ õ6 	Là×1Ñ1×6Ñ6°wÓ?×DÑDØ!ØØ'Ø%ð	 Eó 
÷ 
ˆ	ñ "Ø Ð!3Ñ4Ø%=ô
ð 	
ð
úr?   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__r   r   Ústrr   Úclassmethodr   r)   r   r	   Úintr;   r>   rH   rJ   © r<   r(   r   r      s  … ñð ÓØÓØ%)€O�X˜c‘]Ó)á˜(Ô#Øð¨$ð °3ò ó ó $ððL  $Ø'+Ø&*ò&
àð&
ð ð&
ð #+¨D¨6°8Ð+;Ñ"<ð	&
ð ˜‰}ð&
ð   ‘}ð&
ð ˜s‘mð&
ð 
ó&
ð\  $Ø'+Ø&*ò&
àð&
ð ð&
ð #+¨D¨6°8Ð+;Ñ"<ð	&
ð ˜‰}ð&
ð   ‘}ð&
ð ˜s‘mð&
ð 
ó&
ð\  $Ø'+Ø&*ò'
àð'
ð ð'
ð #+¨D¨6°8Ð+;Ñ"<ð	'
ð ˜‰}ð'
ð   ‘}ð'
ð ˜s‘mð'
ð 
ó'
ð^  $Ø'+Ø&*ò'
àð'
ð ð'
ð #+¨D¨6°8Ð+;Ñ"<ð	'
ð ˜‰}ð'
ð   ‘}ð'
ð ˜s‘mð'
ð 
ô'
r<   r   N)Útypingr   r   r   r   r   Úlangchain_core._apir   Úlangchain_core.documentsr	   Úlangchain_core.utilsr
   Úpydanticr   r   r5   r   r   rS   r<   r(   Ú<module>rY      sM   ðß ?Õ ?å *Ý -Ý 5ß /áÝGñ Ø
ð	9ð
 6ô	ôM
�9ó M
ó	ñM
r<   