+
    kHàjå  ã                   ó    € R t ^ RIHt ^ RIHt ^ RIHtHt ^ RIH	t	 ^ RI
Ht ^ RIHt R R lt ! R	 R
]4      t]! RRRRR7      t]	! ]4       R# )u†   Custom / Ollama (local) provider profile: any endpoint registered as
provider="custom" (Ollama, vLLM, llama.cpp, GLM-5.2 on ARK, â€¦).)ÚAny)Úurlparse)ÚOPENAI_COMPAT_WIRE_EFFORTSÚclamp_effort)Úregister_provider)ÚProviderProfile)Úbase_url_host_matchesc                ó>   € V ^8„  d   QhR\         R,          R\        /# )é   Úbase_urlNÚreturn)ÚstrÚbool)Úformats   "ÚL/home/ubuntu/.hermes/hermes-agent/plugins/model-providers/custom/__init__.pyÚ__annotate__r      s"   € ÷ pñ p¬#°­*ð p¼ñ pó    c                óÆ  € T ;'       g    RP                  4       pV'       g   R# \        RV9   d   TMRV 24      p VP                  R8X  d   R#  TP                  ;'       g    RP                  4       P                  R4      p\        T4      ;'       d;    TR8H  ;'       g.    TP                  R	4      ;'       g    R
TP                  R4      9   #   \         d     R# i ; i)zÓTrue only for explicit Ollama signatures (port 11434 or an ``ollama`` host label).
``think`` is Ollama-native; strict hosts (Mistral, Groq) 422 on it, and
arbitrary localhost may be llama.cpp / vLLM / LM Studio.Ú Fz://z//iª,  TÚ.z
ollama.comz.ollama.comÚollama)
Ústripr   ÚportÚ
ValueErrorÚhostnameÚlowerÚrstripr   ÚendswithÚsplit)r   ÚrawÚparsedÚhosts   &   r   Ú_looks_like_ollama_endpointr"      sÍ   € ð �>ˆ>�r×
 Ñ
 Ó
"€CßÙÜ˜U cœ\‘c°°C°5¨zÓ:€FðØ�;‰;˜%ÔÙð  ð �O‰O×!Ð!˜r×(Ñ(Ó*×1Ñ1°#Ó6€DÜ�‹:×oÐo˜4 <Ñ/×nÐn°4·=±=ÀÓ3O×nÐnÐS[Ð_c×_iÑ_iÐjmÓ_nÑSnÐoøô ô Úðús   ½C ÃC ÃC c                   ó˜   a a€ ] tR t^t oRtV3R lR ltRV3R lR lltRRRR/V3R	 lR
 lltRRRRRR/V3R lV 3R llltRt	Vt
V ;t# )ÚCustomProfileuA   Custom/Ollama local provider â€” think=false and num_ctx support.c                óH   <€ V ^8„  d   QhRS[ R,          RS[S[ R3,          /# )r
   ÚmodelNr   .)r   Útuple)r   Ú__classdict__s   "€r   r   ÚCustomProfile.__annotate__!   s'   ø€ ÷ *ñ *±°tµð *ÁÁcÈ3ÀhÅñ *r   c                ó   € \         # )uE  The OpenAI-compat wire set, mirroring this profile's own chat-completions clamp.

Without this declaration the Responses transport clamps onto the OpenAI
per-model ladder (``codex_supported_efforts``), where ``max`` is gpt-5.6-only â€”
so a custom relay's model had a configured ``max`` silently demoted to
``xhigh`` while the same provider over chat-completions forwarded ``max``
unchanged (#114249). A custom endpoint's vocabulary is undiscoverable, so
the widest OpenAI-compat set is the honest ceiling; ``ultra`` still clamps
to ``max`` via the shared ``clamp_effort`` policy.
)r   ©Úselfr&   s   &&r   Úsupported_reasoning_effortsÚ)CustomProfile.supported_reasoning_efforts!   s
   € ô *Ð)r   Nc                óB   <€ V ^8„  d   QhRS[ R,          RS[R,          /# )r
   r&   Nr   )r   Údict)r   r(   s   "€r   r   r)   .   s#   ø€ ÷ 5ñ 5©c°D­jð 5ÁDÈ4ÅKñ 5r   c                ó   € RRRR/# )u¶  Unset ``agent.reasoning_effort`` â†’ ``medium``, as on the Nous / OpenRouter profiles.

Leaving the field off lets the endpoint's own default apply, and for a hosted reasoning
model that default can be its ceiling: kimi-k3 behind an OpenAI-compatible relay defaults
to ``max`` â€” 3x the reasoning tokens and ~3x the latency of medium. The agent skips this
default for models the catalog marks non-reasoning (``agent.reasoning_params``).
ÚenabledTÚeffortÚmedium© r+   s   &&r   Údefault_reasoning_configÚ&CustomProfile.default_reasoning_config.   s   € ð ˜4 ¨8Ð4Ð4r   Úreasoning_configÚollama_num_ctxc                ó�   <€ V ^8„  d   QhRS[ R,          RS[R,          RS[RS[S[ S[S[3,          S[ S[S[3,          3,          /# )r
   r8   Nr9   Úctxr   )r0   Úintr   r'   r   )r   r(   s   "€r   r   r)   8   sO   ø€ ÷ %ñ %Ù#'¨$¥;ð%ÙGJÈTÅzð%Ùadð%á	‰t‘C™�H�~™t¡C© H�~Ð-Õ	.ñ%r   c               ó*  € / p/ pV'       d   R V/VR&   V'       d÷   \        V\        4      '       dá   VP                  R4      ;'       g    RP                  4       P	                  4       pVR8X  g   VP                  RR4      RJ d.   RVR&   \        VP                  R	4      4      '       d   RVR
&   WE3# V'       d=   \        \        VP                  R	4      ;'       g    R4      R4      '       d	   RVR&   WE3# V'       d   \        V\        4      VR&   WE3# )Únum_ctxÚoptionsr3   r   Únoner2   TFÚreasoning_effortr   Úthinkzapi.groq.comÚdefault)
Ú
isinstancer0   Úgetr   r   r"   r   r   r   r   )r,   r8   r9   r;   Ú
extra_bodyÚ	top_levelr3   s   &$$,   r   Úbuild_api_kwargs_extrasÚ%CustomProfile.build_api_kwargs_extras8   s  € ð &(ˆ
Ø$&ˆ	ßØ%.°Ð$?ˆJ�yÑ!÷ ¤
Ð+;¼T× BÒ BØ&×*Ñ*¨8Ó4×:Ð:¸×AÑAÓC×IÑIÓKˆFØ˜ÔÐ#3×#7Ñ#7¸	À4Ó#HÈEÓ#Qà06�	Ð,Ñ-Ü.¨s¯w©w°zÓ/B×CÒCØ*/�J˜wÑ'ð Ð$Ð$÷ Ô1´#°c·g±g¸jÓ6I×6OÐ6OÈRÓ2PÐR`×aÒað 1:�	Ð,Ñ-ð Ð$Ð$÷ Ü0<¸VÔE_Ó0`�	Ð,Ñ-ØÐ$Ð$r   Úapi_keyr   Útimeoutg       @c          	      ól   <€ V ^8„  d   QhRS[ R,          RS[ R,          RS[RS[S[ ,          R,          /# )r
   rJ   Nr   rK   r   )r   ÚfloatÚlist)r   r(   s   "€r   r   r)   V   sD   ø€ ÷ Yñ YÙ �*ðYÙ7:¸TµzðYÙSXðYá	‰c��TÕ	ñYr   c               ó^   <€ V'       g   V P                   '       g   R# \        SV `	  WVR7      # )z/base_url is user-configured; fetch only if set.N)rJ   r   rK   )r   ÚsuperÚfetch_models)r,   rJ   r   rK   Ú	__class__s   &$$$€r   rQ   ÚCustomProfile.fetch_modelsV   s)   ø€ ÷ ˜DŸMŸM˜MÙÜ‰wÑ#¨GÐPWÐ#ÓXÐXr   r5   )N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r-   r6   rH   rQ   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)rR   r(   s   @@r   r$   r$      sc   ù‡ € ÙK÷*ð *÷5ò 5ð%Ø15ð%ØTX÷%ò %ð<YØ'+ðYØDHðYØ[^÷Y÷ Yõ Yr   r$   Úcustomr   )ÚnameÚaliasesÚenv_varsr   N)r   ÚlocalÚvllmÚllamacppz	llama.cppz	llama-cppr5   )rX   Útypingr   Úurllib.parser   Úagent.reasoning_effortr   r   Ú	providersr   Úproviders.baser   Úutilsr   r"   r$   r\   r5   r   r   Ú<module>ri      sV   ðñEõ Ý !ç KÝ 'Ý *Ý 'õpô">Y�Oô >YñB 
Ø	Ð\ØØô
€ñ �&Ö r   