
    iw	                    :    d dl mZ ddZ	 dddZ	 dddZddZdS )    )annotationsrawobjectreturnfloat | Nonec                h    	 t          |           }n# t          t          f$ r Y d S w xY w|dk    rd S |S )Nr   )float	TypeError
ValueError)r   timeouts     8/home/ubuntu/.hermes/hermes-agent/hermes_cli/timeouts.py_coerce_timeoutr      sN    **z"   tt!||tNs    ''Nprovider_idstrmodel
str | Nonec                   | sdS 	 ddl m}  |            }n# t          $ r Y dS w xY wt          |t                    r|                    di           ni }t          |t                    r|                    | i           ni }t          |t                    sdS t          ||          }|&t          |                    d                    }||S t          |                    d                    S )z@Return a configured provider request timeout in seconds, if any.Nr   load_config	providerstimeout_secondsrequest_timeout_secondshermes_cli.configr   	Exception
isinstancedictget_get_model_configr   r   r   r   configr   provider_configmodel_configr   s           r   get_provider_request_timeoutr$      s     t111111   tt 0:&$/G/GO

;+++RI*4Y*E*EM	k2&&&2  ot,, t$_e<<L!,"2"23D"E"EFFN?../HIIJJJ    
%%c                   | sdS 	 ddl m}  |            }n# t          $ r Y dS w xY wt          |t                    r|                    di           ni }t          |t                    r|                    | i           ni }t          |t                    sdS t          ||          }|&t          |                    d                    }||S t          |                    d                    S )z@Return a configured non-stream stale timeout in seconds, if any.Nr   r   r   stale_timeout_secondsr   r    s           r   get_provider_stale_timeoutr(   +   s     t111111   tt 0:&$/G/GO

;+++RI*4Y*E*EM	k2&&&2  ot,, t$_e<<L!,"2"23J"K"KLLN?../FGGHHHr%   r"   dict[str, object]dict[str, object] | Nonec                    |sd S |                      di           }t          |t                    r|                     |i           ni }t          |t                    r|S d S )Nmodels)r   r   r   )r"   r   r,   r#   s       r   r   r   H   sj      t  2..F,6vt,D,DL6::eR((("L,%% 4    )r   r   r   r   )N)r   r   r   r   r   r   )r"   r)   r   r   r   r*   )
__future__r   r   r$   r(   r    r-   r   <module>r0      s    " " " " " "    +/K K K K K< +/I I I I I:
 
 
 
 
 
r-   