
    .`i                        d dl 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 dlmZmZ d dlmZ d dlmZmZ  e            Zd	ed
edz  fdZe                    d ee          g          eed	edefd                                    ZdS )    )	APIRouterDependsRequest)JSONResponse)assert_never)ErrorResponse)validate_json_request)ClassificationRequestClassificationResponse)ServingClassification)load_aware_callwith_cancellationrequestreturnNc                 $    | j         j        j        S )N)appstateopenai_serving_classification)r   s    /home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/vllm/entrypoints/pooling/classify/api_router.pyclassifyr      s    ;::    z	/classify)dependenciesraw_requestc                   K   t          |          }|'|j        j        j        }|                    d          S 	 |                    | |           d {V }n,# t          $ r}|                    |          cY d }~S d }~ww xY wt          |t                    r-t          |
                                |j        j                  S t          |t                    r"t          |
                                          S t          |           d S )Nz-The model does not support Classification API)message)contentstatus_code)r   )r   r   r   openai_serving_tokenizationcreate_error_responsecreate_classify	Exception
isinstancer   r   
model_dumperrorcoder   r   )r   r   handlerbase_server	generatores         r   r    r       s>      {##G!o+G00C 1 
 
 	
0!11';GGGGGGGG		 0 0 0,,Q////////0 )]++ <((**	8L
 
 
 	
 
I5	6	6 <I$8$8$:$:;;;;s   A 
B#A=7B=B)fastapir   r   r   starlette.responsesr   typing_extensionsr   'vllm.entrypoints.openai.engine.protocolr   vllm.entrypoints.openai.utilsr	   *vllm.entrypoints.pooling.classify.protocolr
   r   )vllm.entrypoints.pooling.classify.servingr   vllm.entrypoints.utilsr   r   routerr   postr     r   r   <module>r5      sc   0 / / / / / / / / / , , , , , , * * * * * * A A A A A A ? ? ? ? ? ?        L K K K K K E E E E E E E E	;g ;"7$"> ; ; ; ; [0E(F(F'GHH#8 w      IH  r   