
    i                         d dl Zd dlmc mZ d dlZd dlZd dlm	Z	 d dl
mZ 	 d dlmZ dZ e ej$                  d      xs d      Z e ej$                  d	      xs d
      ZdZ G d d      Zy# e$ r dZY Nw xY w)    N)Optional)utils)ZstdCompressorTFRUN_COMPRESSION_LEVEL   RUN_COMPRESSION_THREADSi   @c                   ,    e Zd Zddee   ddfdZddZy)CompressedTracesNmax_uncompressed_size_bytesreturnc                    t         st        d      |)t        j                  d      }|t	        |      }nt
        }|| _        t        j                         | _	        d| _
        t        j                         | _        d| _        g | _        t!        t"        t$              j'                  | j                  d      | _        y )Nzzstandard is required for compressed trace ingestion. Install it with `pip install zstandard` or set the environment variable LANGSMITH_DISABLE_RUN_COMPRESSION=true to disable compression.MAX_INGEST_MEMORY_BYTESr   levelthreadsFclosefd)ZSTD_AVAILABLEImportErrorls_utilsget_env_varint$DEFAULT_MAX_UNCOMPRESSED_QUEUE_BYTESr   ioBytesIObuffertrace_count	threadingLocklockuncompressed_size_contextr   compression_levelcompression_threadsstream_writercompressor_writer)selfr   max_bytes_strs      n/home/jang/Projects/ai-researcher/.venv/lib/python3.12/site-packages/langsmith/_internal/_compressed_traces.py__init__zCompressedTraces.__init__   s      '.$001JKM(.1-.@+.R++F("$**, !NN$	&'#%!/#-@"

-U-
3 	    c                     t        j                         | _        d| _        d| _        g | _        t        t        d      j                  | j                  d      | _	        y )Nr   r	   r   Fr   )
r   r   r   r   r"   r#   r   r$   r&   r'   )r(   s    r*   resetzCompressedTraces.reset1   sM    jjl!"!/#R"

-U-
3 	r,   )N)r   N)__name__
__module____qualname__r   r   r+   r.    r,   r*   r   r      s    4HSM 4T 484r,   r   )builtins@py_builtins_pytest.assertion.rewrite	assertionrewrite
@pytest_arr   r   typingr   	langsmithr   r   	zstandardr   r   r   r   r   r$   r%   r   r   r2   r,   r*   <module>r<      s      	   '(N ,,,-DEJK .(../HIORP '9 $$4 $4  Ns   A0 0A:9A: