a
    ”˜ëjôˆ  ã                	   @  s>  d dl m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	Z	d dl
Z
d dlZd dlZd dlmZ d dlmZmZ d dlmZmZmZ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" d d
l#m$Z$m%Z%m&Z& erød dl'm(Z( d dl)m*Z* e +d¡Z,ej-eƒ d d�Z.dddœdd„Z/ej0G dd„ dƒƒZ1dPddddddœdd„Z2dQd dd!d"d#œd$d%„Z3d d&d'd(œd)d*„Z4dRd ddddd+d'd,œd-d.„Z5dSd dddd+d'd/œd0d1„Z6dTd ddddd'd2œd3d4„Z7d dd5œd6d7„Z8d8d9œd:d;„Z9d<d=d>œd?d@„Z:dAd9œdBdC„Z;dDd'dEœdFdG„Z<dUdDdId'dJœdKdL„Z=dDdd'dMœdNdO„Z>dS )Vé    )Ú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_workerszlist[TracingQueueItem]zAdict[tuple[Optional[str], Optional[str]], list[TracingQueueItem]])ÚbatchÚreturnc                 C  s<   ddl m} |tƒ}| D ]}|j|jf}||  |¡ q|S )z4Group batch items by (api_url, api_key) combination.r   )Údefaultdict)Úcollectionsr   ÚlistÚapi_urlÚapi_keyÚappend)r   r   ZgroupedÚitemÚkey© r#   úe/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/langsmith/_internal/_background_thread.pyÚ_group_batch_by_api_endpoint.   s    r%   c                   @  sx   e Zd ZU dZded< ded< ded< ded< d	ed
< dZdddddd	ddœdd„Zd ddœdd„Zdddœdd„ZdS )ÚTracingQueueItemzÒAn 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Úpriorityz:Union[SerializedRunOperation, SerializedFeedbackOperation]r!   zOptional[str]r   r   zOptional[Context]Úotel_context©r(   r!   r   r   r)   NÚNone)r(   r!   r   r   r)   r   c                 C  s"   || _ || _|| _|| _|| _d S ©Nr*   )Úselfr(   r!   r   r   r)   r#   r#   r$   Ú__init__M   s
    zTracingQueueItem.__init__Úbool)Úotherr   c                 C  s   | j | jjf|j |jjfk S r,   )r(   r!   Ú	__class__©r-   r0   r#   r#   r$   Ú__lt__[   s    þzTracingQueueItem.__lt__Úobjectc                 C  s&   t |tƒo$| j| jjf|j|jjfkS r,   )Ú
isinstancer&   r(   r!   r1   r2   r#   r#   r$   Ú__eq__a   s    
þýzTracingQueueItem.__eq__)NNN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__Ú	__slots__r.   r3   r6   r#   r#   r#   r$   r&   ;   s   
   úr&   éd   Tr   Úintr/   )Útracing_queueÚlimitÚblockÚmax_size_bytesr   c                 C  sÌ   g }d}z¬| j |dd� }rJ| |¡ |dkrJ||j ¡ 7 }||krJ|W S z| j |dd�}W n tyr   Y q²Y n0 | |¡ |dkrž||j ¡ 7 }||kržq²|rJt|ƒ|krJq²qJW n tyÆ   Y n0 |S )Nr   g      Ð?)rA   Útimeoutçš™™™™™©?)Úgetr    r!   Zcalculate_serialized_sizer   Úlen)r?   r@   rA   rB   Ú
next_batchÚcurrent_sizer!   r#   r#   r$   Ú_tracing_thread_drain_queueh   s.    


rI   é  @r   z
int | Nonez6tuple[Optional[io.BytesIO], Optional[tuple[int, int]]])ÚclientÚ
size_limitÚsize_limit_bytesr   c                 C  sT  �z(| j d u rW dS | j j�ê | j j}| jp.|}|d urN|dkrNtd|› �ƒ‚|d url|dk rltd|› �ƒ‚|d u s|||k r¢|d u s�| j j|k r¢W d   ƒ W dS | j j dt› d� 	¡ ¡ | j j 
¡  | j j ¡ }| j j}| j j|_||f}| j  ¡  W d   ƒ n1 �s0    Y  | d¡ ||fW S  t�yN   tjddd	� Y dS 0 d S )
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Ú
ValueErrorZtrace_countZcompressor_writerÚwriter   ÚencodeÚcloseÚbufferÚtellÚ_contextÚcontextÚresetÚseekÚ	ExceptionÚloggerÚerror)rK   rL   rM   Zpre_compressed_sizerH   Zfilled_bufferÚcompressed_traces_infor#   r#   r$   Ú'_tracing_thread_drain_compressed_buffer–   sL    


ÿÿÿý
ýÿ
*

ürc   zlist[tuple[str, dict]]r+   )rK   Úbatch_to_processr   c           	      C  s  zädd„ |D ƒ}dd„ |D ƒ}| j du r0tdƒ‚t|   |¡ƒ}t|ƒt|ƒkrjtdt|ƒ› dt|ƒ› �ƒ‚dd„ |D ƒ}||kr”td	|› d|› �ƒ‚t||ƒD ]2\\}}}|d
kr¾|  |¡ qž|dkrž|  |¡ qž| jrâ| j 	¡  W n" t
�y   tjddd� Y n0 dS )z1Process a batch of run operations asynchronously.c                 S  s   g | ]\}}|‘qS r#   r#   )Ú.0Ú_Zrun_datar#   r#   r$   Ú
<listcomp>Ñ   ó    z3_process_buffered_run_ops_batch.<locals>.<listcomp>c                 S  s   g | ]}|  d ¡‘qS ©Úid©rE   ©re   Úrunr#   r#   r$   rg   Ò   rh   NzAprocess_buffered_run_ops should not be None when processing batchzGprocess_buffered_run_ops must return the same number of runs. Expected z, got c                 S  s   g | ]}|  d ¡‘qS ri   rk   rl   r#   r#   r$   rg   â   rh   zKprocess_buffered_run_ops must preserve run IDs in the same order. Expected ÚpostÚpatchz…LangSmith buffered run ops processing error: Failed to process batch.
This does not affect your application's runtime.
Error details:TrO   )Z_process_buffered_run_opsÚRuntimeErrorr   rF   rU   ÚzipZ_create_runZ_update_runÚ_data_available_eventÚsetr_   r`   ra   )	rK   rd   Z	run_dictsZoriginal_idsZprocessed_runsZprocessed_idsZ	operationrf   Zprocessed_runr#   r#   r$   Ú_process_buffered_run_ops_batchË   sJ    
ÿÿÿÿÿÿÿürt   zJOptional[list[Union[SerializedRunOperation, SerializedFeedbackOperation]]])rK   r?   r   Úuse_multipartÚmark_task_doneÚopsr   c                   sÆ  �zJz´t |ƒ}| ¡ D ]ž\\}}}	|s:tdd„ |	D ƒƒ}
n dd„ |	D ƒ‰ ‡ fdd„|D ƒ}
|rp| j|
||d� qtdd„ |
D ƒƒršt d	¡ d
d„ |
D ƒ}
| jtt	t
 |
ƒ||d� qW n  tyØ   tjddd� Y n0 W |�rÂ|du�rÂ|D ]Z}z| ¡  W qð t�yH } z.dt|ƒv �r2t d|› �¡ n‚ W Y d}~qðd}~0 0 qðnt|�rÀ|du�rÀ|D ]\}z| ¡  W nH t�yº } z.dt|ƒv �r¤t d|› �¡ n‚ W Y d}~n
d}~0 0 �qb0 dS )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.
    c                 S  s   g | ]
}|j ‘qS r#   ©r!   ©re   r!   r#   r#   r$   rg     rh   z0_tracing_thread_handle_batch.<locals>.<listcomp>c                 S  s   h | ]}|j j’qS r#   )r!   rj   ry   r#   r#   r$   Ú	<setcomp>  rh   z/_tracing_thread_handle_batch.<locals>.<setcomp>c                   s   g | ]}|j ˆ v r|‘qS r#   ri   ©re   Úop©Z	group_idsr#   r$   rg     rh   )r   r   c                 s  s   | ]}t |tƒV  qd S r,   ©r5   r   r{   r#   r#   r$   Ú	<genexpr>%  rh   z/_tracing_thread_handle_batch.<locals>.<genexpr>z;Feedback operations are not supported in non-multipart modec                 S  s   g | ]}t |tƒs|‘qS r#   r~   r{   r#   r#   r$   rg   )  s   
þrN   TrO   Nú!task_done() called too many timesú3Ignoring harmless task_done error during shutdown: )r%   Úitemsr   Z_multipart_ingest_opsÚanyr`   ÚwarningZ_batch_ingest_run_opsr	   r   r   r_   ra   Ú	task_donerU   r'   Údebug)rK   r?   r   ru   rv   rw   Zgrouped_batchesr   r   Zgroup_batchZ	group_opsrf   Úer#   r}   r$   Ú_tracing_thread_handle_batchý   sd    ÿÿÿþýüÿôÿrˆ   )rK   r?   r   rv   rw   r   c           	      C  sj  zðzb|du rt dd„ |D ƒƒ}dd„ |D ƒ}dd„ |D ƒ}|rb| jdurX| j ||¡ n
t d¡ W n  ty„   tjdd	d
� Y n0 W |rð|durð|D ]V}z| ¡  W q˜ tyì } z,dt|ƒv rÖt 	d|› �¡ n‚ W Y d}~q˜d}~0 0 q˜nt|�rd|du�rd|D ]\}z| ¡  W nH t�y^ } z.dt|ƒv �rHt 	d|› �¡ n‚ W Y d}~n
d}~0 0 �q0 dS )ad  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.
    Nc                 S  s   g | ]
}|j ‘qS r#   rx   ry   r#   r#   r$   rg   a  rh   z5_otel_tracing_thread_handle_batch.<locals>.<listcomp>c                 S  s   g | ]}t |tƒr|‘qS r#   )r5   r   r{   r#   r#   r$   rg   c  rh   c                 S  s$   i | ]}t |jtƒr|jj|j“qS r#   )r5   r!   r   rj   r)   ry   r#   r#   r$   Ú
<dictcomp>d  s   þz5_otel_tracing_thread_handle_batch.<locals>.<dictcomp>z—LangSmith 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:TrO   r€   r�   )
r   Úotel_exporterZexport_batchr`   ra   r_   r…   rU   r'   r†   )	rK   r?   r   rv   rw   Zrun_opsZotel_context_maprf   r‡   r#   r#   r$   Ú!_otel_tracing_thread_handle_batchK  sL    þ
ÿüÿôÿr‹   )rK   r?   r   ru   rv   r   c                 C  sh  t dd„ |D ƒƒ}t |¡}t |¡}zjtjdd��J}| t| |||d|¡}	| t| ||d|¡}
|	 ¡  |
 ¡  W d  ƒ n1 s„0    Y  W n` t	yð } zHdt
|ƒv rÚt d¡ t| |||d|ƒ t| ||d|ƒ n‚ W Y d}~n
d}~0 0 |�rd|du�rd|D ]\}z| ¡  W nH t�y^ } z.d	t
|ƒv �rHt d
|› �¡ n‚ W Y d}~n
d}~0 0 �qdS )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.
    c                 S  s   g | ]
}|j ‘qS r#   rx   ry   r#   r#   r$   rg   œ  rh   z7_hybrid_tracing_thread_handle_batch.<locals>.<listcomp>é   r   FNz6cannot schedule new futures after interpreter shutdownz@Interpreter shutting down, falling back to sequential processingr€   r�   )r   ÚcopyÚdeepcopyÚcfÚThreadPoolExecutorÚsubmitrˆ   r‹   Úresultrp   r'   r`   r†   r…   rU   )rK   r?   r   ru   rv   rw   Zlangsmith_opsZotel_opsÚexecutorZfuture_langsmithZfuture_otelr‡   rf   r#   r#   r$   Ú#_hybrid_tracing_thread_handle_batchŠ  s\    

ù	ú
*ÿÿ
ÿÿr”   )rK   r   c              
   C  s¼   t | dƒr| jdu rdS zft d¡s*W dS ddlm} | ¡ }t |dƒrzt |jdƒrz|jj 	d	d¡}t
 d
|› �¡ |W S W dS  ty¶ } z t
 d|› d�¡ W Y d}~dS d}~0 0 dS )z¡Check 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_truishZopentelemetryr–   Zget_tracer_providerr—   r˜   rE   r`   r†   r_   )rK   r–   Ztracer_providerZis_internalr‡   r#   r#   r$   Ú _is_using_internal_otlp_providerÛ  s2    
ÿÿÿÿ
ÿrœ   zOptional[int]©r   c                  C  sF   t  d¡} | d urBz
t| ƒW S  ty@   t d| › d�¡ Y n0 d S )NZBATCH_INGEST_SIZE_LIMITz+Invalid value for BATCH_INGEST_SIZE_LIMIT: z, continuing with default)rš   Zget_env_varr>   rU   r`   r„   )Zsize_limit_strr#   r#   r$   Úget_size_limit_from_env  s    ÿ

ÿ
rž   zls_schemas.LangSmithInfozls_schemas.BatchIngestConfig)Úinfor   c                 C  sf   t jdd dtttd�}| s|S z,| js,|W S tƒ }|d urD|| jd< | jW S  ty`   | Y S 0 d S )NFr=   )Úuse_multipart_endpointrM   rL   Úscale_up_nthreads_limitÚscale_up_qsize_triggerÚscale_down_nempty_triggerrL   )Ú
ls_schemasZBatchIngestConfigr   r   r   Úbatch_ingest_configrž   ÚBaseException)rŸ   Zdefault_configZenv_size_limitr#   r#   r$   Ú_ensure_ingest_config  s&    ú
r§   ztuple[bool, bool]c                  C  s.   t  d¡} t  d¡}| sdS | }|}||fS )an  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•   Z	OTEL_ONLY)FF)rš   r›   )Zotel_enabledZ	otel_onlyÚhybrid_otel_and_langsmithÚis_otel_onlyr#   r#   r$   Úget_tracing_mode)  s    


rª   zweakref.ref[Client])Ú
client_refr   c                   sb  | ƒ ‰ ˆ d u rd S ˆ j }|d us$J ‚tˆ jƒ}|d }|d }|d }| dd¡}g ‰d‰t d¡plˆ jd u}|sÔ|rÔˆ jjp€i  dd¡s–t 	d	¡ n>t
 ¡ ˆ _tƒ ˆ _t ¡ ˆ _tjtt
 ˆ ¡fd
� ¡  ˆd7 ‰ddœ‡ ‡‡fdd„}|ƒ �rÂˆD ]}	|	 ¡ söˆ |	¡ qötˆƒ|k �rT| ¡ |k�rTtjtt
 ˆ ¡|fd
�}
ˆ |
¡ |
 ¡  tƒ \}}ˆ j�pt| d¡�ptd}t|||d� }rê|�ržtˆ |||ƒ qê|�r²t ˆ ||ƒ qêt!ˆ |||ƒ qêtƒ \}}ˆ j�pâ| d¡�pâd}t||d|d� }�rT|�rt "d¡ tˆ |||ƒ n6|�r8t "d¡ t ˆ ||ƒ nt "d¡ t!ˆ |||ƒ �qät "d¡ d S )NrL   r¡   r¢   r    Fr   ZDISABLE_RUN_COMPRESSIONZzstd_compression_enabledz~Run compression is not enabled. Please update to the latest version of LangSmith. Falling back to regular multipart ingestion.)ÚtargetÚargsé   r/   r�   c                    sv   ˆ rt ˆ dƒr"ˆ jr"t d¡ dS t ¡  ¡ s<t d¡ dS t tdƒrnt ˆ ¡ˆt	ˆƒ k} | sjt d¡ | S dS d S )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¯   r`   r†   Ú	threadingÚmain_threadÚis_aliveÚsysr°   rF   ©Zshould_keep_thread©rK   Únum_known_refsZsub_threadsr#   r$   Úkeep_thread_activeh  s(    ÿÿ


ÿÿz7tracing_control_thread_func.<locals>.keep_thread_activerM   r   ©r@   rB   ©r@   rA   rB   zHybrid mode cleanupúOTEL-only cleanupúLangSmith-only cleanupz'Tracing control thread is shutting down)#r?   r§   rŸ   rE   rš   r›   rŠ   Zinstance_flagsr`   r„   ÚweakrefÚWeakSetÚ_futuresr   rQ   r±   ÚEventrr   ÚThreadÚ-tracing_control_thread_func_compress_parallelÚrefÚstartr³   ÚremoverF   ÚqsizeÚ_tracing_sub_thread_funcr    rª   rT   rI   r”   r‹   rˆ   r†   )r«   r?   r¥   rL   r¡   r¢   ru   Zdisable_compressionr¸   ÚthreadZ
new_threadr¨   r©   Úmax_batch_sizerG   r#   r¶   r$   Útracing_control_thread_func@  s¤    

þÿÿ


þ

ÿ
þþ

ÿýÿ
ÿÿ
ÿÿ
ÿ

ÿrÊ   ç      à?Úfloat)r«   Úflush_intervalr   c                   s  | ƒ ‰ ˆ d u rd S t  d¡ ˆ jd u s:ˆ jd u s:ˆ jd u rHt  d¡ d S tˆ jƒ}|d }ˆ jpj| 	dd¡}d‰ddœ‡ ‡fd	d
„}t
 ¡ }ˆ jjdd�}|ƒ s¤�qŽ|�rˆ j ¡  tˆ ||ƒ\}}	|d u�rz t ˆ j||	¡}
ˆ j |
¡ W n  t�y   ˆ  ||	¡ Y n0 t
 ¡ }qŒt
 ¡ | |krŒtˆ ddd�\}}	|d u�r„zt t ˆ j||	¡g¡ W n  t�y‚   ˆ  ||	¡ Y n0 t
 ¡ }qŒz^tˆ ddd�\}}	|d u�rêzt t ˆ j||	¡g¡ W n  t�yè   ˆ  ||	¡ Y n0 W n" t�y   t jddd� Y n0 t  d¡ d S )Nz4Tracing control thread func compress parallel calledzšLangSmith tracing error: Required compression attributes not initialized.
This may affect trace submission but does not impact your application's runtime.rL   rM   rJ   é   r/   r�   c                    sn   ˆ rt ˆ dƒr"ˆ jr"t d¡ dS t ¡  ¡ s<t d¡ dS t tdƒrft ˆ ¡ˆk} | sbt d¡ | S dS d S )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¯   r`   r†   r±   r²   r³   r´   r°   rµ   ©rK   r·   r#   r$   r¸   ã  s$    ÿÿ


ÿzItracing_control_thread_func_compress_parallel.<locals>.keep_thread_activerD   )rC   r®   )rL   rM   zuLangSmith tracing error: Failed during final cleanup.
This does not affect your application's runtime.
Error details:TrO   z1Compressed traces control thread is shutting down)r`   r†   rQ   rr   r¿   ra   r§   rŸ   rT   rE   ÚtimeÚ	monotonicÚwaitÚclearrc   ÚLANGSMITH_CLIENT_THREAD_POOLr‘   Z_send_compressed_multipart_reqÚaddrp   r�   r_   )r«   rÍ   r¥   rL   rM   r¸   Zlast_flush_timeZ	triggeredZdata_streamrb   ÚfutureZfinal_data_streamr#   rÏ   r$   rÂ   Ç  s¾    
ÿþýÿ

ÿ
þ
ýþ

ÿý
ýÿÿ	þ

ÿý
ýÿÿ	þürÂ   )r«   ru   r   c              
   C  s¬  | ƒ }|d u rd S z|j s W d S W n2 tyT } zt d|¡ W Y d }~d S d }~0 0 |j}|d ushJ ‚t|j ƒ}| dd¡}d}t ¡  	¡ �r||d k�r|j
p°| d¡p°d}t|||d� }	�rd}tƒ \}
}|
rèt|||	|ƒ n"|� rüt|||	ƒ nt|||	|ƒ q‚|d7 }q‚tƒ \}
}|j
�p6| d¡�p6d}t||d	|d
� }	�rž|
�rdt|||	|ƒ n6|�r‚t d¡ t|||	ƒ nt d¡ t|||	|ƒ �q8t d¡ d S )Nz#Error in tracing control thread: %srL   r=   r   r£   rM   r¹   r®   Frº   r»   r¼   z+Tracing control sub-thread is shutting down)rŸ   r¦   r`   r†   r?   r§   rE   r±   r²   r³   rT   rI   rª   r”   r‹   rˆ   )r«   ru   rK   r‡   r?   r¥   rL   Zseen_successive_empty_queuesrÉ   rG   r¨   r©   r#   r#   r$   rÇ   X  st    


þÿüÿýÿ
ÿÿ

ÿÿÿ

ÿrÇ   )r=   Tr   )r=   rJ   )TN)TN)T)rË   )?Ú
__future__r   Úconcurrent.futuresZfuturesr�   r�   Ú	functoolsÚioÚloggingr´   r±   rÐ   r½   Úmultiprocessingr   Úqueuer   r   Útypingr   r   r   r	   Z	langsmithr
   r¤   r   rš   Z&langsmith._internal._compressed_tracesr   Zlangsmith._internal._constantsr   r   r   r   Zlangsmith._internal._operationsr   r   r   Zopentelemetry.context.contextr   Zlangsmith.clientr   Ú	getLoggerr`   r�   rÔ   r%   Útotal_orderingr&   rI   rc   rt   rˆ   r‹   r”   rœ   rž   r§   rª   rÊ   rÂ   rÇ   r#   r#   r#   r$   Ú<module>   s`   
- ÿ/ ÿ57  øR  ùD ûQ' 	 ÿ 