
    Ng	                         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dS )    )AnyCallableListMappingOptional)CallbackManagerForLLMRun)LLM)Field)enforce_stop_tokenspromptreturnNc                 *    t          d|             dS )z&Displays the given prompt to the user.
N)print)r   s    Z/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/llms/human.py_display_promptr   
   s    	-v--    	separatorstopc                     | pd} g }	 t                      sn4|                               |rt          fd|D                       rnE|                     |          }|S )z3Collects and returns user input as a single string.r   Tc              3       K   | ]}|v V  	d S N ).0seqlines     r   	<genexpr>z&_collect_user_input.<locals>.<genexpr>   s'      44t444444r   )inputappendanyjoin)r   r   linesmulti_line_inputr   s       @r   _collect_user_inputr$      s     !TIEww 	T 	C4444t44444 	 !~~e,,r   c                   F   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dS )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                     dS )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   Nr   )r,   r.   r*   r   r-   r   )r1   r   r   r5   r6   
user_inputs         r   _callzHumanInputLLM._call8   sp    $ 	664#5666$T_ 
n4
 
373D
 

  -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`        %% 51L1LMMMJMMM).?V?V)W)W)WK3%+&WWWIs&(L'#s(#(((')M738$)))WS#X%6    X 3    X %):>	  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      s   9 9 9 9 9 9 9 9 9 9 9 9 9 9 = = = = = = 3 3 3 3 3 3       > > > > > >C D     BF }+3DI+>   (0 0 0 0 0C 0 0 0 0 0r   