a
    ”˜ëj2  ã                   @  sj   d Z ddlmZ ddlmZ ddlmZ ddlmZ ee	e ge
f Zdddœd	d
„Zdddœdd„ZdS )zUtilities to render tools.é    )Úannotations)Ú	signature)ÚCallable)ÚBaseToolzlist[BaseTool]Ústr)ÚtoolsÚreturnc                 C  sf   g }| D ]R}t |dƒr>|jr>t|jƒ}|j› |› d|j› �}n|j› d|j› �}| |¡ qd |¡S )a1  Render the tool name and description in plain text.

    Args:
        tools: The tools to render.

    Returns:
        The rendered text.

    Output will be in the format of:

    .. code-block:: markdown

        search: This tool is used for search
        calculator: This tool is used for math
    Úfuncú - Ú
)Úhasattrr	   r   ÚnameÚdescriptionÚappendÚjoin)r   ZdescriptionsÚtoolÚsigr   © r   úZ/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/langchain_core/tools/render.pyÚrender_text_description   s    
r   c                 C  sz   g }| D ]f}t |jƒ}t|dƒrH|jrHt|jƒ}|j› |› d|j› �}n|j› d|j› �}| |› d|› �¡ qd |¡S )a‡  Render the tool name, description, and args in plain text.

    Args:
        tools: The tools to render.

    Returns:
        The rendered text.

    Output will be in the format of:

    .. code-block:: markdown

        search: This tool is used for search, args: {"query": {"type": "string"}}
        calculator: This tool is used for math, args: {"expression": {"type": "string"}}
    r	   r
   z, args: r   )	r   Úargsr   r	   r   r   r   r   r   )r   Ztool_stringsr   Zargs_schemar   r   r   r   r   Ú render_text_description_and_args)   s    

r   N)Ú__doc__Ú
__future__r   Úinspectr   Útypingr   Zlangchain_core.tools.baser   Úlistr   ZToolsRendererr   r   r   r   r   r   Ú<module>   s   