
    g                     L    d Z ddlZddlmZmZ ddlmZmZmZm	Z	  G d d      Z
y)z
Transformation logic from Cohere's /v1/rerank format to Together AI's  `/v1/rerank` format. 

Why separate file? Make it easy to see how transformation works
    N)ListOptional)RerankBilledUnitsRerankResponseRerankResponseMetaRerankTokensc                       e Zd ZdedefdZy)TogetherAIRerankConfigresponsereturnc                 B   t        di |j                  di       }t        di |j                  di       }t        ||      }|j                  d      }|t	        d|       t        |j                  d      xs t        t        j                               ||      S )Nusage)billed_unitstokensresultsz!No results found in the response=id)r   r   meta )	r   getr   r   
ValueErrorr   struuiduuid4)selfr   _billed_units_tokensrerank_meta_resultss         c/var/www/openai/venv/lib/python3.12/site-packages/litellm/llms/together_ai/rerank/transformation.py_transform_responsez*TogetherAIRerankConfig._transform_response   s    )FHLL",EF;gr!:;(mGT)1i)@@
KLL||D!6S%6
 	
    N)__name__
__module____qualname__dictr   r    r   r!   r   r
   r
      s    
D 
^ 
r!   r
   )__doc__r   typingr   r   litellm.types.rerankr   r   r   r   r
   r   r!   r   <module>r)      s&     ! 
 
r!   