
    ghq[                       d Z ddlmZ ddlZddlZddlZddlZddlmZm	Z	 ddl
mZ ddlmZ ddlmZ ddlmZ dd	lmZmZmZmZmZmZmZmZ dd
lmZmZ ddlmZ erddlmZm Z m!Z!m"Z"m#Z# ddl$m%Z%  edd          Z& edd          Z'dfdZ(dgdZ)dhd"Z*dhd#Z+dhd$Z, ed%&          did'            Z-d(d)djd.Z. G d/ d0ej/                  Z0 G d1 d2ej/                  Z1 G d3 d4ej/                  Z2 G d5 d6ej/                  Z3 G d7 d8ej/                  Z4dkd<Z5dld>Z6 ed?&          dmdA            Z7dndEZ8 G dF dGe9e:ef                   Z; edHd          Z< edId          Z= G dJ dKee=e<f                   Z> edLe>eef         M          Z?dodQZ@dpdSZA G dT dUe          ZB G dV dWe          ZC G dX dYe          ZDeeBeCeDf         ZE G dZ d[e          ZFdqd_ZG G d` da          ZHdrdcZIdsdeZJdS )tzUtility code for runnables.    )annotationsN)MappingSequence)Context)	lru_cache)	signature)groupby)TYPE_CHECKINGAnyCallable
NamedTupleOptionalProtocolTypeVarUnion)	TypeGuardoverride)create_model)AsyncIterableAsyncIterator	Awaitable	CoroutineIterable)StreamEventInputT)contravariantOutput)	covariant	semaphoreasyncio.Semaphorecoror   returnr   c                r   K   | 4 d{V  | d{V cddd          d{V  S # 1 d{V swxY w Y   dS )zRun a coroutine with a semaphore.

    Args:
        semaphore: The semaphore to use.
        coro: The coroutine to run.

    Returns:
        The result of the coroutine.
    N )r   r!   s     [/var/www/FlaskApp/flask-venv/lib/python3.11/site-packages/langchain_core/runnables/utils.py
gated_coror&   .   s               zzzzzz                             s   &
00nUnion[int, None]coroslistc                   K   | t          j        |  d{V S t          j        |           t          j        fd|D               d{V S )zGather coroutines with a limit on the number of concurrent coroutines.

    Args:
        n: The number of coroutines to run concurrently.
        *coros: The coroutines to run.

    Returns:
        The results of the coroutines.
    Nc              3  8   K   | ]}t          |          V  d S N)r&   ).0cr   s     r%   	<genexpr>z*gather_with_concurrency.<locals>.<genexpr>K   s-      !J!Jq*Y":":!J!J!J!J!J!J    )asynciogather	Semaphore)r'   r)   r   s     @r%   gather_with_concurrencyr5   <   sq       	y^U++++++++!!$$I!J!J!J!JE!J!J!JKKKKKKKKr1   callableCallable[..., Any]boolc                x    	 t          |           j                            d          duS # t          $ r Y dS w xY w)zCheck if a callable accepts a run_manager argument.

    Args:
        callable: The callable to check.

    Returns:
        bool: True if the callable accepts a run_manager argument, False otherwise.
    run_managerNFr   
parametersget
ValueErrorr6   s    r%   accepts_run_managerr@   N   sM    ""-11-@@LL   uu   (+ 
99c                x    	 t          |           j                            d          duS # t          $ r Y dS w xY w)zCheck if a callable accepts a config argument.

    Args:
        callable: The callable to check.

    Returns:
        bool: True if the callable accepts a config argument, False otherwise.
    configNFr;   r?   s    r%   accepts_configrD   ]   sM    ""-11(;;4GG   uurA   c                x    	 t          |           j                            d          duS # t          $ r Y dS w xY w)zCheck if a callable accepts a context argument.

    Args:
        callable: The callable to check.

    Returns:
        bool: True if the callable accepts a context argument, False otherwise.
    contextNFr;   r?   s    r%   accepts_contextrG   l   sM    ""-11)<<DHH   uurA      )maxsizec                 4    t          t          j                  S )zNCache the result of checking if asyncio.create_task accepts a ``context`` arg.)rG   r2   create_taskr$   r1   r%   asyncio_accepts_contextrL   {   s     7.///r1   F)rK   Awaitable[Any]rF   r   rK   c               z    t                      rt          j        | |          S |rt          j        |           S | S )zAwait a coroutine with a context.

    Args:
        coro: The coroutine to await.
        context: The context to use.
        create_task: Whether to create a task. Defaults to False.

    Returns:
        The coroutine with the context.
    )rF   )rL   r2   rK   )r!   rF   rK   s      r%   coro_with_contextrO      sF        :"49999 )"4(((Kr1   c                  J    e Zd ZdZddZedd            Zedd            ZdS )IsLocalDictz Check if a name is a local dict.namestrkeysset[str]r"   Nonec                "    || _         || _        dS )z|Initialize the visitor.

        Args:
            name: The name to check.
            keys: The keys to populate.
        N)rR   rT   )selfrR   rT   s      r%   __init__zIsLocalDict.__init__   s     				r1   nodeast.Subscriptr   c                   t          |j        t          j                  rt          |j        t          j                  r{|j        j        | j        k    rht          |j        t          j	                  rKt          |j        j        t                    r.| j                            |j        j                   dS dS dS dS dS dS )zVisit a subscript node.

        Args:
            node: The node to visit.

        Returns:
            Any: The result of the visit.
        N)
isinstancectxastLoadvalueNameidrR   sliceConstantrS   rT   addrX   rZ   s     r%   visit_SubscriptzIsLocalDict.visit_Subscript   s     tx**	,4:sx00	, 
**4:s|44 +4:+S11 +
 IMM$**+++++	, 	, 	, 	, +*****r1   ast.Callc                   t          |j        t          j                  rt          |j        j        t          j                  r|j        j        j        | j        k    r|j        j        dk    rt          |j
                  dv r~t          |j
        d         t          j                  r[t          |j
        d         j        t                    r8| j                            |j
        d         j                   dS dS dS dS dS dS dS dS )zVisit a call node.

        Args:
            node: The node to visit.

        Returns:
            Any: The result of the visit.
        r=   )rH      r   N)r]   funcr_   	Attributera   rb   rc   rR   attrlenargsre   rS   rT   rf   rg   s     r%   
visit_CallzIsLocalDict.visit_Call   s     ty#-00
	.49?CH55
	. 	"di//	%''DI&((49Q<66 )49Q<-s33 )
 IMM$)A,,-----
	. 
	. 
	. 
	. 0/''((((((r1   N)rR   rS   rT   rU   r"   rV   )rZ   r[   r"   r   )rZ   ri   r"   r   )__name__
__module____qualname____doc__rY   r   rh   rq   r$   r1   r%   rQ   rQ      sn        **    , , , X,& . . . X. . .r1   rQ   c                  b    e Zd ZdZddZedd            Zedd
            Zedd            ZdS )IsFunctionArgDictz4Check if the first argument of a function is a dict.r"   rV   c                ,    t                      | _        dS )z#Create a IsFunctionArgDict visitor.N)setrT   rX   s    r%   rY   zIsFunctionArgDict.__init__   s    !ee			r1   rZ   
ast.Lambdar   c                    |j         j         sdS |j         j         d         j        }t          || j                                      |j                   dS )Visit a lambda function.

        Args:
            node: The node to visit.

        Returns:
            Any: The result of the visit.
        Nr   )rp   argrQ   rT   visitbodyrX   rZ   input_arg_names      r%   visit_LambdazIsFunctionArgDict.visit_Lambda   sN     y~ 	F*.NDI..44TY?????r1   ast.FunctionDefc                    |j         j         sdS |j         j         d         j        }t          || j                                      |           dS )Visit a function definition.

        Args:
            node: The node to visit.

        Returns:
            Any: The result of the visit.
        Nr   rp   r~   rQ   rT   r   r   s      r%   visit_FunctionDefz#IsFunctionArgDict.visit_FunctionDef   L     y~ 	F*.NDI..44T:::::r1   ast.AsyncFunctionDefc                    |j         j         sdS |j         j         d         j        }t          || j                                      |           dS )Visit an async function definition.

        Args:
            node: The node to visit.

        Returns:
            Any: The result of the visit.
        Nr   r   r   s      r%   visit_AsyncFunctionDefz(IsFunctionArgDict.visit_AsyncFunctionDef   r   r1   Nr"   rV   rZ   r{   r"   r   rZ   r   r"   r   rZ   r   r"   r   )	rr   rs   rt   ru   rY   r   r   r   r   r$   r1   r%   rw   rw      s        >>$ $ $ $ @ @ @ X@ ; ; ; X; ; ; ; X; ; ;r1   rw   c                  J    e Zd ZdZddZedd            Zedd
            ZdS )	NonLocalsz Get nonlocal variables accessed.r"   rV   c                R    t                      | _        t                      | _        dS )zCreate a NonLocals visitor.N)ry   loadsstoresrz   s    r%   rY   zNonLocals.__init__  s    "uu
 #r1   rZ   ast.Namer   c                   t          |j        t          j                  r!| j                            |j                   dS t          |j        t          j                  r!| j                            |j                   dS dS )zVisit a name node.

        Args:
            node: The node to visit.

        Returns:
            Any: The result of the visit.
        N)	r]   r^   r_   r`   r   rf   rc   Storer   rg   s     r%   
visit_NamezNonLocals.visit_Name
  sr     dh)) 	%JNN47######),, 	%KOODG$$$$$	% 	%r1   ast.Attributec                   t          |j        t          j                  r|j        }|j        }t          |t          j                  r.|j        dz   |z   }|j        }t          |t          j                  .t          |t          j                  rF| j        	                    |j
        dz   |z              | j                            |j
                   dS t          |t          j                  rt          |j        t          j                  r&| j        	                    |j        j
                   dS |j        }d}t          |t          j                  r8|r|j        dz   |z   }n|j        }|j        }t          |t          j                  8t          |t          j                  r+| j        	                    |j
        dz   |z              dS dS dS dS )zVisit an attribute node.

        Args:
            node: The node to visit.

        Returns:
            Any: The result of the visit.
        . N)r]   r^   r_   r`   ra   rn   rm   rb   r   rf   rc   discardCallrl   )rX   rZ   parent	attr_exprs       r%   visit_AttributezNonLocals.visit_Attribute  s    dh)) 	DZF	IVS]33 &"K#-	9	 VS]33 & &#(++ D
vy3:;;;
""69-----FCH-- Dfk3844 DJNN6;>22222#[F "I$VS];; .$ 4(.c(9I(EII(.I!' %VS];; . "&#(33 D
vy3'BCCCCC-	D 	DD DD Dr1   Nr   )rZ   r   r"   r   )rZ   r   r"   r   )rr   rs   rt   ru   rY   r   r   r   r$   r1   r%   r   r     st        **& & & &
 % % % X% D D D XD D Dr1   r   c                  b    e Zd ZdZddZedd            Zedd
            Zedd            ZdS )FunctionNonLocalsz2Get the nonlocal variables accessed of a function.r"   rV   c                ,    t                      | _        dS )z#Create a FunctionNonLocals visitor.N)ry   	nonlocalsrz   s    r%   rY   zFunctionNonLocals.__init__?  s    #&55r1   rZ   r   r   c                    t                      }|                    |           | j                            |j        |j        z
             dS )r   Nr   r   r   updater   r   rX   rZ   visitors      r%   r   z#FunctionNonLocals.visit_FunctionDefC  D     ++dgmgn<=====r1   r   c                    t                      }|                    |           | j                            |j        |j        z
             dS )r   Nr   r   s      r%   r   z(FunctionNonLocals.visit_AsyncFunctionDefQ  r   r1   r{   c                    t                      }|                    |           | j                            |j        |j        z
             dS )r}   Nr   r   s      r%   r   zFunctionNonLocals.visit_Lambda_  r   r1   Nr   r   r   r   )	rr   rs   rt   ru   rY   r   r   r   r   r$   r1   r%   r   r   <  s        <<) ) ) ) > > > X> > > > X> > > > X> > >r1   r   c                  2    e Zd ZdZd
dZedd            Zd	S )GetLambdaSourcez)Get the source code of a lambda function.r"   rV   c                "    d| _         d| _        dS )zInitialize the visitor.Nr   )sourcecountrz   s    r%   rY   zGetLambdaSource.__init__q  s    %)


r1   rZ   r{   r   c                    | xj         dz  c_         t          t          d          rt          j        |          | _        dS dS )r}   rH   unparseN)r   hasattrr_   r   r   rg   s     r%   r   zGetLambdaSource.visit_Lambdav  sD     	

a

3	"" 	,+d++DKKK	, 	,r1   Nr   r   )rr   rs   rt   ru   rY   r   r   r$   r1   r%   r   r   n  sN        33   
 , , , X, , ,r1   r   rl   r   Optional[list[str]]c                @   	 t          j        |           }t          j        t	          j        |                    }t                      }|                    |           |j        rt          |j                  ndS # t          t          t          t          f$ r Y dS w xY w)zGet the keys of the first argument of a function if it is a dict.

    Args:
        func: The function to check.

    Returns:
        Optional[list[str]]: The keys of the first argument if it is a dict,
            None otherwise.
    N)inspect	getsourcer_   parsetextwrapdedentrw   r   rT   sortedSyntaxError	TypeErrorOSErrorSystemError)rl   codetreer   s       r%    get_function_first_arg_dict_keysr     s     &&y..//#%%d'.|=vgl###=G[9   tts   A9A< <BBOptional[str]c                   	 | j         dk    r| j         nd}n# t          $ r d}Y nw xY w	 t          j        |           }t	          j        t          j        |                    }t                      }|	                    |           n%# t          t          t          t          f$ r |cY S w xY w|j        dk    r|j        n|S )zGet the source code of a lambda function.

    Args:
        func: a Callable that can be a lambda function.

    Returns:
        str: the source code of the lambda function.
    z<lambda>NrH   )rr   AttributeErrorr   r   r_   r   r   r   r   r   r   r   r   r   r   r   )rl   rR   r   r   r   s        r%   get_lambda_sourcer     s     $ ; ;t}}    &&y..//!##dG[9   $]a//7>>T9s    &&AB B*)B*   	list[Any]c                D   	 t          j        |           }t          j        t	          j        |                    }t                      }|                    |           g }t          | d          r-t          | j
                  rt          j        | j
                  nt          j        |           }i |j        |j        }|                                D ]\  }}||j        v r|                    |           |j        D ]x}	d|	v rr|	                    |          r]|}
|	                    d          dd         D ](}|
 n8	 t%          |
|          }
# t&          $ r Y  nw xY w|                    |
           yn%# t(          t*          t,          t.          f$ r g cY S w xY w|S )zGet the nonlocal variables accessed by a function.

    Args:
        func: The function to check.

    Returns:
        list[Any]: The nonlocal variables accessed by the function.
    __wrapped__r   rH   N)r   r   r_   r   r   r   r   r   r   r6   r   getclosurevarsglobalsr   itemsappend
startswithsplitgetattrr   r   r   r   r   )rl   r   r   r   valuesclosure
candidateskvkkvvparts               r%   get_function_nonlocalsr     s    &&y..//#%%d t]++.089I0J0J.G"4#3444'-- 	
 >=7+<=
$$&& 	* 	*DAqG%%%a   ' * *"99q!1!19B "abb 1 * *:!E"!(T!2!2BB- " " "!EE" b)))*	* G[9   			 Ms6   D>E; EE; 
E 	E; E 	 E; ;FFtextrS   prefixc                    t          |          }d|z  |                                 }d                    |d         gfd|dd         D             z             S )zIndent all lines of text after the first line.

    Args:
        text: The text to indent.
        prefix: Used to determine the number of spaces to indent.

    Returns:
        str: The indented text.
     
r   c                    g | ]}|z   S r$   r$   )r.   linespacess     r%   
<listcomp>z,indent_lines_after_first.<locals>.<listcomp>  s    "G"G"GT6D="G"G"Gr1   rH   N)ro   
splitlinesjoin)r   r   n_spaceslinesr   s       @r%   indent_lines_after_firstr     sb     6{{H8^FOOE99eAhZ"G"G"G"GU122Y"G"G"GGHHHr1   c                  "    e Zd ZdZddZddZdS )AddableDictz3Dictionary that can be added to another dictionary.otherr"   c                    t          |           }|D ]R}||vs||         ||         ||<   ||         0	 ||         ||         z   }n# t          $ r ||         }Y nw xY w|||<   S|S )zlAdd a dictionary to this dictionary.

        Args:
            other: The other dictionary to add.
        r   r   rX   r   chunkkeyaddeds        r%   __add__zAddableDict.__add__  s     D!! 	# 	#C%5:#5"3Zc

s''!#Js3EE  ' ' '!#JEEE'"c
   AAAc                    t          |          }| D ]R}||vs||         | |         ||<   | |         0	 ||         | |         z   }n# t          $ r | |         }Y nw xY w|||<   S|S )zzAdd this dictionary to another dictionary.

        Args:
            other: The other dictionary to be added to.
        r   r   s        r%   __radd__zAddableDict.__radd__   s     E"" 	# 	#C%5:#5!#Yc

c&&!#Jc2EE  & & & IEEE&"c
r   N)r   r   r"   r   )rr   rs   rt   ru   r   r   r$   r1   r%   r   r     sB        ==   $     r1   r   _T_co	_T_contrac                      e Zd ZdZddZdS )	SupportsAddz+Protocol for objects that support addition.xr   r"   r   c                   dS )z!Add the object to another object.Nr$   )rX   r   s     r%   r   zSupportsAdd.__add__  s      r1   N)r   r   r"   r   )rr   rs   rt   ru   r   r$   r1   r%   r   r     s.        550 0 0 0 0 0r1   r   Addable)boundaddablesIterable[Addable]Optional[Addable]c                &    d}| D ]}||n||z   }|S )zAdd a sequence of addable objects together.

    Args:
        addables: The addable objects to add.

    Returns:
        Optional[Addable]: The result of adding the addable objects.
    Nr$   r  finalr   s      r%   rf   rf   !  s0      $E : :EEMLr1   AsyncIterable[Addable]c                6   K   d}| 2 3 d{V }||n||z   }6 |S )zAsynchronously add a sequence of addable objects together.

    Args:
        addables: The addable objects to add.

    Returns:
        Optional[Addable]: The result of adding the addable objects.
    Nr$   r  s      r%   aaddr
  0  sR        $E : : : : : : :eEEM  Ls   c                  n    e Zd ZU dZded<   dZded<   dZded<   dZded	<   d
Zded<   e	dd            Z
dS )ConfigurableFieldaq  Field that can be configured by the user.

    Parameters:
        id: The unique identifier of the field.
        name: The name of the field. Defaults to None.
        description: The description of the field. Defaults to None.
        annotation: The annotation of the field. Defaults to None.
        is_shared: Whether the field is shared. Defaults to False.
    rS   rc   Nr   rR   descriptionzOptional[Any]
annotationFr8   	is_sharedr"   intc                8    t          | j        | j        f          S r-   )hashrc   r  rz   s    r%   __hash__zConfigurableField.__hash__Q  s    TWdo.///r1   r"   r  )rr   rs   rt   ru   __annotations__rR   r  r  r  r   r  r$   r1   r%   r  r  ?  s           GGGD!%K%%%% $J$$$$I0 0 0 X0 0 0r1   r  c                  t    e Zd ZU dZded<   ded<   ded<   dZded	<   dZded
<   dZded<   edd            Z	dS )ConfigurableFieldSingleOptiona  Field that can be configured by the user with a default value.

    Parameters:
        id: The unique identifier of the field.
        options: The options for the field.
        default: The default value for the field.
        name: The name of the field. Defaults to None.
        description: The description of the field. Defaults to None.
        is_shared: Whether the field is shared. Defaults to False.
    rS   rc   Mapping[str, Any]optionsdefaultNr   rR   r  Fr8   r  r"   r  c                    t          | j        t          | j                                                  | j        f          S r-   r  rc   tupler  rT   r  rz   s    r%   r  z&ConfigurableFieldSingleOption.__hash__j  s1    TWeDL$5$5$7$788$,GHHHr1   r  
rr   rs   rt   ru   r  rR   r  r  r   r  r$   r1   r%   r  r  V  s         	 	 GGGLLLD!%K%%%%II I I XI I Ir1   r  c                  t    e Zd ZU dZded<   ded<   ded<   dZd	ed
<   dZd	ed<   dZded<   edd            Z	dS )ConfigurableFieldMultiOptiona  Field that can be configured by the user with multiple default values.

    Parameters:
        id: The unique identifier of the field.
        options: The options for the field.
        default: The default values for the field.
        name: The name of the field. Defaults to None.
        description: The description of the field. Defaults to None.
        is_shared: Whether the field is shared. Defaults to False.
    rS   rc   r  r  zSequence[str]r  Nr   rR   r  Fr8   r  r"   r  c                    t          | j        t          | j                                                  t          | j                  f          S r-   r  rz   s    r%   r  z%ConfigurableFieldMultiOption.__hash__  s9    TWeDL$5$5$7$788%:M:MNOOOr1   r  r  r$   r1   r%   r   r   o  s         	 	 GGGD!%K%%%%IP P P XP P Pr1   r   c                  n    e Zd ZU dZded<   ded<   dZded<   dZded	<   dZded
<   dZded<   dZ	ded<   dS )ConfigurableFieldSpeca  Field that can be configured by the user. It is a specification of a field.

    Parameters:
        id: The unique identifier of the field.
        annotation: The annotation of the field.
        name: The name of the field. Defaults to None.
        description: The description of the field. Defaults to None.
        default: The default value for the field. Defaults to None.
        is_shared: Whether the field is shared. Defaults to False.
        dependencies: The dependencies of the field. Defaults to None.
    rS   rc   r   r  Nr   rR   r  r  Fr8   r  r   dependencies)
rr   rs   rt   ru   r  rR   r  r  r  r$  r$   r1   r%   r#  r#    s         
 
 GGGOOOD!%K%%%%GI(,L,,,,,,r1   r#  specsIterable[ConfigurableFieldSpec]list[ConfigurableFieldSpec]c                V   t          t          | d           d           }g }|D ]\  }}t          |          t          |          }t	          |          dk    st          fd|D                       r|                               gd| dg|z    }t          |          |S )a  Get the unique config specs from a sequence of config specs.

    Args:
        specs: The config specs.

    Returns:
        list[ConfigurableFieldSpec]: The unique config specs.

    Raises:
        ValueError: If the runnable sequence contains conflicting config specs.
    c                &    | j         g| j        pg R S r-   )rc   r$  ss    r%   <lambda>z)get_unique_config_specs.<locals>.<lambda>  s    QT$CQ^-Ar$C$C r1   )r   c                    | j         S r-   )rc   r*  s    r%   r,  z)get_unique_config_specs.<locals>.<lambda>  s
    PQPT r1   r   c              3  $   K   | ]
}|k    V  d S r-   r$   )r.   ofirsts     r%   r0   z*get_unique_config_specs.<locals>.<genexpr>  s'      ">">!1:">">">">">">r1   z6RunnableSequence contains conflicting config specsfor z: )r	   r   nextr*   ro   allr   r>   )r%  groupeduniquerc   dupesothersmsgr0  s          @r%   get_unique_config_specsr8    s     uCCDDDnn G +-F 
" 
"	EUev;;!s">">">">v">">">>>MM%    00 0#Wv-0 0  S//!Mr1   c                  .    e Zd ZdddddddddZddZdS )_RootEventFilterNinclude_namesinclude_typesinclude_tagsexclude_namesexclude_typesexclude_tagsr<  Optional[Sequence[str]]r=  r>  r?  r@  rA  r"   rV   c               Z    || _         || _        || _        || _        || _        || _        dS )zUtility to filter the root event in the astream_events implementation.

        This is simply binding the arguments to the namespace to make save on
        a bit of typing in the astream_events implementation.
        Nr;  )rX   r<  r=  r>  r?  r@  rA  s          r%   rY   z_RootEventFilter.__init__  s:     +*(**(r1   eventr   	root_typerS   r8   c                     j          j        
 j        d}nd}|                    d          pg } j         |p|d          j         v } j        |p| j        v } j        |pt	           fd|D                       } j        |o|d          j        v} j        |o| j        v} j        |ot           fd|D                       }|S )z&Determine whether to include an event.NTFtagsrR   c              3  *   K   | ]}|j         v V  d S r-   )r>  r.   tagrX   s     r%   r0   z1_RootEventFilter.include_event.<locals>.<genexpr>  s+      $T$T#SD,=%=$T$T$T$T$T$Tr1   c              3  *   K   | ]}|j         vV  d S r-   )rA  rI  s     r%   r0   z1_RootEventFilter.include_event.<locals>.<genexpr>  s<       & &144,,& & & & & &r1   )	r<  r=  r>  r=   anyr?  r@  rA  r2  )rX   rD  rE  include
event_tagss   `    r%   include_eventz_RootEventFilter.include_event  s2    &"*!)GGGYYv&&,"
)Dv$2D!DG)@d.@!@G(T$T$T$T$T$T$T$T!T!TG)I%-t7I"IG)E)43E"EG( # & & & &8B& & & # #G r1   )r<  rB  r=  rB  r>  rB  r?  rB  r@  rB  rA  rB  r"   rV   )rD  r   rE  rS   r"   r8   )rr   rs   rt   rY   rO  r$   r1   r%   r:  r:    sZ         261504151504) ) ) ) ) ),     r1   r:  'TypeGuard[Callable[..., AsyncIterator]]c                |    t          j        |           p(t          | d          ot          j        | j                  S )zCheck if a function is an async generator.

    Args:
        func: The function to check.

    Returns:
        TypeGuard[Callable[..., AsyncIterator]: True if the function is
            an async generator, False otherwise.
    __call__)r   isasyncgenfunctionr   rR  rl   s    r%   is_async_generatorrU    s>     	"4(( 	64$$ 6&t}55r1   #TypeGuard[Callable[..., Awaitable]]c                |    t          j        |           p(t          | d          ot          j        | j                  S )zCheck if a function is async.

    Args:
        func: The function to check.

    Returns:
        TypeGuard[Callable[..., Awaitable]: True if the function is async,
            False otherwise.
    rR  )r2   iscoroutinefunctionr   rR  rT  s    r%   is_async_callablerY    s>     	#D)) 	74$$ 7'66r1   )r   r    r!   r   r"   r   )r'   r(   r)   r   r"   r*   )r6   r7   r"   r8   )r"   r8   )r!   rM   rF   r   rK   r8   r"   rM   )rl   r   r"   r   )rl   r   r"   r   )rl   r   r"   r   )r   rS   r   rS   r"   rS   )r  r  r"   r  )r  r  r"   r  )r%  r&  r"   r'  )rl   r   r"   rP  )rl   r   r"   rV  )Kru   
__future__r   r_   r2   r   r   collections.abcr   r   contextvarsr   	functoolsr   r   	itertoolsr	   typingr
   r   r   r   r   r   r   r   typing_extensionsr   r   langchain_core.utils.pydanticr   r   r   r   r   r   langchain_core.runnables.schemar   r   r   r&   r5   r@   rD   rG   rL   rO   NodeVisitorrQ   rw   r   r   r   r   r   r   r   dictrS   r   r   r   r   r   rf   r
  r  r  r   AnyConfigurableFieldr#  r8  r:  rU  rY  r$   r1   r%   <module>rf     s   ! ! " " " " " " 



    - - - - - - - -                        	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 2 1 1 1 1 1 1 1 7 6 6 6 6 6 	<              <;;;;;t,,,	T	*	*	*   L L L L$          10 0 0 0 DI     (5. 5. 5. 5. 5.#/ 5. 5. 5.p2; 2; 2; 2; 2; 2; 2; 2;j7D 7D 7D 7D 7D 7D 7D 7Dt/> /> /> /> /> /> /> />d, , , , ,co , , ,.   (: : : :. 3' ' ' 'TI I I I % % % % %$sCx. % % %P 	4(((GKt444	0 0 0 0 0(9e+, 0 0 0 ');sCx#8
9
9
9      0 0 0 0 0
 0 0 0.I I I I IJ I I I2P P P P P: P P P2 46RR 
- - - - -J - - -.   @4 4 4 4 4 4 4 4n   &     r1   