
    `gj                     
   d Z ddlmZ ddlmZ ddlmZ ddlmZ de	dz  de
fd	Zd
e	dz  de
fdZ G d de      Z eddddddd      Z eddddddd      Z eddddddddd d!"
      Z ee        ee        ee       y)#a=  MiniMax provider profiles (international + China).

The default API-key routes use anthropic_messages because their base URLs end
with /anthropic. Users can opt MiniMax-M3 into the OpenAI-compatible endpoint
with base_url=https://api.minimax.io/v1; that route needs MiniMax-specific
reasoning controls in extra_body.
    )Any)urlparse)register_provider)ProviderProfilebase_urlNreturnc                     t        t        | xs d      j                               }|j                  xs dj	                         dk7  ry|j
                  j                  d      j	                         }|dk(  S )N zapi.minimax.ioF/z/v1)r   strstriphostnamelowerpathrstrip)r   parsedr   s      [/root/.hermes/venv/lib/python3.12/site-packages/plugins/model-providers/minimax/__init__.py"_is_minimax_global_openai_base_urlr      sc    c(.b)//12F2$$&*::;;c"((*D5=    modelc                 `    t        | xs d      j                         j                         }|dv S )Nr
   >   
minimax-m3minimax/minimax-m3)r   r   r   )r   
normalizeds     r   _is_minimax_m3r      s.    U[b!'')//1J===r   c                   f    e Zd ZdZdddddedz  dedz  dedz  dedeeeef   eeef   f   f
d	Zy)
MiniMaxProfileu4   MiniMax — M3 OpenAI-compatible reasoning controls.N)reasoning_configr   r   r   r   r   contextr   c                    t        |      rt        |      si i fS ddi}t        |t              r|j	                  d      du rddi|d<   |i fS |ddi|d<   |i fS )	au  Emit M3 reasoning controls for api.minimax.io/v1.

        MiniMax-M3's OpenAI-compatible endpoint keeps thinking inline unless
        ``reasoning_split`` is sent, so always request the split format on that
        route. ``thinking`` controls the M3 mode; Hermes' effort levels are not
        a MiniMax depth knob here, so they only select adaptive vs disabled.
        reasoning_splitTenabledFtypedisabledthinkingadaptive)r   r   
isinstancedictget)selfr   r   r   r   
extra_bodys         r   build_api_kwargs_extrasz&MiniMaxProfile.build_api_kwargs_extras    s~     2(;>RWCXr6M&7%>
&-2B2F2Fy2QUZ2Z&,j%9Jz"r>!'&,j%9Jz"2~r   )	__name__
__module____qualname____doc__r(   r   r   tupler,    r   r   r   r      sm    >
 )- # + Tz	
 *  
tCH~tCH~-	.r   r   minimax)zmini-maxanthropic_messages)MINIMAX_API_KEYz https://api.minimax.io/anthropicapi_keyz
MiniMax-M3)namealiasesapi_modeenv_varsr   	auth_typedefault_aux_modelz
minimax-cn)zminimax-china
minimax_cn)MINIMAX_CN_API_KEYz"https://api.minimaxi.com/anthropiczminimax-oauth)minimax_oauthzminimax-oauth-iozMiniMax (OAuth)u6   MiniMax via OAuth browser flow — no API key requiredzhttps://api.minimax.io/r2   oauth_externalzMiniMax-M2.7)
r7   r8   r9   display_namedescription
signup_urlr:   r   r;   r<   )r0   typingr   urllib.parser   	providersr   providers.baser   r   boolr   r   r   r3   r=   r?   r2   r   r   <module>rI      s     ! ' *t  >#* > >
_ B 	!!/" 	+!$1"
 	1!"H(/$ '  *  -  r   