
    {h                       d dl mZ d dlZd dlZd dlmZmZ eej                  j                  df	 	 	 	 	 	 	 	 	 dd       Z	eej                  j                  df	 	 	 	 	 	 	 	 	 d	d       Z	ej                  j                  df	 	 	 	 	 	 	 	 	 d
dZ	y)    )annotationsN)overloadAnyFc                     y N clientmodebetakwargss       \/var/www/html/hubwallet-dev/venv/lib/python3.12/site-packages/instructor/client_anthropic.pyfrom_anthropicr   	   s          c                     y r   r   r	   s       r   r   r      s     "%r   c           
        t         j                  j                  t         j                  j                  t         j                  j                  t         j                  j
                  h}||vr1ddlm}  |t        |      d|D cg c]  }t        |       c}      t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  f}t!        | |      s=ddlm}  |ddj%                  d |D               d	t'        |       j(                         |r!| j*                  j,                  j.                  }	n| j,                  j.                  }	t!        | t        j                  t        j                  t        j                  f      rGt        j0                  d| t        j2                  |	|
      t         j4                  j6                  |d|S t        j8                  d| t        j2                  |	|
      t         j4                  j6                  |d|S c c}w )aq  Create an Instructor instance from an Anthropic client.

    Args:
        client: An instance of Anthropic client (sync or async)
        mode: The mode to use for the client (ANTHROPIC_JSON or ANTHROPIC_TOOLS)
        beta: Whether to use beta API features (uses client.beta.messages.create)
        **kwargs: Additional keyword arguments to pass to the Instructor constructor

    Returns:
        An Instructor instance (sync or async depending on the client type)

    Raises:
        ModeError: If mode is not one of the valid Anthropic modes
        ClientError: If client is not a valid Anthropic client instance
    r   )	ModeError	Anthropic)r   providervalid_modes)ClientErrorz&Client must be an instance of one of: z, c              3  4   K   | ]  }|j                     y wr   )__name__).0ts     r   	<genexpr>z!from_anthropic.<locals>.<genexpr>Z   s     >faqzz>fs   z. Got: )creater   )r
   r   r   r   r   )
instructorModeANTHROPIC_JSONANTHROPIC_TOOLSANTHROPIC_REASONING_TOOLSANTHROPIC_PARALLEL_TOOLSinstructor.exceptionsr   str	anthropicr   AsyncAnthropicAnthropicBedrockAnthropicVertexAsyncAnthropicBedrockAsyncAnthropicVertex
isinstancer   jointyper   r   messagesr   
InstructorpatchProvider	ANTHROPICAsyncInstructor)
r
   r   r   r   r   r   mvalid_client_typesr   r   s
             r   r   r   !   s   : 	&&''1100	K ;3T )45AQ5
 	
 	  ""!!''&& f0154TYY>fSe>f5f4g hL))*,
 	

 %%,,''			i88):S:ST $$ 
##6=((22	

 
 	
 )) 
##6=((22	

 
 	
M 6s   I)
r
   zLanthropic.Anthropic | anthropic.AnthropicBedrock | anthropic.AnthropicVertexr   instructor.Moder   boolr   r   returnzinstructor.Instructor)
r
   z[anthropic.AsyncAnthropic | anthropic.AsyncAnthropicBedrock | anthropic.AsyncAnthropicVertexr   r7   r   r8   r   r   r9   zinstructor.AsyncInstructor)
r
   zanthropic.Anthropic | anthropic.AsyncAnthropic | anthropic.AnthropicBedrock | anthropic.AsyncAnthropicBedrock | anthropic.AsyncAnthropicVertex | anthropic.AnthropicVertexr   r7   r   r8   r   r   r9   z2instructor.Instructor | instructor.AsyncInstructor)

__future__r   r&   r   typingr   r   r   r!   r   r   r   r   <module>r<      s   "     

 'OO;; T  	 
       
  
 'OO;;	%	)	% 	% 	% 	%  	% 
	%* 'OO;;U
	$U
 U
 U
 U
 8U
r   