
    )h                       S SK Jr  S SKJr  S SKrS SKrS SKrS SKrS SK	r	S SK
r
S SKrS SKrS SKJr  S SKJrJr  S SKJrJrJrJr  S SKJr  S SKJr  S SKJr  S S	KJrJ r J!r!J"r"  S S
K#J$r$J%r%J&r&  \(       a  S SK'J(r(  S SK)J*r*  \RV                  " S5      r,\RZ                  " \" 5       S-  S9r.    S S jr/\R`                   " S S5      5       r1 S!         S"S jjr2 S#       S$S jjr3      S%S jr4  S&             S'S jjr5  S&           S(S jjr6 S)           S*S jjr7S+S jr8S,S jr9    S-S jr:S.S jr;S/S jr< S0     S1S jjr=      S2S jr>g)3    )annotationsN)	cpu_count)EmptyQueue)TYPE_CHECKINGOptionalUnioncast)schemas)utils)CompressedTraces)_AUTO_SCALE_DOWN_NEMPTY_TRIGGER_AUTO_SCALE_UP_NTHREADS_LIMIT_AUTO_SCALE_UP_QSIZE_TRIGGER	_BOUNDARY)SerializedFeedbackOperationSerializedRunOperation#combine_serialized_queue_operations)Context)Clientzlangsmith.client   max_workersc                    SSK Jn  U" [        5      nU  H.  nUR                  UR                  4nX$   R                  U5        M0     U$ )z4Group batch items by (api_url, api_key) combination.r   )defaultdict)collectionsr   listapi_urlapi_keyappend)batchr   groupeditemkeys        V/root/34ku/venv/lib/python3.13/site-packages/langsmith/_internal/_background_thread.py_group_batch_by_api_endpointr&   .   sD     ($G||T\\*D!  N    c                      \ rS rSr% SrS\S'   S\S'   S\S'   S\S	'   S
\S'   Sr   S           SS jjrSS jrSS jr	Sr
g)TracingQueueItem;   zAn item in the tracing queue.

Attributes:
    priority (str): The priority of the item.
    item (Any): The item itself.
    otel_context (Optional[Context]): The OTEL context of the item.
strpriority:Union[SerializedRunOperation, SerializedFeedbackOperation]r#   Optional[str]r   r   Optional[Context]otel_contextr,   r#   r   r   r0   Nc                @    Xl         X l        X0l        X@l        XPl        g Nr1   )selfr,   r#   r   r   r0   s         r%   __init__TracingQueueItem.__init__M   s     !	(r'   c                    U R                   U R                  R                  4UR                   UR                  R                  4:  $ r3   )r,   r#   	__class__r4   others     r%   __lt__TracingQueueItem.__lt__[   s;    tyy223NNJJ  7
 
 	
r'   c                    [        U[        5      =(       aE    U R                  U R                  R                  4UR                  UR                  R                  4:H  $ r3   )
isinstancer)   r,   r#   r8   r9   s     r%   __eq__TracingQueueItem.__eq__a   sM    %!12 4MMII8
 nnejj22384 	4r'   )r   r   r#   r0   r,   )NNN)r,   r+   r#   r-   r   r.   r   r.   r0   r/   returnNone)r:   r)   rA   bool)r:   objectrA   rC   )__name__
__module____qualname____firstlineno____doc____annotations__	__slots__r5   r;   r?   __static_attributes__ r'   r%   r)   r)   ;   s     M
DD##JI "&!%*.)) I) 	)
 ) () 
)
4r'   r)   c                   / nSn U R                  USS9=n(       a:  UR                  U5        US:  a#  XVR                  R                  5       -  nXS:  a  U$   U R                  USS9nUR                  U5        US:  a$  XVR                  R                  5       -  nXS:  a   U$ U(       a  [        U5      U:  a   U$ Mg  ! [         a     U$ f = f! [         a     U$ f = f)Nr   g      ?)blocktimeout皙?)getr    r#   calculate_serialized_sizer   len)tracing_queuelimitrO   max_size_bytes
next_batchcurrent_sizer#   s          r%   _tracing_thread_drain_queuerZ   h   s    *,JL$ !$$5$$??4?d#!		 C C EE0%% $((ud(C
 d# !		 C C EE  0 	 ZE1 -   $ '"  sH   AC C B? )8C $C =C ?
C	C CC 
CCc                    U R                   c  gU R                   R                     U R                   R                  nU R                  =(       d    UnUb  US::  a  [	        SU 35      eUb  US:  a  [	        SU 35      eUb  X2:  a'  Ub  U R                   R
                  U:  a
   S S S 5        gU R                   R                  R                  S[         S3R                  5       5        U R                   R                  R                  5         U R                   R                  R                  5       nU R                   R                  nU R                   R                  Ul        X44nU R                   R                  5         S S S 5        WR!                  S5        UW4$ ! , (       d  f       N#= f! ["         a    [$        R'                  SSS	9   gf = f)
N)NNr   z!size_limit must be positive; got z*size_limit_bytes must be nonnegative; got z--z--
uLangSmith tracing error: Failed to submit trace data.
This does not affect your application's runtime.
Error details:Texc_info)compressed_traceslockuncompressed_size_max_batch_size_bytes
ValueErrortrace_countcompressor_writerwriter   encodeclosebuffertell_contextcontextresetseek	Exceptionloggererror)client
size_limitsize_limit_bytespre_compressed_sizerY   filled_buffercompressed_traces_infos          r%   '_tracing_thread_drain_compressed_bufferrx      s   /##+%%**"(":":"L"L%;;O?O%*/ #DZL!QRR+0@10D @AQ@RS 
 !(,?,R"f&>&>&J&JZ&W!# +*( $$66<<YKv&--/ $$66<<>!33::??AL"44;;M$*$<$<$E$EM!&9%H"$$**,? +B 	1566E +*F  	 	 	 	
 	s;   F. F. B F&F. /CF F. 
F+'F. .GGc                
    U VVs/ s H  u  p#UPM	     nnnU Vs/ s H  oUR                  S5      PM     nnU R                  c  [        S5      e[        U R                  U5      5      n[	        U5      [	        U5      :w  a#  [        S[	        U5       S[	        U5       35      eU Vs/ s H  oUR                  S5      PM     nnX:w  a  [        SU SU 35      e[        X5       H:  u  u  pn
U	S:X  a  U R                  U
5        M!  U	S:X  d  M)  U R                  U
5        M<     U R                  (       a  U R                  R                  5         ggs  snnf s  snf s  snf ! [         a    [        R                  S	S
S9   gf = f)z1Process a batch of run operations asynchronously.idNzAprocess_buffered_run_ops should not be None when processing batchzGprocess_buffered_run_ops must return the same number of runs. Expected z, got zKprocess_buffered_run_ops must preserve run IDs in the same order. Expected postpatchzLangSmith buffered run ops processing error: Failed to process batch.
This does not affect your application's runtime.
Error details:Tr]   )rR   _process_buffered_run_opsRuntimeErrorr   rT   rc   zip_create_run_update_run_data_available_eventsetro   rp   rq   )rr   batch_to_process_run_data	run_dictsrunoriginal_idsprocessed_runsprocessed_ids	operationprocessed_runs              r%   _process_buffered_run_ops_batchr      s   +
1AB1A+!X1A	B1:;#; ++3S  f>>yIJ ~#i.0	N+6#n2E1FH 
 3AA.3.A((>@  .11A-R)NYMF"""=1g%""=1	 .S ''((,,. (A C;  B"  
 	 	 	

s@   E! EE! EA3E! )EAE! A E! E! !FFc                |    [        U5      nUR                  5        GH  u  u  pxn	U(       d&  [        U	 V
s/ s H  oR                  PM     sn
5      nOHU	 V
s1 s H  oR                  R                  iM     nn
U Vs/ s H  oR                  U;   d  M  UPM     nnU(       a  U R                  XUS9  M  [        S U 5       5      (       a>  [        R                  S5        U Vs/ s H  n[        U[        5      (       a  M  UPM     nnU R                  [        [        [           U5      UUS9  GM     U(       a  Ub  U H  n UR#                  5         M     gggs  sn
f s  sn
f s  snf s  snf ! [         a    [        R!                  SSS9   N[f = f! [$         a3  nS['        U5      ;   a  [        R)                  S	U 35         SnAM  e SnAff = f! U(       a_  Ub[  U HT  n UR#                  5         M  ! [$         a3  nS['        U5      ;   a  [        R)                  S	U 35         SnAMM  e SnAff = f   f f f = f)
a  Handle a batch of tracing queue items by sending them to LangSmith.

Args:
    client: The LangSmith client to use for sending data.
    tracing_queue: The queue containing tracing items (used for task_done calls).
    batch: List of tracing queue items to process.
    use_multipart: Whether to use multipart endpoint for sending data.
    mark_task_done: Whether to mark queue tasks as done after processing.
        Set to False when called from parallel execution to avoid double counting.
    ops: Pre-combined serialized operations to use instead of combining from batch.
        If None, operations will be combined from the batch items.
)r   r   c              3  B   #    U  H  n[        U[        5      v   M     g 7fr3   )r>   r   ).0ops     r%   	<genexpr>/_tracing_thread_handle_batch.<locals>.<genexpr>%  s     WYrz"&ABBYs   z;Feedback operations are not supported in non-multipart moder\   Tr]   N!task_done() called too many times3Ignoring harmless task_done error during shutdown: )r&   itemsr   r#   rz   _multipart_ingest_opsanyrp   warningr>   r   _batch_ingest_run_opsr
   r   r   ro   rq   	task_donerc   r+   debug)rr   rU   r!   use_multipartmark_task_doneopsgrouped_batchesr   r   group_batchr#   	group_ops	group_idsr   r   es                   r%   _tracing_thread_handle_batchr      s8   ,56u=/>/D/D/F+W?+67;4YY;7	 7BBkdYY\\k	B*-D#B)1CR#	D,, -  WYWWWNNU
 #,!"+B)".IJ "+  !
 ,,45yA## - / 0GJ m7
!++-  8>E 8 CD!  
 	 	 	

 " :c!fD QRSQTU  	 m7
!++-! :c!fD QRSQTU    8>s   4E/ E
E/ E 6E/ <E%E%AE/ $E*E*-E/ FE/ /FG FG 
G'G
GGH;$G64H;6
H3	 'H.	'H;-H.	.H3	3H;c                    Uc%  [        U Vs/ s H  oUR                  PM     sn5      nU Vs/ s H  n[        U[        5      (       d  M  UPM     nnU Vs0 s HE  n[        UR                  [        5      (       d  M$  UR                  R                  UR
                  _MG     nnU(       a>  U R                  b  U R                  R                  Xx5        O[        R                  S5        U(       a  Ub  U H  n	 UR                  5         M     gggs  snf s  snf s  snf ! [         a    [        R                  SSS9   NVf = f! [         a3  n
S[        U
5      ;   a  [        R                  SU
 35         Sn
A
M  e Sn
A
ff = f! U(       a_  Ub[  U HT  n	 UR                  5         M  ! [         a3  n
S[        U
5      ;   a  [        R                  SU
 35         Sn
A
MM  e Sn
A
ff = f   f f f = f)a@  Handle a batch of tracing queue items by exporting them to OTEL.

Args:
    client: The LangSmith client containing the OTEL exporter.
    tracing_queue: The queue containing tracing items (used for task_done calls).
    batch: List of tracing queue items to process.
    mark_task_done: Whether to mark queue tasks as done after processing.
        Set to False when called from parallel execution to avoid double counting.
    ops: Pre-combined serialized operations to use instead of combining from batch.
        If None, operations will be combined from the batch items.
NzLangSmith tracing error: Failed to submit OTEL trace data.
This does not affect your application's runtime.
Error details: client.otel_exporter is NonezpOTEL tracing error: Failed to submit trace data.
This does not affect your application's runtime.
Error details:Tr]   r   r   )r   r#   r>   r   rz   r0   otel_exporterexport_batchrp   rq   ro   r   rc   r+   r   )rr   rU   r!   r   r   r#   r   run_opsotel_context_mapr   r   s              r%   !_otel_tracing_thread_handle_batchr   K  s   ((;5U6SUTyyU6STC #N"z"6L'M2N 
$))%;< ,DIILL$+++ 	 

 ##/$$11'LB m7
!++-  8>5 7TN
  
 	 	 	

 " :c!fD QRSQTU  	 m7
!++-! :c!fD QRSQTU    8>s   D  DD  DDD  #D>%D#1D  F D  :ED   E>F  EF 
F'E<;E<<FG,F'%G,'
G$	1'G	G,G	G$	$G,c           
     4   [        U Vs/ s H  oUR                  PM     sn5      n[        R                  " U5      n[        R                  " U5      n [        R
                  " SS9 n	U	R                  [        U UUUSU5      n
U	R                  [        U UUSU5      nU
R                  5         UR                  5         SSS5        U(       a  Ub  U H  n UR                  5         M     gggs  snf ! , (       d  f       N:= f! [         aK  nS[        U5      ;   a6  [        R                  S5        [        XX#SU5        [        XUSU5         SnANe SnAff = f! [         a3  nS[        U5      ;   a  [        R                  SU 35         SnAM  e SnAff = f)	a  Handle a batch of tracing queue items by sending to both both LangSmith and OTEL.

Args:
    client: The LangSmith client to use for sending data.
    tracing_queue: The queue containing tracing items (used for task_done calls).
    batch: List of tracing queue items to process.
    use_multipart: Whether to use multipart endpoint for LangSmith.
    mark_task_done: Whether to mark queue tasks as done after processing.
        Set to False primarily for testing when items weren't actually queued.
   r   FNz6cannot schedule new futures after interpreter shutdownz@Interpreter shutting down, falling back to sequential processingr   r   )r   r#   copydeepcopycfThreadPoolExecutorsubmitr   r   resultr~   r+   rp   r   r   rc   )rr   rU   r!   r   r   r#   r   langsmith_opsotel_opsexecutorfuture_langsmithfuture_otelr   r   s                 r%   #_hybrid_tracing_thread_handle_batchr     s   $ .U.KUTyyU.K
LC MM#&M}}S!H'""q1X',  #//1K ##% - 2P -3A
'')  4~a /L 21.  Cs1vM LLR )uUM .ueX  *  6#a&@ LLMaSQ  sa   C,D 'AC1=D E1
C?;D ?D 
EA EEE
F$'FFFc                   [        U S5      (       a  U R                  c  g [        R                  " S5      (       d  gSSKJn  UR                  5       n[        US5      (       a[  [        UR                  S5      (       a@  UR                  R                  R                  S	S5      n[        R                  S
U 35        U$ g! [         a#  n[        R                  SU S35         SnAgSnAff = f)zCheck if client is using LangSmith's internal OTLP provider.

Returns True if using LangSmith's internal provider, False if user
provided their own.
r   NFOTEL_ENABLEDr   )traceresource
attributeszlangsmith.internal_providerz;TracerProvider resource check: langsmith.internal_provider=z)Could not determine TracerProvider type: z, assuming user-provided)hasattrr   ls_utilsis_env_var_truishopentelemetryr   get_tracer_providerr   r   rR   rp   r   ro   )rr   r   tracer_provideris_internalr   s        r%    _is_using_internal_otlp_providerr     s     6?++v/C/C/K )).99 	(335?J//G$$l5
 5
 *22==AA-uK LL//:m=  7s:RS	
 	s   C  BC   
C-
C((C-c                     [         R                  " S5      n U b   [        U 5      $ g ! [         a    [        R                  SU  S35         g f = f)NBATCH_INGEST_SIZE_LIMITz+Invalid value for BATCH_INGEST_SIZE_LIMIT: z, continuing with default)r   get_env_varintrc   rp   r   )size_limit_strs    r%   get_size_limit_from_envr     sg    ))!N !	~&&   	NN=n=M N* * 	s   
' #AAc           	         [         R                  " SS S[        [        [        S9nU (       d  U$  U R
                  (       d  U$ [        5       nUb  X R
                  S'   U R
                  $ ! [         a    Us $ f = f)NFd   )use_multipart_endpointrt   rs   scale_up_nthreads_limitscale_up_qsize_triggerscale_down_nempty_triggerrs   )
ls_schemasBatchIngestConfigr   r   r   batch_ingest_configr   BaseException)infodefault_configenv_size_limits      r%   _ensure_ingest_configr     s      11$ =;"AN ''!!02%5C$$\2''' s   A* &A* *A98A9c                     [         R                  " S5      n [         R                  " S5      nU (       d  gU(       + nUnX#4$ )aR  Get the current tracing mode configuration.

Returns:
    tuple[bool, bool]:
        - hybrid_otel_and_langsmith: True if both OTEL and LangSmith tracing
          are enabled, which is default behavior if OTEL_ENABLED is set to
          true and OTEL_ONLY is not set to true
        - is_otel_only: True if only OTEL tracing is enabled
r   	OTEL_ONLY)FF)r   r   )otel_enabled	otel_onlyhybrid_otel_and_langsmithis_otel_onlys       r%   get_tracing_moder   )  sB     --n=L**;7I $-L$22r'   c                *  ^^^ U " 5       mTc  g TR                   nUc   e[        TR                  5      nUS   nUS   nUS   nUR                  SS5      n/ mSm[        R
                  " S5      =(       d    TR                  S LnU(       d  U(       a  TR                  R                  =(       d    0 R                  SS5      (       d  [        R                  S	5        O[        R                  " 5       Tl        [        5       Tl        [        R                   " 5       Tl        [        R$                  " [&        [        R(                  " T5      4S
9R+                  5         TS-  mSUUU4S jjnU" 5       (       Ga3  T H+  n	U	R-                  5       (       a  M  TR/                  U	5        M-     [1        T5      U:  ad  UR3                  5       U:  aP  [        R$                  " [4        [        R(                  " T5      U4S
9n
TR7                  U
5        U
R+                  5         [9        5       u  pTR:                  =(       d    UR                  S5      =(       d    Sn[=        XUS9=n(       a6  U(       a  [?        TXU5        O!U(       a  [A        TX5        O[C        TXU5        U" 5       (       a  GM3  [9        5       u  pTR:                  =(       d    UR                  S5      =(       d    Sn[=        XSUS9=n(       a  U(       a#  [        RE                  S5        [?        TXU5        OKU(       a"  [        RE                  S5        [A        TX5        O"[        RE                  S5        [C        TXU5        [=        XSUS9=n(       a  M  [        RE                  S5        g )Nrs   r   r   r   Fr   DISABLE_RUN_COMPRESSIONzstd_compression_enabledz~Run compression is not enabled. Please update to the latest version of LangSmith. Falling back to regular multipart ingestion.)targetargs   c                   > T(       a"  [        TS5      (       a'  TR                  (       a  [        R                  S5        g[        R
                  " 5       R                  5       (       d  [        R                  S5        g[        [        S5      (       aC  [        R                  " T5      T[        T5      -   :  n U (       d  [        R                  S5        U $ g)N_manual_cleanupz3Client is being cleaned up, stopping tracing threadFz,Main thread is dead, stopping tracing threadgetrefcountzeClient refs count indicates we're the only remaining reference to the client, stopping tracing threadT)
r   r   rp   r   	threadingmain_threadis_alivesysr   rT   )should_keep_threadrr   num_known_refssub_threadss    r%   keep_thread_active7tracing_control_thread_func.<locals>.keep_thread_activeh  s    F-..63I3ILLNO$$&//11LLGH3&& "%!8>CM < " &= &% r'   rt   r   rV   rW   rV   rO   rW   zHybrid mode cleanupOTEL-only cleanupLangSmith-only cleanupz'Tracing control thread is shutting downrA   rC   )#rU   r   r   rR   r   r   r   instance_flagsrp   r   weakrefWeakSet_futuresr   r_   r   Eventr   Thread-tracing_control_thread_func_compress_parallelrefstartr   removerT   qsize_tracing_sub_thread_funcr    r   rb   rZ   r   r   r   r   )
client_refrU   r   rs   r   r   r   disable_compressionr   thread
new_threadr   r   max_batch_sizerX   rr   r   r   s                  @@@r%   tracing_control_thread_funcr  @  sE   \F~((M$$$/<),7J#67P#Q"56N"O'++,DeLM*,KN 	""#<= 	,t+  =**0b55&
 
 NNU
 &oo/FO'7'9F$+4??+<F(Dkk&)+ egaN < 

!F??$$""6* " 66##%(>>"))/kk&)=9J z*2B2D/!(( "&&'9: 	
 5N
 
: 
 )3M} 1&-T -M}E 

N /?.@+$$X(;(?(?@R(SXWX  4u^ *  %LL.//= LL,--fmP LL12(=! 4u^ * & LL:;r'   c                  ^^ U " 5       mTc  g [         R                  S5        TR                  b  TR                  b  TR                  c  [         R                  S5        g [        TR                  5      nUS   nTR                  =(       d    UR                  SS5      nSmSUU4S jjn[        R                  " 5       n TR                  R                  S	S
9nU" 5       (       d  GOU(       a~  TR                  R                  5         [        TX45      u  pUb=   [        R!                  TR"                  UU	5      n
TR                  R%                  U
5        [        R                  " 5       nOy[        R                  " 5       U-
  U:  a]  [        TSSS9u  nn	Ub7   [(        R                  " [        R!                  TR"                  UU	5      /5        [        R                  " 5       nGM(   [        TSSS9u  nn	Ub8   [(        R                  " [        R!                  TR"                  UU	5      /5        O [         R                  S5        g ! [&         a    TR#                  UU	5         GNf = f! [&         a    TR#                  UU	5         Nf = f! [&         a    TR#                  UU	5         Nyf = f! [*         a    [         R                  SSS9   Nf = f)Nz4Tracing control thread func compress parallel calledzLangSmith tracing error: Required compression attributes not initialized.
This may affect trace submission but does not impact your application's runtime.rs   rt     @   c                   > T(       a"  [        TS5      (       a'  TR                  (       a  [        R                  S5        g[        R
                  " 5       R                  5       (       d  [        R                  S5        g[        [        S5      (       a7  [        R                  " T5      T:  n U (       d  [        R                  S5        U $ g)Nr   z7Client is being cleaned up, stopping compression threadFz0Main thread is dead, stopping compression threadr   ziClient refs count indicates we're the only remaining reference to the client, stopping compression threadT)	r   r   rp   r   r   r   r   r   r   )r   rr   r   s    r%   r   Itracing_control_thread_func_compress_parallel.<locals>.keep_thread_active  s    F-..63I3ILLRS$$&//11LLKL3&& "%!8>!I%A &% r'   TrQ   )rP   r   )rs   rt   zuLangSmith tracing error: Failed during final cleanup.
This does not affect your application's runtime.
Error details:r]   z1Compressed traces control thread is shutting downr   )rp   r   r_   r   r   rq   r   r   rb   rR   time	monotonicwaitclearrx   LANGSMITH_CLIENT_THREAD_POOLr   _send_compressed_multipart_reqaddr~   r   ro   )r  flush_intervalr   rs   rt   r   last_flush_time	triggereddata_streamrw   futurefinal_data_streamrr   r   s               @@r%   r   r     s    \F~
LLGH  (''/??"1	

 	/<),7J33 7J7N7NJ8
 N 4 nn&O
0055d5C	!## ((..0 8j34/K &9@@==#.F
 OO''/ #nn.O  ?2~E <q1* * < C C$*$I$I$/$:!" #'.."2i n
 4q1
	
" (4;;"AA-2 )0 LLDEC $ 99#.4 ( =='24   55%*  
 	 	 	

sT   <I	 6I, )J0 ;6J 	I)(I),J
JJ-*J0 ,J--J0 0KKc                   U " 5       nUc  g  UR                   (       d  g  UR                  nUc   e[        UR                   5      nUR                  SS5      nSn[        R                  " 5       R                  5       (       a  UUS   ::  a  UR                  =(       d    UR                  S5      =(       d    Sn[        XFUS9=n	(       aC  Sn[        5       u  pU
(       a  [        X$X5        O&U(       a  [        X$U	5        O[        X$X5        OUS-  n[        R                  " 5       R                  5       (       a  UUS   ::  a  M  [        5       u  pUR                  =(       d    UR                  S5      =(       d    Sn[        XFS	US
9=n	(       ar  U
(       a  [        X$X5        OJU(       a"  [        R                  S5        [        X$U	5        O![        R                  S5        [        X$X5        [        XFS	US
9=n	(       a  Mr  [        R                  S5        g ! [         a   n[        R                  SU5         S nAg S nAff = f)Nz#Error in tracing control thread: %srs   r   r   r   rt   r   r   Fr   r   r   z+Tracing control sub-thread is shutting down)r   r   rp   r   rU   r   rR   r   r   r   rb   rZ   r   r   r   r   )r  r   rr   r   rU   r   rs   seen_successive_empty_queuesr
  rX   r   r   s               r%   r  r  X  s?    \F~{{ 
 ((M$$$/<$((s;J#$ 
 	((**(:;< (( "&&'9: 	
 5N
 
: 
 ,-(6F6H3%(3: 1&T -: )A-(= 	((**(:;<> /?.@+$$X(;(?(?@R(SXWX  4u^ *  %/z LL,--fZP LL12(z 4u^ * $ LL>?G  :A>s   H 
I!H<<I)r!   list[TracingQueueItem]rA   zAdict[tuple[Optional[str], Optional[str]], list[TracingQueueItem]])r   Tr   )
rU   r   rV   r   rO   rC   rW   r   rA   r   )r   r  )rr   r   rs   r   rt   z
int | NonerA   z6tuple[Optional[io.BytesIO], Optional[tuple[int, int]]])rr   r   r   zlist[tuple[str, dict]]rA   rB   )TN)rr   r   rU   r   r!   r   r   rC   r   rC   r   JOptional[list[Union[SerializedRunOperation, SerializedFeedbackOperation]]]rA   rB   )rr   r   rU   r   r!   r   r   rC   r   r!  rA   rB   )T)rr   r   rU   r   r!   r   r   rC   r   rC   rA   rB   )rr   r   rA   rC   )rA   zOptional[int])r   zls_schemas.LangSmithInforA   zls_schemas.BatchIngestConfig)rA   ztuple[bool, bool])r  weakref.ref[Client]rA   rB   )g      ?)r  r"  r  floatrA   rB   )r  r"  r   rC   rA   rB   )?
__future__r   concurrent.futuresfuturesr   r   	functoolsiologgingr   r   r  r   multiprocessingr   queuer   r   typingr   r   r	   r
   	langsmithr   r   r   r   &langsmith._internal._compressed_tracesr   langsmith._internal._constantsr   r   r   r   langsmith._internal._operationsr   r   r   opentelemetry.context.contextr   langsmith.clientr   	getLoggerrp   r   r  r&   total_orderingr)   rZ   rx   r   r   r   r   r   r   r   r   r  r   r  rM   r'   r%   <module>r5     s   "    	  
    %   , ' C   5'			-	.!44qQ 
!
F
 )4 )4 )4Z WX++!$+37+PS++^ KU22 #2=G2;2j/
/
&</
	/
n   	KKK "K 	K
 K
K 
Kd   	<<< "< 	<

< 
<H  NNN "N 	N
 N 
Nb$N
"!03.D<P >ANF#NF5:NF	NFbM@#M@M@ 
M@r'   