+
    ~jC              	      T   ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIHtHt ^ RI	H
t
HtHt ^ RIHt ^ RIHtHt ^ RIHtHtHtHtHtHtHt ^ RIHtHtHtHtHt ^R	I H!t! ^R
I"H#t# ]'       d   ^RI$H%t%  ! R R]4      t& ! R R]&4      t' ! R R4      t( ! R R]RR7      t) ! R R]RR7      t*]*]RL,          ,          t+ ! R R],4      t- ! R R],4      t. ! R R]4      t/] ! R R4      4       t0 ! R  R!]4      t1] ! R" R#4      4       t2]! R$]0]24      t3]! R%4      t4]! R&]
],          R'7      t5 ! R( R)]&]]3]4]53,          4      t6 ! R* R+]6]0]4]53,          4      t7 ! R, R-]6]2]4]53,          4      t8]R.]/Pr                  /R/ R0 ll4       t:]RMR.]/Pr                  /R1 R2 lll4       t:]R3RR4RR.]/Pr                  /R5 R6 ll4       t:]RMR3RR4RR.]/Pr                  /R7 R8 lll4       t:RMR3RR4RR9RR.]/Pr                  /R: R; lllt:R< R= lt;R> R? lt<R@ RA lt=RB RC lt>RD RE lt?RF RG lt@RH RI ltA ! RJ RK4      tBR# )N    )annotationsN)ABCabstractmethod)	AwaitableCallableSequence)	dataclass)Flagauto)TYPE_CHECKINGAnyGenericLiteral	TypeGuardTypeVaroverload)NotRequired	ParamSpecRequiredSelf	TypedDict)logger)_provider_format)
RunContextc                  6    ] tR t^$t]]R R l4       4       tRtR# )Toolc                   V ^8  d   QhRR/#    returnstr )formats   "t/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/livekit/agents/llm/tool_context.py__annotate__Tool.__annotate__'   s    C    c                	    R # Nr"   selfs   &r$   idTool.id%   s    r'   r"   N)__name__
__module____qualname____firstlineno__propertyr   r,   __static_attributes__r"   r'   r$   r   r   $   s      r'   r   c                  8    ] tR t^*tR R lt]R R l4       tRtR# )ProviderToolc                    V ^8  d   QhRRRR/# )r   r,   r!   r    Noner"   )r#   s   "r$   r%   ProviderTool.__annotate__+   s      c d r'   c               	    Wn         R # r)   _id)r+   r,   s   &$r$   __init__ProviderTool.__init__+   s    r'   c                   V ^8  d   QhRR/# r   r"   )r#   s   "r$   r%   r8   /         C r'   c                	    V P                   # r)   r:   r*   s   &r$   r,   ProviderTool.id.       xxr'   r:   N)r.   r/   r0   r1   r<   r2   r,   r3   r"   r'   r$   r5   r5   *   s      r'   r5   c                      ] tR t^3t] ! R R4      4       t] ! R R4      4       tRR/R R llt]R	 R
 l4       t	]R R l4       t
R R ltR R ltRtR# )Toolsetc                  ,    ] tR t^4t$ R]R&   R]R&   RtR# )Toolset.ToolCalledEventr   ctxdict[str, Any]	argumentsr"   Nr.   r/   r0   r1   __annotations__r3   r"   r'   r$   ToolCalledEventrF   4   s    !!r'   rL   c                  ,    ] tR t^9t$ R]R&   R]R&   RtR# )Toolset.ToolCompletedEventr   rG   zAny | Exception | Noneoutputr"   NrJ   r"   r'   r$   ToolCompletedEventrN   9   s    &&r'   rP   toolsNc               $    V ^8  d   QhRRRRRR/# )r   r,   r!   rQ   zSequence[Tool | Toolset] | Noner    r7   r"   )r#   s   "r$   r%   Toolset.__annotate__>   s#     6 6c 6*I 6UY 6r'   c               	    Wn         Ve   \        V4      M. V n        V P                  P                  \	        V 4      4       R # r)   )r;   list_toolsextendfind_function_tools)r+   r,   rQ   s   &$$r$   r<   Toolset.__init__>   s2    ?D?PUVX.t45r'   c                   V ^8  d   QhRR/# r   r"   )r#   s   "r$   r%   rS   D   r?   r'   c                	    V P                   # r)   r:   r*   s   &r$   r,   
Toolset.idC   rB   r'   c                   V ^8  d   QhRR/# )r   r    Sequence[Tool | Toolset]r"   )r#   s   "r$   r%   rS   H   s      / r'   c                	    V P                   # r)   )rV   r*   s   &r$   rQ   Toolset.toolsG   s    {{r'   c                   V ^8  d   QhRR/# )r   r    r   r"   )r#   s   "r$   r%   rS   K   s      T r'   c                   "   V P                    Uu. uF  p\        V\        4      '       g   K  VNK  	  ppV'       d$   \        P                  ! R V 4       !  G Rj  xL
  V # u upi  L5i)zqInitialize the toolset and any nested toolsets.

Called automatically by ``AgentActivity`` when an agent starts.
c              3  @   "   T F  qP                  4       x  K  	  R # 5ir)   )setup.0toolsets   & r$   	<genexpr> Toolset.setup.<locals>.<genexpr>R   s     "K(w==??(   N)rQ   
isinstancerD   asynciogatherr+   tooltoolsetss   &  r$   rd   Toolset.setupK   sS     
 &*ZZMZT:dG3LDDZM.."K("KLLL NLs    A*A#A#(A*A(A*c                   V ^8  d   QhRR/# r   r    r7   r"   )r#   s   "r$   r%   rS   U   s     
N 
Nd 
Nr'   c                   "   V P                    Uu. uF  p\        V\        4      '       g   K  VNK  	  ppV'       d&   \        P                  ! R V 4       !  G Rj  xL
  R# R# u upi  L5i)a3  Close the toolset and release any held resources.

Agent-scoped toolsets (passed to ``Agent(tools=...)``) are closed when the
``AgentActivity`` ends (on agent transition or session close). Session-scoped
toolsets (passed to ``AgentSession(tools=...)``) are closed only when the
``AgentSession`` shuts down.
c              3  @   "   T F  qP                  4       x  K  	  R # 5ir)   )aclosere   s   & r$   rh   !Toolset.aclose.<locals>.<genexpr>_   s     "L8>>#3#38rj   N)rV   rk   rD   rl   rm   rn   s   &  r$   rv   Toolset.acloseU   sS      &*[[N[TJtW4MDD[N.."L8"LMMM  OMs    A,A%A%(A,A*A,)r;   rV   )r.   r/   r0   r1   r	   rL   rP   r<   r2   r,   rQ   rd   rv   r3   r"   r'   r$   rD   rD   3   sw    " " " ' ' '6D 6
    
N 
Nr'   rD   c                  "    ] tR t^ct$ R]R&   RtR# )FunctionzRequired[str]namer"   NrJ   r"   r'   r$   rz   rz   c   s    
r'   rz   F)totalc                  ,    ] tR t^gt$ R]R&   R]R&   RtR# )NamedToolChoicezRequired[Literal['function']]typezRequired[Function]functionr"   NrJ   r"   r'   r$   r~   r~   g   s    
''  r'   r~   c                  D   a  ] tR t^otR V 3R llt]R R l4       tRtV ;t# )	ToolErrorc                    V ^8  d   QhRRRR/# )r   messager!   r    r7   r"   )r#   s   "r$   r%   ToolError.__annotate__p   s     
  
  
  
 r'   c                2   < \         SV `  V4       Wn        R# )a  
Exception raised within AI functions.

This exception should be raised by users when an error occurs
in the context of AI operations. The provided message will be
visible to the LLM, allowing it to understand the context of
the error during FunctionOutput generation.
N)superr<   _message)r+   r   	__class__s   &&r$   r<   ToolError.__init__p   s     	!r'   c                   V ^8  d   QhRR/# r   r"   )r#   s   "r$   r%   r   }   s       r'   c                	    V P                   # r)   r   r*   s   &r$   r   ToolError.message|   s    }}r'   r   )	r.   r/   r0   r1   r<   r2   r   r3   __classcell__r   s   @r$   r   r   o   s!    
  
   r'   r   c                  .   a  ] tR t^tR V 3R lltRtV ;t# )StopResponsec                   V ^8  d   QhRR/# rs   r"   )r#   s   "r$   r%   StopResponse.__annotate__   s      $ r'   c                $   < \         SV `  4        R# )z
Exception raised within AI functions.

This exception can be raised by the user to indicate that
the agent should not generate a response for the current
function call.
N)r   r<   )r+   r   s   &r$   r<   StopResponse.__init__   s     	r'   r"   )r.   r/   r0   r1   r<   r3   r   r   s   @r$   r   r      s     r'   r   c                  (    ] tR t^t^ t]! 4       tRtR# )ToolFlagr"   N)r.   r/   r0   r1   NONEr   IGNORE_ON_ENTERr3   r"   r'   r$   r   r      s    DfOr'   r   c                  6    ] tR t^t$ R]R&   R]R&   R]R&   RtR# )	FunctionToolInfor!   r{   
str | Nonedescriptionr   flagsr"   NrJ   r"   r'   r$   r   r      s    
IOr'   r   c                  :    ] tR t^t$ RtR]R&   R]R&   R]R&   RtR	# )
RawFunctionDescriptionaZ  
Represents the raw function schema format used in LLM function calling APIs.

This structure directly maps to OpenAI's function definition format as documented at:
https://platform.openai.com/docs/guides/function-calling?api-mode=responses

It is also compatible with other LLM providers that support raw JSON Schema-based
function definitions.
r!   r{   zNotRequired[str | None]r   zdict[str, object]
parametersr"   N)r.   r/   r0   r1   __doc__rK   r3   r"   r'   r$   r   r      s     I((!!r'   r   c                  6    ] tR t^t$ R]R&   R]R&   R]R&   RtR# )	RawFunctionToolInfor!   r{   rH   
raw_schemar   r   r"   NrJ   r"   r'   r$   r   r      s    
IOr'   r   _InfoT_P_R)boundc                  r    ] tR t^tRtRR R llt]R R l4       t]R R l4       tRR	 R
 llt	R R lt
RtR# )_BaseFunctionToolz>Base class for function tool wrappers with descriptor support.Nc               (    V ^8  d   QhRRRRRRRR/# )	r   funcCallable[_P, _R]infor   instancer   r    r7   r"   )r#   s   "r$   r%   _BaseFunctionTool.__annotate__   s*     " "- "V "s "VZ "r'   c                	V    \         P                  ! W4       Wn        W n        W0n        R # r)   )	functoolsupdate_wrapper_func_info	_instance)r+   r   r   r   s   &&&&r$   r<   _BaseFunctionTool.__init__   s      ,
!
!r'   c                   V ^8  d   QhRR/# r   r"   )r#   s   "r$   r%   r      s      C r'   c                	.    V P                   P                  # r)   )r   r{   r*   s   &r$   r,   _BaseFunctionTool.id   s    zzr'   c                   V ^8  d   QhRR/# )r   r    r   r"   )r#   s   "r$   r%   r      s      f r'   c                	    V P                   # r)   )r   r*   s   &r$   r   _BaseFunctionTool.info   s    zzr'   c               $    V ^8  d   QhRRRRRR/# )r   objr   objtypeztype | Noner    r   r"   )r#   s   "r$   r%   r      s!     
 
3 
 
 
r'   c                	$   Vf   V # V P                  V P                  V P                  VR7      p\        P                  ! V P                  4      p\        VP                  P                  4       4      R,          pVP                  VR7      Vn	        V# )N)r   :   NN)r   )
r   r   r   inspect	signaturerU   r   valuesreplace__signature__)r+   r   r   
bound_toolsigparamss   &&&   r$   __get___BaseFunctionTool.__get__   ss    ;K ^^DJJ

S^I


+cnn++-.r2#&;;&;#A
 r'   c               $    V ^8  d   QhRRRRRR/# )r   argsz_P.argskwargsz	_P.kwargsr    r   r"   )r#   s   "r$   r%   r      s!     + +g + +r +r'   c                	    V P                   e!   V P                  ! V P                   .VO5/ VB # V P                  ! V/ VB # r)   )r   r   )r+   r   r   s   &*,r$   __call___BaseFunctionTool.__call__   s=    >>%::dnn>t>v>>zz4*6**r'   )r   r   r   r)   )r.   r/   r0   r1   r   r<   r2   r,   r   r   r   r3   r"   r'   r$   r   r      sA    H"    
+ +r'   r   c                  6   a  ] tR t^tRtRR V 3R llltRtV ;t# )FunctionToolz4Wrapper for a function decorated with @function_toolc               (    V ^8  d   QhRRRRRRRR/# )	r   r   r   r   r   r   r   r    r7   r"   )r#   s   "r$   r%   FunctionTool.__annotate__   s,     9 9$9,<9HK9	9r'   c                	V   < \         SV `  WV4       \        V R V P                  4       R# )__livekit_tool_infoNr   r<   setattrr   r+   r   r   r   r   s   &&&&r$   r<   FunctionTool.__init__   s%     	X.+TZZ8r'   r"   r)   r.   r/   r0   r1   r   r<   r3   r   r   s   @r$   r   r      s    >9 9 9r'   r   c                  6   a  ] tR t^tRtRR V 3R llltRtV ;t# )RawFunctionToolzDWrapper for a function decorated with @function_tool(raw_schema=...)c               (    V ^8  d   QhRRRRRRRR/# )	r   r   r   r   r   r   r   r    r7   r"   )r#   s   "r$   r%   RawFunctionTool.__annotate__   s,     = =$=,?=KN=	=r'   c                	V   < \         SV `  WV4       \        V R V P                  4       R# )__livekit_raw_tool_infoNr   r   s   &&&&r$   r<   RawFunctionTool.__init__   s%     	X./<r'   r"   r)   r   r   s   @r$   r   r      s    N= = =r'   r   r   c               (    V ^8  d   QhRRRRRRRR/# )	r   fr   r   'RawFunctionDescription | dict[str, Any]r   r   r    RawFunctionTool[_P, _R]r"   )r#   s   "r$   r%   r%      s2     " "" 8" 	"
 "r'   c                   R # r)   r"   r   r   r   s   &$$r$   function_toolr      s     "r'   c               (    V ^8  d   QhRRRRRRRR/# )	r   r   r7   r   r   r   r   r    z5Callable[[Callable[_P, _R]], RawFunctionTool[_P, _R]]r"   )r#   s   "r$   r%   r%      s8     @ @@ 8@ 	@
 ;@r'   c                   R # r)   r"   r   s   &$$r$   r   r      s     =@r'   r{   r   c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r   r   r   r{   r   r   r   r   r    FunctionTool[_P, _R]r"   )r#   s   "r$   r%   r%      s<        	
  r'   c                   R # r)   r"   r   r{   r   r   s   &$$$r$   r   r      s     r'   c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r   r   r7   r{   r   r   r   r   r    z2Callable[[Callable[_P, _R]], FunctionTool[_P, _R]]r"   )r#   s   "r$   r%   r%   	  s<     = == = 	=
 = 8=r'   c                   R # r)   r"   r   s   &$$$r$   r   r     s     :=r'   r   c               0    V ^8  d   QhRRRRRRRRRR	R
R/# )r   r   zCallable[_P, _R] | Noner{   r   r   r   z.RawFunctionDescription | dict[str, Any] | Noner   r   r    zFunctionTool[_P, _R] | RawFunctionTool[_P, _R] | Callable[[Callable[_P, _R]], FunctionTool[_P, _R]] | Callable[[Callable[_P, _R]], RawFunctionTool[_P, _R]]r"   )r#   s   "r$   r%   r%     sF     .= .=.= .= 	.=
 ?.= .=<.=r'   c               t   aaaa R  VV3R llpR VVV3R llpV e   Se	   V! V 4      # V! V 4      # Se   V# T# )c                    V ^8  d   QhRRRR/# )r   r   r   r    r   r"   )r#   s   "r$   r%   #function_tool.<locals>.__annotate__  s     + ++	 +r'   c                   < Sf   Q hSP                  R4      '       g   \        R4      hRS9  d   \        R4      h\        SR,          / SCSR7      p\        W4      # )Nr{   z!raw function name cannot be emptyr   z6raw function description must contain a parameters key)r{   r   r   )get
ValueErrorr   r   )r   r   r   r   s   & r$   deco_rawfunction_tool.<locals>.deco_raw  si     %%%~~f%%@AAz)UVV"F#%*~

 t**r'   c                    V ^8  d   QhRRRR/# )r   r   r   r    r   r"   )r#   s   "r$   r%   r   2  s     	( 	(( 	(-A 	(r'   c                   < ^ RI Hp V! V 4      p\        S;'       g    V P                  S;'       g    VP                  SR7      p\        W4      # )r   )parse_from_object)r{   r   r   )docstring_parserr  r   r.   r   r   )r   r  	docstringr   r   r   r{   s   &   r$   	deco_func function_tool.<locals>.deco_func2  sJ    6%d+	&&#<<y'<'<

 D''r'   r"   )r   r{   r   r   r   r   r  s   &dddd  r$   r   r     sF    + +&	( 	( 	}(4x{F)A,F!-8<9<r'   c                    V ^8  d   QhRRRR/# )r   r   r   r    zTypeGuard[FunctionTool]r"   )r#   s   "r$   r%   r%   C  s     ' ' ' 7 'r'   c                "    \        V \        4      # r)   )rk   r   r   s   &r$   is_function_toolr	  C  s    a&&r'   c                    V ^8  d   QhRRRR/# )r   r   r   r    r   r"   )r#   s   "r$   r%   r%   H  s       *: r'   c                    V P                   # r)   r   r  s   &r$   get_function_infor  H      66Mr'   c                    V ^8  d   QhRRRR/# )r   r   r   r    zTypeGuard[RawFunctionTool]r"   )r#   s   "r$   r%   r%   L  s     * *C *$> *r'   c                "    \        V \        4      # r)   )rk   r   r  s   &r$   is_raw_function_toolr  L  s    a))r'   c                    V ^8  d   QhRRRR/# )r   r   r   r    r   r"   )r#   s   "r$   r%   r%   P  s      _ 1D r'   c                    V P                   # r)   r  r  s   &r$   get_raw_function_infor  P  r  r'   c                    V ^8  d   QhRRRR/# )r   ro   r   r    %FunctionTool | RawFunctionTool | Noner"   )r#   s   "r$   r%   r%   T  s     $ $ $(M $r'   c                ~   \        V 4      '       g   R# \        V \        \        34      '       d   V # Rp\	        V R4      '       dO   \        V P
                  \        \        34      '       d)   V P
                  pVP                  WP                  4      pMm\        V RR4      ;p'       d#   \        V\        4      '       d   \        W4      pM6\        V RR4      ;p'       d"   \        V\        4      '       d   \        W4      pV'       d5   VP                  P                  p\        P                  ! RV R2RV/R7       V# )	zKConvert a wrapped tool to a FunctionTool or RawFunctionTool with a warning.N__wrapped__r   r   zfunction tool z is wrapped, this may cause unexpected behavior and not be supported in future versions, please wrap the original function before converting to a function tool.r   )extra)callablerk   r   r   hasattrr  r   r   getattrr   r   r{   r   warning)ro   resolved_toolwrappedr   	tool_names   &    r$   _resolve_wrapped_toolr!  T  s   D>>$788;?Mm$$t'',)HII""))$=$ 5t<
<$
<*C C %T0$ 94@
@$
@j!G G (3!&&++	YK (V V  	
 r'   c                    V ^8  d   QhRRRR/# )r   
cls_or_objr   r    z$list[FunctionTool | RawFunctionTool]r"   )r#   s   "r$   r%   r%   {  s      C ,P r'   c                    . p\         P                  ! V 4       FZ  w  r#\        V\        \        34      '       d   VP                  V4       K4  \        V4      ;p'       g   KI  VP                  V4       K\  	  V# r)   )r   
getmembersrk   r   r   appendr!  )r#  methods_membernormalized_tools   &    r$   rX   rX   {  sb    46G''
3	f|_=>>NN6" 5f ==_==NN?+	 4 Nr'   c                    V ^8  d   QhRRRR/# )r   rQ   r^   r    z	list[str]r"   )r#   s   "r$   r%   r%     s     	 	6 	9 	r'   c                   . pV  F  p\        V\        \        34      '       d(   VP                  VP                  P
                  4       KF  \        V\        4      '       g   K^  VP                  \        VP                  4      4       K  	  V# )zSGet names of all function and raw function tools in the list, unwrapping tool sets.)
rk   r   r   r&  r   r{   rD   rW   get_fnc_tool_namesrQ   )rQ   namesro   s   &  r$   r-  r-    sa    Ed\?;<<LL(g&&LL+DJJ78	  Lr'   c                  :   ] tR tRtRtR R lt]R R l4       t]R R l4       t	]R	 R
 l4       t
]R R l4       tR R ltR R ltR R ltR R ltR R lt]RR/R R ll4       t]RRRR/R R ll4       t]R  R! l4       t]RR/R" R# ll4       tR$ R% ltR&tR# )'ToolContexti  z-Stateless container for a set of AI functionsc                    V ^8  d   QhRRRR/# r   rQ   r^   r    r7   r"   )r#   s   "r$   r%   ToolContext.__annotate__  s     ! !6 !4 !r'   c                	(    V P                  V4       R # r)   )update_toolsr+   rQ   s   &&r$   r<   ToolContext.__init__  s    % r'   c                   V ^8  d   QhRR/# r   r    r0  r"   )r#   s   "r$   r%   r3    s      k r'   c                	    V ! . 4      # r)   r"   )clss   &r$   emptyToolContext.empty  s    2wr'   c                   V ^8  d   QhRR/# )r   r    z)dict[str, FunctionTool | RawFunctionTool]r"   )r#   s   "r$   r%   r3    s     * * I *r'   c                6    V P                   P                  4       # )zOA copy of all function tools in the tool context, including those in tool sets.)_fnc_tools_mapcopyr*   s   &r$   function_toolsToolContext.function_tools  s     ""''))r'   c                   V ^8  d   QhRR/# )r   r    zlist[ProviderTool]r"   )r#   s   "r$   r%   r3    s     $ $ 2 $r'   c                    V P                   # )zOA copy of all provider tools in the tool context, including those in tool sets.)_provider_toolsr*   s   &r$   provider_toolsToolContext.provider_tools  s     ###r'   c                   V ^8  d   QhRR/# )r   r    zlist[Toolset]r"   )r#   s   "r$   r%   r3    s      - r'   c                    V P                   # )z,A copy of all tool sets in the tool context.)
_tool_setsr*   s   &r$   rp   ToolContext.toolsets  s     r'   c                   V ^8  d   QhRR/# )r   r    z
list[Tool]r"   )r#   s   "r$   r%   r3    s       r'   c                    . pVP                  \        V P                  P                  4       4      4       VP                  V P                  4       V# )z,Flatten the tool context to a list of tools.)rW   rU   r@  r   rF  r6  s   & r$   flattenToolContext.flatten  s>    T$--44678T))*r'   c                    V ^8  d   QhRRRR/# )r   r{   r!   r    r  r"   )r#   s   "r$   r%   r3    s     - -c -.S -r'   c                	8    V P                   P                  V4      # r)   )r@  r   )r+   r{   s   &&r$   get_function_toolToolContext.get_function_tool  s    ""&&t,,r'   c                    V ^8  d   QhRRRR/# )r   otherobjectr    boolr"   )r#   s   "r$   r%   r3    s      F t r'   c                	   \        V\        4      '       g   R # V P                  P                  4       VP                  P                  4       8w  d   R # V P                   F.  pV P                  V,          VP                  V,          Jg   K-   R # 	  \	        V P
                  4      \	        VP
                  4      8w  d   R # V P
                   Uu0 uF  p\        V4      kK  	  ppVP
                   Uu0 uF  p\        V4      kK  	  ppWE8w  d   R # V P                   Uu0 uF  p\        V4      kK  	  ppVP                   Uu0 uF  p\        V4      kK  	  ppWx8w  d   R # R# u upi u upi u upi u upi )FT)rk   r0  r@  keyslenrF  r,   rK  )	r+   rV  r{   ro   self_provider_idsother_provider_idstool_setself_tool_set_idsother_tool_set_idss	   &&       r$   __eq__ToolContext.__eq__  s6   %--##%)=)=)B)B)DD''D""4(0D0DT0JJ ( t##$E,A,A(BB262F2FG2F$RX2FG383H3HI3H4bh3HI2:>//J/hR\/J;@;K;KL;Kxbl;KL2 HI KLs   E!1E&E+E0c                    V ^8  d   QhRRRR/# r2  r"   )r#   s   "r$   r%   r3    s     $ $": $t $r'   c                	   a a \        V4      S n        / S n        . S n        . S n        R  VV 3R llo\
        P                  ! V\        S 4      4       F  pS! V4       K  	  R# )c                    V ^8  d   QhRRRR/# )r   ro   zTool | Toolsetr    r7   r"   )r#   s   "r$   r%   .ToolContext.update_tools.<locals>.__annotate__  s     	E 	E> 	Ed 	Er'   c                  < \        V \        4      '       d   SP                  P                  V 4       R # \        V \        \
        34      '       d   SP                  P                  V P                  P                  4      pVe*   WJd#   \        RV P                  P                   24      hR # V SP                  V P                  P                  &   R # \        V \        4      '       d9   V P                   F  pS! V4       K  	  SP                  P                  V 4       R # \        V 4      ;p'       d   S! V4       R # \        V 4      '       d   \        R4      h\        R\!        V 4       24      h)Nzduplicate function name: zExpected an instance of FunctionTool or RawFunctionTool, got a callable object. If it's a wrapped tool, please consider wrapping the original function before converting to a function tool.zunknown tool type: )rk   r5   rF  r&  r   r   r@  r   r   r{   r   rD   rQ   rK  r!  r  r   )ro   existingtr*  add_toolr+   s   &   r$   rj  *ToolContext.update_tools.<locals>.add_tool  s   $--$$++D1D<"ABB..22499>>B'+(+DTYY^^DT)UVV6:##DIINN3D'**AQK $&&t,$9$$???)$ C  !#6tDzl!CDDr'   N)rU   rV   r@  rF  rK  	itertoolschainrX   )r+   rQ   ro   rj  s   f& @r$   r5  ToolContext.update_tools  sV    5kIK35)+	E 	E: OOE+>t+DEDTN Fr'   c                   V ^8  d   QhRR/# r9  r"   )r#   s   "r$   r%   r3    s     / /k /r'   c                	H    \        V P                  P                  4       4      # r)   )r0  rV   rA  r*   s   &r$   rA  ToolContext.copy  s    4;;++-..r'   strictTc               $    V ^8  d   QhRRRRRR/# )r   r#   z%Literal['openai', 'openai.responses']rr  rX  r    list[dict[str, Any]]r"   )r#   s   "r$   r%   r3    s$     # #;#HL#	#r'   c               	    R # r)   r"   r+   r#   rr  s   &&$r$   parse_function_tools ToolContext.parse_function_tools        #r'   tool_behaviorNuse_parameters_json_schemac               (    V ^8  d   QhRRRRRRRR/# )	r   r#   zLiteral['google']rz  z,_provider_format.google.TOOL_BEHAVIOR | Noner{  rX  r    rt  r"   )r#   s   "r$   r%   r3    s3     # #!# D	#
 %)# 
#r'   c               	    R # r)   r"   )r+   r#   rz  r{  s   &&$$r$   rw  rx    s      #r'   c                    V ^8  d   QhRRRR/# )r   r#   zLiteral['aws']r    rt  r"   )r#   s   "r$   r%   r3    s    WW>W>RWr'   c                	    R # r)   r"   )r+   r#   s   &&r$   rw  rx    s    TWr'   c               $    V ^8  d   QhRRRRRR/# )r   r#   zLiteral['anthropic']rr  rX  r    rt  r"   )r#   s   "r$   r%   r3  
  s$     # #*#7;#	#r'   c               	    R # r)   r"   rv  s   &&$r$   rw  rx  	  ry  r'   c               $    V ^8  d   QhRRRRRR/# )r   r#   z5Literal['openai', 'google', 'aws', 'anthropic'] | strr   r   r    rt  r"   )r#   s   "r$   r%   r3    s-     C CEC C 
	Cr'   c                   VR8X  d"   \         P                  P                  ! V 3/ VB # VR8X  d"   \         P                  P                  ! V 3/ VB # VR8X  d"   \         P                  P                  ! V 3/ VB # VR8X  d"   \         P
                  P                  ! V 3/ VB # VR8X  d"   \         P                  P                  ! V 3/ VB # \        RV 24      h)z7Parse the function tools to a provider-specific schema.openaizopenai.responsesgoogle	anthropicawszUnsupported provider format: )r   r  
to_fnc_ctxto_responses_fnc_ctxr  r  r  r   )r+   r#   r   s   &&,r$   rw  rx    s     X#**55dEfEE))#**??OOOx#**55dEfEE{"#--88HHHu_#''224B6BB8ABBr'   )r@  rF  rK  rV   )r.   r/   r0   r1   r   r<   classmethodr<  r2   rB  rG  rp   rO  rS  ra  r5  rA  r   rw  r3   r"   r'   r$   r0  r0    s    7!   * * $ $  -4$L/ #OS# # # GK	#
 ,0# # W W#>B# #C Cr'   r0  )r   requirednoner)   )C
__future__r   rl   r   r   rl  abcr   r   collections.abcr   r   r   dataclassesr	   enumr
   r   typingr   r   r   r   r   r   r   typing_extensionsr   r   r   r   r   logr    r   voice.eventsr   r   r5   rD   rz   r~   
ToolChoice	Exceptionr   r   r   r   r   r   r   r   r   r   r   r   r   r   r	  r  r  r  r!  rX   r-  r0  r"   r'   r$   <module>r     s   #     # 9 9 !  U U U O O  )3 4 ,N ,N`y !iu !
 w'ABB
	 $	9 	t 
   "Y "     
+-@	At_T3( +gfb"n5  +F9$%5r2%=> 9='(;R(CD = 
" mm	" 
" 
@ mm	@ 
@ 
  #	
 mm 
 
= = #	=
 mm= 
=.= .= #	.=
 BF.= mm.= .=b'
*$N	MC MCr'   