
    (GjW              	           d 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dd          Z ee           dS )u  Google Vertex AI provider profile.

vertex: Gemini models via Google Cloud's OpenAI-compatible endpoint.

Auth is OAuth2 — short-lived access tokens minted from a service-account JSON
or Application Default Credentials (ADC), NOT a static API key. Token
resolution and refresh live in ``agent/vertex_adapter.py``; runtime_provider.py
calls it to obtain a fresh ``(token, base_url)`` pair, then hands the token to
the standard OpenAI client as ``api_key``. Because the wire format is the
OpenAI-compatible chat/completions surface, no message translation is needed —
the only Gemini-specific concern is the ``thinking_config`` reasoning hook,
which is emitted here exactly as the ``gemini`` provider does for its
OpenAI-compat subpath (``extra_body.google.thinking_config``).

``auth_type="vertex"`` marks this as an OAuth-token provider (resolved
specially, like bedrock's ``aws_sdk``) so it is never treated as an
api_key provider that would mistake a credentials-file path for a key.
    )Any)register_provider)ProviderProfilec            
           e Zd ZdZdddedz  dedeeef         fdZdddd	d
edz  dedz  dede	e         dz  fdZ
dS )VertexProfileuH   Vertex AI — reuse Gemini's thinking_config translation for extra_body.N)
session_idr   contextreturnc                    ddl m}m} |                    d          pd}|                    d          } |||          }|si S  ||          }|si S ddd|iiiS )	zEmit ``extra_body.google.thinking_config`` for the OpenAI-compat
        Vertex surface, mirroring the ``gemini`` provider's behavior.
        r   )_build_gemini_thinking_config"_snake_case_gemini_thinking_configmodel reasoning_config
extra_bodygooglethinking_config)!agent.transports.chat_completionsr   r   get)	selfr   r	   r   r   r   r   raw_thinking_configr   s	            M/home/rurouni/.hermes/hermes-agent/plugins/model-providers/vertex/__init__.pybuild_extra_bodyzVertexProfile.build_extra_body   s    	
 	
 	
 	
 	
 	
 	
 	

 G$$*";;'9::;;ECSTT" 	I<<=PQQ 	Ix*;_)MNOO    g       @)api_keybase_urltimeoutr   r   r   c                    dS )zVertex's OpenAI-compat endpoint has no ``/models`` listing route;
        model discovery is not available. The setup wizard ships a curated list.
        N )r   r   r   r   s       r   fetch_modelszVertexProfile.fetch_models4   s	     tr   )__name__
__module____qualname____doc__strr   dictr   floatlistr    r   r   r   r   r      s        RR +/P P P 4ZP;>P	c3hP P P P4 ##
 
 
 t
 *	

 
 
cT	
 
 
 
 
 
r   r   vertex)zgoogle-vertexz	vertex-aiz
gcp-vertexchat_completionsr   z!https://aiplatform.googleapis.comzgoogle/gemini-3-flash-preview)namealiasesapi_modeenv_varsr   	auth_typedefault_aux_modelN)	r$   typingr   	providersr   providers.baser   r   r)   r   r   r   <module>r4      s    &       ' ' ' ' ' ' * * * * * *$ $ $ $ $O $ $ $N 
	805
 
 
  &     r   