
    Pmj                        d Z ddlmZ ddlmZ ddlmZ ddlmZ dd
Z	 G d de          Z
 e
ddddddddd	  	        Z ee           dS )a  DeepSeek provider profile.

DeepSeek's V4 family defaults to thinking-mode ON when ``extra_body.thinking``
is unset.  The API then returns ``reasoning_content`` and starts enforcing
the contract that subsequent turns echo it back; combined with how Hermes
replays history this lands on the notorious HTTP 400
``reasoning_content must be passed back`` error after the first tool call
(#15700, #17212, #17825).

This profile overrides :meth:`build_api_kwargs_extras` to mirror the Kimi /
Moonshot wire shape that DeepSeek's OpenAI-compat endpoint expects:

    {"reasoning_effort": "<low|medium|high|max>",
     "extra_body": {"thinking": {"type": "enabled" | "disabled"}}}

Non-thinking models (``deepseek-v3-*`` variants) are left as no-ops so we
don't perturb the V3 wire format.

The legacy aliases ``deepseek-chat`` / ``deepseek-reasoner`` were retired on
2026-07-24.  Use ``deepseek-v4-flash`` or ``deepseek-v4-pro``; Hermes remaps
the retired IDs in ``hermes_cli.model_normalize``.
    )annotations)Any)register_provider)ProviderProfilemodel
str | Nonereturnboolc                    | pd                                                                 }|sdS |                    d          r|                    d          sdS dS )a  DeepSeek thinking-capable model families.

    Currently covers the V4 family (``deepseek-v4-pro``, ``deepseek-v4-flash``,
    and any future ``deepseek-v4-*`` variants).  Retired aliases are remapped
    before requests leave Hermes, so they are not listed here.
     Fz
deepseek-vzdeepseek-v3T)striplower
startswith)r   ms     O/home/thesage/.hermes/hermes-agent/plugins/model-providers/deepseek/__init__.py_model_supports_thinkingr       se     
"##%%A u||L!! !,,}*E*E  t5    c                  "    e Zd ZdZddddd
ZdS )DeepSeekProfileu>   DeepSeek — extra_body.thinking + top-level reasoning_effort.N)reasoning_configr   r   dict | Noner   r   r	   %tuple[dict[str, Any], dict[str, Any]]c                  i }i }t          |          s||fS d}t          |t                    r|                    d          du rd}d|rdndi|d<   |s||fS t          |t                    rN|                    d          pd                                                                }|d	v rd
|d<   n	|dv r||d<   ||fS )NTenabledFtypedisabledthinkingeffortr   >   maxultraxhighr   reasoning_effort>   lowhighmedium)r   
isinstancedictgetr   r   )selfr   r   context
extra_body	top_levelr   r   s           r   build_api_kwargs_extrasz'DeepSeekProfile.build_api_kwargs_extras4   s    &(
$&	'.. 	)y((
 &-- 	2B2F2Fy2Q2QUZ2Z2ZG"(w*N))J!O
: 	)y((
 &-- 	7&**844:AACCIIKKF22205	,--44406	,-9$$r   )r   r   r   r   r	   r   )__name__
__module____qualname____doc__r-    r   r   r   r   1   s?        HH 264 %  %  %  %  %  %  %  %r   r   deepseek)zdeepseek-chat)DEEPSEEK_API_KEYDeepSeeku    DeepSeek — native DeepSeek APIzhttps://platform.deepseek.com/)zdeepseek-v4-prodeepseek-v4-flashzhttps://api.deepseek.com/v1r6   )	namealiasesenv_varsdisplay_namedescription
signup_urlfallback_modelsbase_urldefault_aux_modelN)r   r   r	   r
   )r1   
__future__r   typingr   	providersr   providers.baser   r   r   r3   r2   r   r   <module>rD      s    . # " " " " "       ' ' ' ' ' ' * * * * * *   "#% #% #% #% #%o #% #% #%L ?	"2/ +)    (     r   