
    .`i"                        d dl mZmZ d dl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 dlmZ d dlmZmZmZ  G d	 d
e          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          ZdS )    )	AnnotatedAny)Fieldmodel_validator)PoolingParams)get_use_activation)ChatCompletionMessageParam)OpenAIBaseModel)random_uuid)
EmbedDTypeEncodingFormat
Endiannessc                       e Zd ZU dZedz  ed<   dZedz  ed<   dZee	 e
d          f         dz  ed<    e
ed          Zeed	<    e
d
d          Ze	ed<   dS )PoolingBasicRequestMixinNmodeluser)getruncate_prompt_tokenszThe request_id related to this request. If the caller does not set it, a random_uuid will be generated. This id is used through out the inference process and return in response.)default_factorydescription
request_idr   zThe priority of the request (lower means earlier handling; default: 0). Any priority other than 0 will raise an error if the served model does not use priority scheduling.defaultr   priority)__name__
__module____qualname__r   str__annotations__r   r   r   intr   r   r   r        z/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/vllm/entrypoints/pooling/base/protocol.pyr   r      s         E3:D#* CGIc55B<<<&784?FFFe#H  J    ED  Hc     r#   r   c                       e Zd ZU ee         eee                  z  ez  ee         z  ed<    edd          Ze	ed<   dS )CompletionRequestMixininputTzMIf true (the default), special tokens (e.g. BOS) will be added to the prompt.r   add_special_tokensN)
r   r   r   listr!   r   r    r   r(   boolr"   r#   r$   r&   r&   ,   ss         9tDI&,tCy8888  %u          r#   r&   c                   0   e Zd ZU ee         ed<    edd          Zeed<    edd          Z	eed<    edd          Z
eed	<    ed
d          Zed
z  ed<    ed
d          Zeeef         d
z  ed<    ed          ed                         Zd
S )ChatRequestMixinmessagesFzIf true, the generation prompt will be added to the chat template. This is a parameter used by chat template in tokenizer config of the model.r   add_generation_prompta:  If this is set, the chat will be formatted so that the final message in the chat is open-ended, without any EOS tokens. The model will continue this message rather than starting a new one. This allows you to "prefill" part of the model's response for it. Cannot be used at the same time as `add_generation_prompt`.continue_final_messagezIf true, special tokens (e.g. BOS) will be added to the prompt on top of what is added by the chat template. For most models, the chat template takes care of adding the special tokens so this should be set to false (as is the default).r(   NzA Jinja template to use for this conversion. As of transformers v4.44, default chat template is no longer allowed, so you must provide a chat template if the tokenizer does not define one.chat_templatezbAdditional keyword args to pass to the template renderer. Will be accessible by the chat template.chat_template_kwargsbefore)modec                 x    |                     d          r$|                     d          rt          d          |S )Nr/   r.   zMCannot set both `continue_final_message` and `add_generation_prompt` to True.)get
ValueError)clsdatas     r$   check_generation_promptz(ChatRequestMixin.check_generation_promptp   sK     88,-- 	$((;R2S2S 	3   r#   )r   r   r   r)   r	   r    r   r.   r*   r/   r(   r0   r   r1   dictr   r   classmethodr9   r"   r#   r$   r,   r,   <   sf        -.... #(%# # #4    $)5J	$ 	$ 	$D 	 	 	  %u	  	  	  	 	 	 !&#! ! !M3:    38%73 3 3$sCx.4/    _(###  [ $#  r#   r,   c                   f    e Zd ZU dZeed<    edd          Zeed<    edd          Z	e
ed	<   d
S )EncodingRequestMixinfloatencoding_formatfloat32zWhat dtype to use for encoding. Default to using float32 for base64 encoding to match the OpenAI python client behavior. This parameter will affect base64 and binary_response.r   embed_dtypenativezWhat endianness to use for encoding. Default to using native for base64 encoding to match the OpenAI python client behavior.This parameter will affect base64 and binary_response.
endiannessN)r   r   r   r?   r   r    r   rA   r   rC   r   r"   r#   r$   r=   r=   {   s         &-O^--- $eE  K    #UE  J
     r#   r=   c                   T    e Zd ZU dZedz  ed<    edd          Zedz  ed<   d Z	dS )EmbedRequestMixinN
dimensionsz=Whether to normalize the embeddings outputs. Default is True.r   	normalizec           	      X    t          | j        | j        t          | dd                     S )Nr   )rF   use_activationr   )r   rF   rG   getattrselfs    r$   to_pooling_paramsz#EmbedRequestMixin.to_pooling_params   s3    >#*41I4#P#P
 
 
 	
r#   )
r   r   r   rF   r!   r    r   rG   r*   rM   r"   r#   r$   rE   rE      sl         !Jd
!!! #US  Itd{   
 
 
 
 
r#   rE   c                       e Zd ZU  edd          Zedz  ed<    edd          Zedz  ed<    edd          Zedz  ed<   d	 Z	dS )
ClassifyRequestMixinNz>softmax will be deprecated, please use use_activation instead.r   softmaxzAactivation will be deprecated, please use use_activation instead.
activationzFWhether to use activation for classification outputs. Default is True.rI   c                 \    t          t          |           t          | dd                     S )Nr   )rI   r   )r   r   rJ   rK   s    r$   rM   z&ClassifyRequestMixin.to_pooling_params   s4    -d33#*41I4#P#P
 
 
 	
r#   )
r   r   r   r   rP   r*   r    rQ   rI   rM   r"   r#   r$   rO   rO      s          5T  GTD[    $eW  Jt    #(%# # #ND4K   
 
 
 
 
r#   rO   N)typingr   r   pydanticr   r   vllmr   vllm.config.poolerr   vllm.entrypoints.chat_utilsr	   'vllm.entrypoints.openai.engine.protocolr
   
vllm.utilsr   vllm.utils.serial_utilsr   r   r   r   r&   r,   r=   rE   rO   r"   r#   r$   <module>r[      s  
 " ! ! ! ! ! ! ! + + + + + + + +       1 1 1 1 1 1 B B B B B B C C C C C C " " " " " " J J J J J J J J J J       6    _    < < < < < < < <~    ?   2
 
 
 
 
, 
 
 
(
 
 
 
 
? 
 
 
 
 
r#   