o
    PL
j                     @   sT   d Z ddlmZ ddlmZ ddlmZ G dd deZeddd	d
dZee dS )u  Custom / Ollama (local) provider profile.

Covers any endpoint registered as provider="custom", including local
Ollama instances. Key quirks:
  - ollama_num_ctx → extra_body.options.num_ctx (local context window)
  - reasoning_config disabled → extra_body.think = False
    )Any)register_provider)ProviderProfilec                       s   e Zd ZdZddddedB dedB dedeeeef eeef f fdd	Z	dd
ddedB de
dee dB f fddZ  ZS )CustomProfileuA   Custom/Ollama local provider — think=false and num_ctx support.N)reasoning_configollama_num_ctxr   r   ctxreturnc                K   st   i }|r| di }||d< ||d< |r6t|tr6| dpd  }| dd}|dks2|du r6d|d	< |i fS )
Noptionsnum_ctxeffort enabledTnoneFthink)get
isinstancedictstriplower)selfr   r   r   
extra_bodyr
   _effort_enabled r   K/home/kuhnn/.hermes/hermes-agent/plugins/model-providers/custom/__init__.pybuild_api_kwargs_extras   s   z%CustomProfile.build_api_kwargs_extrasg       @api_keytimeoutr   r   c                   s   | j sdS t j||dS )z9Custom/Ollama: base_url is user-configured; fetch if set.Nr   )base_urlsuperfetch_models)r   r   r   	__class__r   r   r"   *   s   zCustomProfile.fetch_models)__name__
__module____qualname____doc__r   intr   tuplestrr   floatlistr"   __classcell__r   r   r#   r   r      s,    

r   custom)ollamalocalvllmllamacppz	llama.cppz	llama-cppr   r   )namealiasesenv_varsr    N)	r(   typingr   	providersr   providers.baser   r   r/   r   r   r   r   <module>   s    '