
    7|h	                         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 deddfd	Z	 dd
ee   deee      defdZ G d de	      Zy)    )AnyCallableListMappingOptional)CallbackManagerForLLMRun)LLM)Field)enforce_stop_tokenspromptreturnNc                      t        d|         y)z&Displays the given prompt to the user.
N)print)r   s    ]/var/www/html/test/engine/venv/lib/python3.12/site-packages/langchain_community/llms/human.py_display_promptr   
   s    	Bvh-    	separatorstopc                     | xs d} g }	 t               sn)|j                         |rt        fd|D              rn6| j                  |      }|S )z3Collects and returns user input as a single string.r   c              3   &   K   | ]  }|v  
 y wN ).0seqlines     r   	<genexpr>z&_collect_user_input.<locals>.<genexpr>   s     4t4s   )inputappendanyjoin)r   r   linesmulti_line_inputr   s       @r   _collect_user_inputr$      s_     !TIE
wTC4t44  !~~e,r   c                      e Zd ZU dZ ed       Zeed<    ed       Zee	gdf   ed<   dZ
e	ed	<   i Zee	ef   ed
<   i Zee	ef   ed<   edee	ef   fd       Zede	fd       Z	 	 dde	deee	      dee   dede	f
dZy)HumanInputLLMzUser input as the response.c                      t         S r   )r$   r   r   r   <lambda>zHumanInputLLM.<lambda>&   s    9L r   )default_factory
input_funcc                      t         S r   )r   r   r   r   r(   zHumanInputLLM.<lambda>'   s     r   Nprompt_funcr   r   input_kwargsprompt_kwargsr   c                     i S )zU
        Returns an empty dictionary as there are no identifying parameters.
        r   selfs    r   _identifying_paramsz!HumanInputLLM._identifying_params,   s	    
 	r   c                      y)zReturns the type of LLM.zhuman-inputr   r0   s    r   	_llm_typezHumanInputLLM._llm_type3   s     r   r   r   run_managerkwargsc                      | j                   |fi | j                    | j                  d| j                  |d| j                  }|t        ||      }|S )a~  
        Displays the prompt to the user and returns their input as a response.

        Args:
            prompt (str): The prompt to be displayed to the user.
            stop (Optional[List[str]]): A list of stop strings.
            run_manager (Optional[CallbackManagerForLLMRun]): Currently not used.

        Returns:
            str: The user's input as a response.
        )r   r   r   )r,   r.   r*   r   r-   r   )r1   r   r   r5   r6   
user_inputs         r   _callzHumanInputLLM._call8   sg    $ 	64#5#56$T__ 
nn4
373D3D

  -Z>Jr   NN)__name__
__module____qualname____doc__r
   r*   r   __annotations__r,   strr   r-   r   r   r.   propertyr2   r4   r   r   r   r9   r   r   r   r&   r&   #   s    % 1LMJM).?V)WK3%+&WIs&(L'#s(#(')M738$)WS#X%6   3   %):>	 tCy! 67	
  
r   r&   r:   )typingr   r   r   r   r   langchain_core.callbacksr   #langchain_core.language_models.llmsr	   pydanticr
   langchain_community.llms.utilsr   r@   r   r$   r&   r   r   r   <module>rG      sg    9 9 = 3  >C D  BF}+3DI+>(0C 0r   