o
    «©Zhç  ã                   @   sV   d dl mZmZ dedeeef defdd„Zdedefdd„Zd	edefd
d„ZdS )é    )ÚAnyÚDictÚschemaÚdefinitionsÚreturnc                 C   s’   t | tƒrt| ƒD ]\}}t||ƒ| |< q	| S t | tƒrGd| v r7|  d¡ d¡d }| |i ¡}|  |¡ | S |  	¡ D ]\}}t||ƒ| |< q;| S )zW
    Resolve the $ref keys in a JSON schema object using the provided definitions.
    z$refú/éÿÿÿÿ)
Ú
isinstanceÚlistÚ	enumerateÚ_resolve_schema_referencesÚdictÚpopÚsplitÚgetÚupdateÚitems)r   r   ÚiÚitemZref_keyÚrefÚkeyÚvalue© r   ú^/var/www/html/lang_env/lib/python3.10/site-packages/langchain/chains/openai_functions/utils.pyr      s   
	
ø
þr   c                 C   s*   dd„ | d   ¡ D ƒ}d||  dg ¡dœS )Nc                 S   s   i | ]\}}|d |i|¥“qS )Útitler   )Ú.0ÚkÚvr   r   r   Ú
<dictcomp>   s    z#_convert_schema.<locals>.<dictcomp>Ú
propertiesÚobjectÚrequired)Útyper   r!   )r   r   )r   Úpropsr   r   r   Ú_convert_schema   s
   
ýr$   Úfunctionc                 C   s   | gd| d idœS )z¥Return the kwargs for the LLMChain constructor.

    Args:
        function: The function to use.

    Returns:
        The kwargs for the LLMChain constructor.
    Úname)Z	functionsZfunction_callr   )r%   r   r   r   Úget_llm_kwargs   s   	r'   N)Útypingr   r   Ústrr   r   r$   r'   r   r   r   r   Ú<module>   s    	