
    [j\                        d Z ddlmZ ddlmZ ddlmZ ddlmZ  G d de          Z	 e	dd	d
dd          Z
 ee
           dS )u  Ollama Cloud provider profile.

Ollama Cloud's OpenAI-compatible ``/v1/chat/completions`` endpoint
supports top-level ``reasoning_effort`` with values ``none``, ``low``,
``medium``, ``high``, and ``max`` (the last being undocumented but
empirically confirmed for DeepSeek V4 — ``max`` produces ~2.5× more
thinking tokens than ``high``).

This profile maps Hermes's ``xhigh`` → ``max`` to unlock DeepSeek V4's
"Max thinking" tier through Ollama Cloud.  ``low`` / ``medium`` / ``high``
pass through unchanged.

When reasoning is explicitly disabled (``enabled: false`` or
``effort: "none"``), ``reasoning_effort`` is omitted entirely so the
model runs in non-thinking mode.
    )annotations)Any)register_provider)ProviderProfilec                  "    e Zd ZdZdddddZdS )OllamaCloudProfileuA   Ollama Cloud — maps xhigh→max via top-level reasoning_effort.NF)reasoning_configsupports_reasoningr	   dict | Noner
   boolctxr   return%tuple[dict[str, Any], dict[str, Any]]c               H   i }|si i fS |rt          |t                    r|                    dd          }|du ri ddifS |                    d          pd                                                                }|si i fS |dk    ri ddifS |dv rd	|d<   n	|d
v r||d<   i |fS )u  Emit top-level ``reasoning_effort`` for Ollama Cloud thinking models.

        Gated on ``supports_reasoning``, which the transport resolves from the
        model's native ``/api/show`` ``capabilities`` (``thinking``). Models
        without the thinking capability (e.g. ``gemma3``, ``qwen3-coder``) get
        no ``reasoning_effort`` at all — emitting it there is a no-op the API
        ignores, and gating avoids sending a meaningless field.
        enabledTFreasoning_effortnoneeffort )xhighmaxultrar   )lowmediumhigh)
isinstancedictgetstriplower)selfr	   r
   r   	top_levelr   r   s          O/home/ice/.hermes/hermes-agent/plugins/model-providers/ollama-cloud/__init__.pybuild_api_kwargs_extrasz*OllamaCloudProfile.build_api_kwargs_extras   s    %'	! 	r6M 	7
+;T B B 	7&**9d;;G% .777&**844:AACCIIKKF  2v.77722205	,--44406	,- 9}    )r	   r   r
   r   r   r   r   r   )__name__
__module____qualname____doc__r$    r%   r#   r   r      s@        KK
 )-#(	1 1 1 1 1 1 1 1r%   r   zollama-cloud)ollama_cloudznemotron-3-nano:30b)OLLAMA_API_KEYzhttps://ollama.com/v1)namealiasesdefault_aux_modelenv_varsbase_urlN)r)   
__future__r   typingr   	providersr   providers.baser   r   r+   r*   r%   r#   <module>r6      s    " # " " " " "       ' ' ' ' ' ' * * * * * *4 4 4 4 4 4 4 4n "!	+ $    ,     r%   