Ë
    âß²jV  ã                   óŒ   — d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
  G d„ de
«      Z edd	d
dddddddd¬«      Z ee«       y)zgDeepInfra provider profile (chat surface; image-gen/TTS/STT are wired via
their own plugin subsystems).é    )ÚAny)ÚOPENAI_COMPAT_WIRE_EFFORTSÚclamp_effortÚrequested_effort)Úregister_provider)ÚProviderProfilec                   óT   — e Zd ZdZddœdedz  dedeeeef   eeef   f   fd„Zd„ Z	y)	Ú_DeepInfraProfilez�DeepInfra profile with live vision-default discovery, so shared vision
    resolution in ``agent/auxiliary_client.py`` stays provider-agnostic.N)Úreasoning_configr   ÚcontextÚreturnc                ó®   — t        |t        «      r|j                  d«      du ri ddifS t        |«      }t	        |t
        «      }|t
        v ri d|ifS i i fS )u  Map Hermes reasoning controls to DeepInfra's top-level ``reasoning_effort``.

        DeepInfra applies a per-model default when the field is absent (DeepSeek-V4.x off,
        GLM/Qwen-Thinking on), so ``none`` is the only working off switch and an unset effort
        is omitted rather than guessed. The core ``_supports_reasoning_extra_body`` allowlist
        does not know this host, so the transport always passes ``supports_reasoning=False``
        here â€” gating on it would make the method a permanent no-op (#111872).
        ÚenabledFÚreasoning_effortÚnone)Ú
isinstanceÚdictÚgetr   r   r   )Úselfr   r   ÚeffortÚclampeds        úO/home/ubuntu/.hermes/hermes-agent/plugins/model-providers/deepinfra/__init__.pyÚbuild_api_kwargs_extrasz)_DeepInfraProfile.build_api_kwargs_extras   sq   € ô Ð&¬Ô-Ð2B×2FÑ2FÀyÓ2QÐUZÑ2ZØÐ*¨FÐ3Ð3Ð3Ü!Ð"2Ó3ˆÜ˜vÔ'AÓBˆØ6=ÔA[Ñ6[�Ð'¨Ð1Ð2ÐiÐbdÐfhÐaiÐió    c                 ód  — ddl m}  |d«      xs dj                  «       sy	 ddlm}  |d«      }|xs g D ]h  }|j                  d«      xs i }t        |t        «      r|j                  d	«      nd}t        |t        «      sŒLd
|v sŒQ|j                  d«      sŒc|d   c S  y# t
        $ r Y yw xY w)a  First vision-capable *chat* model from the live catalog, or None. Key-gated so a box
        without DEEPINFRA_API_KEY never pays the round-trip; requires the ``chat`` surface tag so
        an image-gen model carrying a ``vision`` tag can't be picked as a chat vision backend.r   )Ú
get_secretÚDEEPINFRA_API_KEYÚ N)Ú_fetch_deepinfra_models_by_tagÚchatÚmetadataÚtagsÚvisionÚid)
Úagent.secret_scoper   ÚstripÚhermes_cli.modelsr   Ú	Exceptionr   r   r   Úlist)r   r   r   ÚitemsÚitemr!   r"   s          r   Údefault_vision_modelz&_DeepInfraProfile.default_vision_model    s²   € õ 	2áÐ.Ó/Ò5°2×<Ñ<Ô>Øð	ÝHÙ2°6Ó:ˆEð ’K˜Rò 	"ˆDØ—x‘x 
Ó+Ò1¨rˆHÜ+5°hÄÔ+E�8—<‘< Ô'È4ˆDÜ˜$¤Õ%¨(°dÒ*:¸t¿x¹xÈ½~Ø˜D‘zÒ!ð		"ð
 øô ò 	Ùð	ús   £B# Â#	B/Â.B/)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   ÚtupleÚstrr   r,   © r   r   r
   r
      sQ   „ ñLð 26òjØ#'¨$¡;ðjØBEðjà	ˆt�C˜�H‰~˜t C¨ H™~Ð-Ñ	.ójó"r   r
   Ú	deepinfra)z
deep-infrazdeepinfra-aiÚ	DeepInfrau+   DeepInfra â€” 100+ open models, pay-per-usez#https://deepinfra.com/dash/api_keys)r   ÚDEEPINFRA_BASE_URLz#https://api.deepinfra.com/v1/openaiÚapi_keyNzdeepseek-ai/DeepSeek-V4-Flashr3   )ÚnameÚaliasesÚdisplay_nameÚdescriptionÚ
signup_urlÚenv_varsÚbase_urlÚ	auth_typeÚdefault_max_tokensÚdefault_aux_modelÚfallback_models)r0   Útypingr   Úagent.reasoning_effortr   r   r   Ú	providersr   Úproviders.baser   r
   r4   r3   r   r   ú<module>rG      sb   ðñ!õ ç ]Ñ ]Ý 'Ý *ô'˜ô 'ñT Ø	Ð<È;Ø=ÐJoØ8ÐChØØð 6ð ô€	ñ �)Õ r   