Ë
    µŒjD  ã                  óÀ   — d dl mZ d dlZd dlmZmZ d dlZd dlZd dlm	Z	m
Z
 d dlmZ d dlmZ  G d„ de«      Z G d	„ d
e«      Zdd„Z G d„ de«      Z G d„ de«      Zy)é    )ÚannotationsN)ÚOptionalÚType)ÚAsyncCallbackManagerForToolRunÚCallbackManagerForToolRun)ÚBaseTool)Ú	BaseModelc                  ó4   — e Zd ZU dZded<   ded<   dZded<   y)	Ú	ApiConfigzAPI Configuration.ÚstrÚtypeÚurlFzOptional[bool]Úhas_user_authenticationN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   © ó    új/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/langchain_community/tools/plugin.pyr   r      s   … Ùà
ƒIØ	ƒHØ.3Ð˜^Ô3r   r   c                  óŒ   — e Zd ZU dZded<   ded<   ded<   ded<   ded<   dZd	ed
<   ded<   ded<   ded<   ded<   edd„«       Zy)ÚAIPluginzAI Plugin Definition.r   Úschema_versionÚname_for_modelÚname_for_humanÚdescription_for_modelÚdescription_for_humanNzOptional[dict]Úauthr   ÚapiúOptional[str]Úlogo_urlÚcontact_emailÚlegal_info_urlc                óX   — t        j                  |«      j                  «       } | di |¤ŽS )z Instantiate AIPlugin from a URL.r   )ÚrequestsÚgetÚjson)Úclsr   Úresponses      r   Úfrom_urlzAIPlugin.from_url&   s'   € ô —<‘< Ó$×)Ñ)Ó+ˆÙ‰�X‰Ðr   )r   r   Úreturnr   )r   r   r   r   r   r   Úclassmethodr+   r   r   r   r   r      sV   … ÙàÓØÓØÓØÓØÓØ€Dˆ.ÓØ	ƒNØÓØ Ó Ø!Ó!àòó ñr   r   c                óŠ   — 	 t        j                  | «      S # t         j                  $ r t        j                  | «      cY S w xY w)z¢Convert the yaml or json serialized spec to a dict.

    Args:
        txt: The yaml or json serialized spec.

    Returns:
        dict: The spec as a dict.
    )r(   ÚloadsÚJSONDecodeErrorÚyamlÚ	safe_load)Útxts    r   Úmarshal_specr4   -   s9   € ð#Ü�z‰z˜#‹ÐøÜ×Ñò #Ü�~‰~˜cÓ"Ò"ð#ús   ‚ —(AÁAc                  ó    — e Zd ZU dZdZded<   y)ÚAIPluginToolSchemazSchema for AIPluginTool.Ú r!   Ú
tool_inputN)r   r   r   r   r8   r   r   r   r   r6   r6   <   s   … Ù"à "€J�Ô"r   r6   c                  óv   — e Zd ZU dZded<   ded<   eZded<   edd„«       Z	 	 d	 	 	 	 	 dd
„Z		 	 d	 	 	 	 	 dd„Z
y	)ÚAIPluginToolz3Tool for getting the OpenAPI spec for an AI Plugin.r   Úpluginr   Úapi_speczType[AIPluginToolSchema]Úargs_schemac                óL  — t         j                  |«      }d|j                  › d|j                  › d�|j                  z   }t	        j
                  |j                  j                  «      j                  }t        |«      }d|j                  › d|› �} | |j                  |||¬«      S )NzRCall this tool to get the OpenAPI spec (and usage guide) for interacting with the z2 API. You should only call this ONCE! What is the z API useful for? zUsage Guide: z

OpenAPI Spec: )ÚnameÚdescriptionr;   r<   )r   r+   r   r   r&   r'   r    r   Útextr4   r   r   )r)   r   r;   r@   Úopen_api_spec_strÚopen_api_specr<   s          r   Úfrom_plugin_urlzAIPluginTool.from_plugin_urlI   s»   € ä×"Ñ" 3Ó'ˆð(Ø(.×(=Ñ(=Ð'>ð ?;à×$Ñ$Ð%Ð%6ð8ð ×(Ñ(ñ)ˆô %ŸL™L¨¯©¯©Ó8×=Ñ=ÐÜ$Ð%6Ó7ˆà˜F×8Ñ8Ð9ð :Ø*˜Oð-ð 	ñ
 Ø×&Ñ&Ø#ØØô	
ð 	
r   Nc                ó   — | j                   S )zUse the tool.©r<   ©Úselfr8   Úrun_managers      r   Ú_runzAIPluginTool._run`   s   € ð �}‰}Ðr   c              ƒ  ó"   K  — | j                   S ­w)zUse the tool asynchronously.rF   rG   s      r   Ú_arunzAIPluginTool._arunh   s   è ø€ ð �}‰}Ðùs   ‚)r   r   r,   r:   )r7   N)r8   r!   rI   z#Optional[CallbackManagerForToolRun]r,   r   )NN)r8   r!   rI   z(Optional[AsyncCallbackManagerForToolRun]r,   r   )r   r   r   r   r   r6   r=   r-   rD   rJ   rL   r   r   r   r:   r:   B   s   … Ù=àÓØƒMØ,>€KÐ)Ó>àò
ó ð
ð0 %'Ø;?ðà!ðð 9ðð 
ó	ð %)Ø@Dðà!ðð >ðð 
ô	r   r:   )r3   r   r,   Údict)Ú
__future__r   r(   Útypingr   r   r&   r1   Úlangchain_core.callbacksr   r   Úlangchain_core.toolsr   Úpydanticr	   r   r   r4   r6   r:   r   r   r   Ú<module>rS      sV   ðÝ "ã ß !ã Û ÷õ *Ý ô4�	ô 4ôˆyô ó*#ô#˜ô #ô,�8õ ,r   