o
    wi:
                     @   sh   d dl 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 G dd deZd	d
 ZdS )    N)batch)Tensor)DeployPyTritonITritonDeployable)NemoQueryLLM)cast_outputstr_ndarray2listc                   @   s8   e Zd Zedd Zedd ZedejfddZ	dS )		MockModelc              	   C   sD   t ddtdt ddtjddt ddtjddt d	dtjddf}|S )
Npromptsnameshapedtypemax_output_lenT)r   r   r   optionaloutput_context_logitsFoutput_generation_logits)r   bytesnpint_bool_)selfinputs r   [/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/tests/deploy/test_deploy_query.pyget_triton_input   s   zMockModel.get_triton_inputc                 C   s   t ddtdf}|S )Noutputsr   r   )r   r   )r   r   r   r   r   get_triton_output%   s   zMockModel.get_triton_outputr   c                 K   sJ   dt |di}d|v r|dd d |d< t }tdtj|d< |S )Ninput_textsr
   r   r   I am good, how about you?r   )r   popdictr   r   bytes_)r   r   infer_inputoutput_dictr   r   r   triton_infer_fn*   s   zMockModel.triton_infer_fnN)
__name__
__module____qualname__propertyr   r   r   r   ndarrayr'   r   r   r   r   r	      s    
	
r	   c                  C   s|   d} t  }t|| dddddddd	}|  |  td	| d
}|jdgdd}|  |d us4J d|dks<J dd S )N
mock_model    i*#  iA  z0.0.0.0TF)	modeltriton_model_namemax_batch_size	http_port	grpc_portaddress
allow_grpc
allow_http	streamingzlocalhost:9002)url
model_namezHey, how is it going?   )r
   r   zOutput cannot be none.r!   )r	   r   deployrunr   	query_llmstop)r9   r/   nmnqoutput_deployedr   r   r   test_nemo_deploy_query5   s.   rB   )numpyr   pytriton.decoratorsr   pytriton.model_configr   nemo.deployr   r   nemo.deploy.nlpr   nemo.deploy.utilsr   r   r	   rB   r   r   r   r   <module>   s   