
    ^h                     L    S r SSKrSSKJrJr  SSKJrJrJrJ	r	   " S S5      r
g)z
Transformation logic from Cohere's /v1/rerank format to Jina AI's  `/v1/rerank` format. 

Why separate file? Make it easy to see how transformation works

Docs - https://jina.ai/reranker
    N)ListOptional)RerankBilledUnitsRerankResponseRerankResponseMetaRerankTokensc                   &    \ rS rSrS\S\4S jrSrg)JinaAIRerankConfig   responsereturnc                 B   [        S0 UR                  S0 5      D6n[        S0 UR                  S0 5      D6n[        X#S9nUR                  S5      nUc  [	        SU 35      e[        UR                  S5      =(       d    [        [        R                  " 5       5      UUS9$ )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         d/home/james-whalen/.local/lib/python3.13/site-packages/litellm/llms/jina_ai/rerank/transformation.py_transform_response&JinaAIRerankConfig._transform_response   s    )FHLL",EF;gr!:;(mT)1i)@@
KLL||D!6S%6
 	
    r   N)__name__
__module____qualname____firstlineno__dictr   r!   __static_attributes__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#   