§
    šŠtjw$  ã                   óª   — 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dS )é    )Ú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dS )Ú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                 óf  — 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
<   n# t          $ r t          d¦  «        ‚w xY w|S )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	            úa/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langchain_community/utilities/apify.pyÚvalidate_environmentz!ApifyWrapper.validate_environment!   s+  € õ /ØÐ%Ð'8ñ
ô 
ˆð	ØBÐBÐBÐBÐBÐBÐBÐBà �[ Ñ1Ô1ˆFÝ& vÔ'9¸>ÑJÔJÐJˆ|ð KØÔ$ \Ð2Ð2Ô2Ð6JÑJÐ2Ð2Ñ2à+Ð+¨OÑ<Ô<ˆLÝ%,ØÔ(Ð*>ñ&ô &ð Ð!ð Qð #Ô*¨<Ð8Ð8Ô8Ð<PÑPÐ8Ð8Ñ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                             |¦  «                             ||||¬¦  «        } ||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   sv   € ð4 	LÐKÐKÐKÐKÐKàÔ&×,Ò,¨XÑ6Ô6×;Ò;ØØØ'Ø%ð	 <ñ 
ô 
ˆ
ð "Ð!Ø!Ð"4Ô5Ø%=ð
ñ 
ô 
ð 	
ó    c             ƒ   ó¦   K  — ddl m} | j                             |¦  «                             ||||¬¦  «        ƒ d{V —†} ||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   r1   Nr2   r3   )r5   r   r   r6   r7   r8   s	            r(   Úacall_actorzApifyWrapper.acall_actork   s™   è è € ð4 	LÐKÐKÐKÐKÐKàÔ2×8Ò8¸ÑBÔB×GÒGØØØ'Ø%ð	 Hñ 
ô 
ð 
ð 
ð 
ð 
ð 
ð 
ˆ
ð "Ð!Ø!Ð"4Ô5Ø%=ð
ñ 
ô 
ð 	
r<   Útask_idÚ
task_inputc                ó–   — ddl m} | 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   ©r@   r*   r+   r,   r2   r3   )r5   r   r   Útaskr7   ©	r9   r?   r@   r/   r*   r+   r,   r   Ú	task_calls	            r(   Úcall_actor_taskzApifyWrapper.call_actor_task“   sv   € ð6 	LÐKÐKÐKÐKÐKàÔ%×*Ò*¨7Ñ3Ô3×8Ò8Ø!ØØ'Ø%ð	 9ñ 
ô 
ˆ	ð "Ð!Ø Ð!3Ô4Ø%=ð
ñ 
ô 
ð 	
r<   c             ƒ   ó¦   K  — ddl m} | j                             |¦  «                             ||||¬¦  «        ƒ d{V —†} ||d         |¬¦  «        S )rB   r   r   rC   Nr2   r3   )r5   r   r   rD   r7   rE   s	            r(   Úacall_actor_taskzApifyWrapper.acall_actor_task¼   s™   è è € ð6 	LÐKÐKÐKÐKÐKàÔ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>   rG   rI   © 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   rR   r<   r(   ú<module>rX      s  ðØ ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?à *Ð *Ð *Ð *Ð *Ð *Ø -Ð -Ð -Ð -Ð -Ð -Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø /Ð /Ð /Ð /Ð /Ð /Ð /Ð /àð HØGÐGÐGÐGÐGÐGð €Ø
ð	9ð
 6ð	ñ 	ô 	ðM
ð M
ð M
ð M
ð M
�9ñ M
ô M
ñ	ô 	ðM
ð M
ð M
r<   