Ë
    ´Œj6  ã                   ó¦  — d Z ddlZddlZddlmZ ddlmZmZmZ ddl	Z	ddl
mZ ddlmZ ddlmZ ddlmZmZ dd	lmZ dd
lmZmZ  ej0                  e«      ZdZdededee   dedeeef   f
d„Z edd¬«      	 	 ddedee   deee      dedeeef   f
d„«       Z edd¬«      dee ef   dedeeef   fd„«       Z!dee ef   dedeeef   fd„Z"y)z!Functionality for loading agents.é    N)ÚPath)ÚAnyÚOptionalÚUnion)Ú
deprecated)ÚBaseLanguageModel)ÚTool)ÚBaseMultiActionAgentÚBaseSingleActionAgent)ÚAGENT_TO_CLASS)Ú
load_chainÚload_chain_from_configzHhttps://raw.githubusercontent.com/hwchase17/langchain-hub/master/agents/ÚconfigÚllmÚtoolsÚkwargsÚreturnc                 óœ   — | j                  d«      }|t        vrd|› d�}t        |«      ‚t        |   }i | ¥|¥} |j                  ||fi |¤ŽS )NÚ_typeúLoading ú agent not supported)Úpopr   Ú
ValueErrorÚfrom_llm_and_tools)r   r   r   r   Úconfig_typeÚmsgÚ	agent_clsÚcombined_configs           úb/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/langchain/agents/loading.pyÚ_load_agent_from_toolsr       sf   € ð —*‘*˜WÓ%€KØœ.Ñ(Ø˜˜Ð%9Ð:ˆÜ˜‹oÐä˜{Ñ+€IØ*˜Ð* 6Ð*€OØ'ˆ9×'Ñ'¨¨UÑF°oÑFÐFó    z0.1.0z1.0)Úremovalc                 ó   — d| vrd}t        |«      ‚| j                  dd«      }|r,|€d}t        |«      ‚|€d}t        |«      ‚t        | ||fi |¤ŽS | j                  d«      }|t        vrd|› d�}t        |«      ‚t        |   }d	| v rt	        | j                  d	«      «      | d	<   n/d
| v rt        | j                  d
«      «      | d	<   nd}t        |«      ‚d| v rt        j                  d«       | d= i | ¥|¥} |di |¤ŽS )a‡  Load agent from Config Dict.

    Args:
        config: Config dict to load agent from.
        llm: Language model to use as the agent.
        tools: List of tools this agent has access to.
        kwargs: Additional keyword arguments passed to the agent executor.

    Returns:
        An agent executor.

    Raises:
        ValueError: If agent type is not specified in the config.
    r   z$Must specify an agent Type in configÚload_from_llm_and_toolsFzFIf `load_from_llm_and_tools` is set to True, then LLM must be providedzHIf `load_from_llm_and_tools` is set to True, then tools must be providedr   r   Ú	llm_chainÚllm_chain_pathz<One of `llm_chain` and `llm_chain_path` should be specified.Úoutput_parserzZCurrently loading output parsers on agent is not supported, will just use the default one.© )r   r   r    r   r   r   ÚloggerÚwarning)	r   r   r   r   r   Úload_from_toolsr   r   r   s	            r   Úload_agent_from_configr,   &   s@  € ð* �fÑØ4ˆÜ˜‹oÐØ—j‘jÐ!:¸EÓB€OÙØˆ;àXð ô ˜S“/Ð!Øˆ=ð.ð ô ˜S“/Ð!Ü% f¨c°5ÑC¸FÑCÐCØ—*‘*˜WÓ%€Kàœ.Ñ(Ø˜˜Ð%9Ð:ˆÜ˜‹oÐä˜{Ñ+€IØ�fÑÜ4°V·Z±ZÀÓ5LÓMˆˆ{ÒØ	˜VÑ	#Ü(¨¯©Ð4DÓ)EÓFˆˆ{ÒàLˆÜ˜‹oÐØ˜&Ñ Ü�‰ð-ô	
ð �?Ð#à*˜Ð* 6Ð*€OÙÑ'�Ñ'Ð'r!   Úpathc                 óv   — t        | t        «      r| j                  d«      rd}t        |«      ‚t	        | fi |¤ŽS )aY  Unified method for loading an agent from LangChainHub or local fs.

    Args:
        path: Path to the agent file.
        kwargs: Additional keyword arguments passed to the agent executor.

    Returns:
        An agent executor.

    Raises:
        RuntimeError: If loading from the deprecated github-based
            Hub is attempted.
    zlc://z‘Loading from the deprecated github-based Hub is no longer supported. Please use the new LangChain Hub at https://smith.langchain.com/hub instead.)Ú
isinstanceÚstrÚ
startswithÚRuntimeErrorÚ_load_agent_from_file)r-   r   r   s      r   Ú
load_agentr4   e   s@   € ô$ �$œÔ §¡°Ô!9ðð 	ô
 ˜3ÓÐÜ  Ñ0¨Ñ0Ð0r!   Úfilec                 ó²  — ddh}t        | t        «      rt        | «      n| }|j                  dd dk(  r/|j	                  «       5 }t        j                  |«      }ddd«       nR|j                  dd dk(  r/|j	                  «       5 }t        j                  |«      }ddd«       nd|› d�}t        |«      ‚t        fi |¤ŽS # 1 sw Y   ŒxY w# 1 sw Y   Œ!xY w)zLoad agent from file.ÚjsonÚyamlé   Nz&Unsupported file type, must be one of Ú.)r/   r0   r   ÚsuffixÚopenr7   Úloadr8   Ú	safe_loadr   r,   )r5   r   Úvalid_suffixesÚ	file_pathÚfr   r   s          r   r3   r3   �   sÌ   € ð
 ˜fÐ%€Nä(¨¬sÔ3”�T”
¸€Ià×Ñ˜˜Ð˜vÒ%Ø�^‰^Ô Ü—Y‘Y˜q“\ˆF÷ Ðà	×	Ñ	˜!˜"Ð	 Ò	'Ø�^‰^Ô Ü—^‘^ AÓ&ˆF÷ Ðð 7°~Ð6FÀaÐHˆÜ˜‹oÐä! &Ñ3¨FÑ3Ð3÷ Ðú÷ Ðús   ÁCÂCÃC
ÃC)NN)#Ú__doc__r7   ÚloggingÚpathlibr   Útypingr   r   r   r8   Úlangchain_core._apir   Úlangchain_core.language_modelsr   Úlangchain_core.toolsr	   Úlangchain.agents.agentr
   r   Úlangchain.agents.typesr   Úlangchain.chains.loadingr   r   Ú	getLoggerÚ__file__r)   ÚURL_BASEÚdictÚlistr    r,   r0   r4   r3   r(   r!   r   Ú<module>rQ      sw  ðÙ 'ã Û Ý ß 'Ñ 'ã Ý *Ý <Ý %ç NÝ 1ß Gà	ˆ×	Ñ	˜8Ó	$€àU€ðGØðGà	ðGð �‰:ðGð ð	Gð
 Ð Ð"6Ð6Ñ7óGñ  ˆG˜UÔ#ð (,Ø"&ñ;(Øð;(à	Ð#Ñ	$ð;(ð �D˜‘JÑð;(ð ð	;(ð
 Ð Ð"6Ð6Ñ7ò;(ó $ð;(ñ| ˆG˜UÔ#ð1Ø
��T�	Ñ
ð1àð1ð Ð Ð"6Ð6Ñ7ò1ó $ð1ð64Ø
��T�	Ñ
ð4àð4ð Ð Ð"6Ð6Ñ7ô4r!   