
    g                     p    d Z ddlmZmZ ddlZddlmZ  G d de      Zdeej                  e	f   de	fd	Z
y)
z6
This file contains common utils for anthropic calls.
    )OptionalUnionN)BaseLLMExceptionc                   F     e Zd Z	 ddedeej                     f fdZ xZS )AnthropicErrorstatus_codeheadersc                 *    t         |   |||       y )N)r   messager	   )super__init__)selfr   r   r	   	__class__s       X/var/www/openai/venv/lib/python3.12/site-packages/litellm/llms/anthropic/common_utils.pyr   zAnthropicError.__init__   s     	['7S    )N)	__name__
__module____qualname__intr   httpxHeadersr   __classcell__)r   s   @r   r   r      s1    
 ,0	TT %--(	T Tr   r   r	   returnc                     i }d| v r| d   |d<   d| v r| d   |d<   d| v r| d   |d<   d| v r| d   |d<   | j                         D ci c]  \  }}d	j                  d
|      | }}}i ||}|S c c}}w )Nz"anthropic-ratelimit-requests-limitzx-ratelimit-limit-requestsz&anthropic-ratelimit-requests-remainingzx-ratelimit-remaining-requestsz anthropic-ratelimit-tokens-limitzx-ratelimit-limit-tokensz$anthropic-ratelimit-tokens-remainingzx-ratelimit-remaining-tokensz{}-{}llm_provider)itemsformat)r	   openai_headerskvllm_response_headersadditional_headerss         r   process_anthropic_headersr#      s    N+w67>08
34 07:;B4<
78 *W45<.6
12 .89@2:
56
 :A9HA~q)1,   D0CNCs   A.)__doc__typingr   r   r   )litellm.llms.base_llm.chat.transformationr   r   r   dictr#    r   r   <module>r)      sE    #  FT% TuU]]D-@'A d r   