+
    iHàj¢  ã                  ó>   € R t ^ RIHt ^ RIHt ^ RIHtHt R tR t	R# )zQInit-time local-server (Ollama) num_ctx detection and the compressor clamp to it.)Úannotations)Ú_ra)Úis_local_endpointÚquery_ollama_num_ctxc                óZ  € R V n         \        V\        4      '       d   VP                  R4      MR pVe    \	        V4      V n         V P                   fž   V P                  '       dŒ   \        V P                  4      '       dq    \        V P                  \        4      '       d   V P                  MRp\        V P                  V P                  T;'       g    RR7      pV'       d   V^ 8”  d   WPn         V P                   '       dS   V'       dK   VfG   V P                   V8”  d6   \        4       P                  P#                  RV P                   V4       W n         V P                   '       dL   V P$                  '       g8   \        4       P                  P#                  RV P                   Ve   RMR	4       R # R # R #   \
        \        3 d)    \        4       P                  P                  RT4        EL¦i ; i  \          d0   p\        4       P                  P                  RT4        R p?EL4R p?ii ; i)
NÚollama_num_ctxz'Invalid ollama_num_ctx config value: %rÚ )Úapi_keyz)Local server num_ctx detection failed: %sz?Ollama num_ctx capped: %d -> %d (model.context_length override)z1Local server num_ctx: will request %d tokens (%s)zmodel.ollama_num_ctxzmodel max from Ollama /api/show)Ú_ollama_num_ctxÚ
isinstanceÚdictÚgetÚintÚ	TypeErrorÚ
ValueErrorr   ÚloggerÚdebugÚbase_urlr   r	   Ústrr   ÚmodelÚ	ExceptionÚinfoÚ
quiet_mode)ÚagentÚ
_model_cfgÚ_config_context_lengthÚ	_overrideÚ_keyÚ	_detectedÚexcs   &&&    Ú</home/ubuntu/.hermes/hermes-agent/agent/agent_init_ollama.pyÚ_configure_ollama_num_ctxr!   	   s¯  € ð )-€EÔÜ4>¸zÌ4×4PÒ4P�
—‘Ð/Ô0ÐVZ€IØÒð	UÜ$'¨	£NˆEÔ!ð ×ÑÒ$¨¯¯¨Ô<MÈeÏnÉn×<]Ò<]ð	Qä$.¨u¯}©}¼c×$BÒ$B�5—=’=ÈˆDÜ,¨U¯[©[¸%¿.¹.ÐRV×R\ÐR\ÐZ\Ô]ˆIß˜Y¨œ]Ø(1Ô%ð 	××Ðß"ØÒØ×!Ñ!Ð$:Ô:ä‹�‰×ÑØMØ×!Ñ!Ð#9ô	
ð !7ÔØ××Ð U×%5×%5Ð%5ä‹�‰×ÑØ?Ø×!Ñ!Ø&/Ò&;Ñ"ÐAbö	
ñ &6Ñøô1 œ:Ð&ô 	UÜ‹E�L‰L×ÑÐHÈ)×Tð	Uûô ô 	QÜ‹E�L‰L×ÑÐJÈC×PÒPûð	Qús6   ¶F4 ÂAG0 ÃG0 Ã$G0 Æ45G-Ç,G-Ç0H*Ç;$H%È%H*c           
     óè  € \        V P                  R ^ 4      ;'       g    ^ pV P                  '       d¿   V P                  ^ 8”  d¬   V'       d¢   V P                  V8  d�   \        4       P                  P                  RWP                  4       V P                  P                  V P                  V P                  V P                  \        V RR4      V P                  V P                  R7       R# R# R# R# R# )Úcontext_lengthz5Compressor window clamped to Ollama num_ctx: %d -> %dr	   r   )r   r#   r   r	   ÚproviderÚapi_modeN)ÚgetattrÚcontext_compressorr
   r   r   r   Úupdate_modelr   r   r$   r%   )r   Ú
_cc_windows   & r    Ú#_clamp_compressor_to_ollama_num_ctxr*   2   sÄ   € ô ˜×1Ñ1Ð3CÀQÓG×LÐLÈ1€JØ××Ð ×!6Ñ!6¸Ô!:¿zÈe×NcÑNcÐfpÔNpÜ‹�‰×ÑØCØ×-Ñ-ô	
ð 	× Ñ ×-Ñ-Ø—+‘+¨e×.CÑ.CÈeÏnÉnÜ˜E 9¨bÓ1¸E¿N¹NÐUZ×UcÑUcð 	.ö 	
ñ Oq¹zÑ!:Ñó    N)
Ú__doc__Ú
__future__r   Úagent.agent_runtime_helpersr   Úagent.model_metadatar   r   r!   r*   © r+   r    Ú<module>r1      s   ðÙ Wå "å +ß Hò&
ôR
r+   