
    5i                        d Z ddlmZ ddlZddlmZmZ ddlZddlm	Z	  ej                  e      Z ede	      Z G d d	      Zy)
uA   
Base agent class – wraps instructor for structured LLM calls.
    )annotationsN)TypeTypeVar)	BaseModelT)boundc                  @    e Zd ZdZdddZddd	 	 	 	 	 	 	 	 	 	 	 d	dZy)
	BaseAgentzHThin wrapper around *instructor* that provides a unified call interface.c                X    || _         t        j                  |d      | _        || _        y )NF)async_client)model
instructorfrom_providerclientmax_retries)selfr   r   s      :/root/.openclaw/workspace/visionaryfx/agents/base_agent.py__init__zBaseAgent.__init__   s%    
 ..u5I&    gffffff?N)temperature
max_tokensc                  t         j                  d| j                  |j                         t	        | j                  j                  dd      d   d|dd|dg||| j                        }|||d	<    | j                  j                  j                  j                  di |}t         j                  d
|j                         |S )zBSend a structured completion request and return a validated model.z'Agent call  model=%s  response_model=%s/   system)rolecontentuser)r   messagesresponse_modelr   r   r   zAgent response received for %s )loggerdebugr   __name__dictsplitr   r   chatcompletionscreate)r   system_promptuser_promptr!   r   r   kwargsresults           r   callzBaseAgent.call   s     	5JJ##	

 **""3*2.!m<K8 *#((	
 !#-F< 4!!--44>v>5~7N7NOr   )zopenai/gpt-4o   )r   strr   int)r+   r1   r,   r1   r!   zType[T]r   floatr   z
int | Nonereturnr   )r%   
__module____qualname____doc__r   r/   r"   r   r   r
   r
      sS    R' !!%  	
     
r   r
   )r7   
__future__r   loggingtypingr   r   r   pydanticr   	getLoggerr%   r#   r   r
   r"   r   r   <module>r=      sC    #     			8	$Cy!( (r   