§
    ~ŠtjT  ã                   ó$   — d Z  G d„ d¦  «        ZdS )z:Middleware for making it easier to do distributed tracing.c                   ó$   — e Zd ZdZd„ Zdefd„ZdS )ÚTracingMiddlewareaW  Middleware for propagating distributed tracing context using LangSmith.

    This middleware checks for the `'langsmith-trace'` header and propagates the
    tracing context if present. It does not start new traces by default.

    Designed to work with ASGI applications.

    Attributes:
        app: The ASGI application being wrapped.
    c                 ó.   — ddl m} || _        || _        dS )zInitialize the middleware.é    )Útracing_contextN)Úlangsmith.run_helpersr   Ú_with_headersÚapp)Úselfr	   r   s      úR/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langsmith/middleware.pyÚ__init__zTracingMiddleware.__init__   s'   € à9Ð9Ð9Ð9Ð9Ð9à,ˆÔØˆŒˆˆó    Úscopec              ƒ   ó0  K  — |d         dk    rjd|v rft          |d         ¦  «        }d|v rM|                      |¬¦  «        5  |                      |||¦  «        ƒ d{V —† ddd¦  «         n# 1 swxY w Y   dS |                      |||¦  «        ƒ d{V —† dS )a*  Handle incoming requests and propagate tracing context if applicable.

        Args:
            scope: A dict containing ASGI connection scope.
            receive (callable): An awaitable callable for receiving ASGI events.
            send (callable): An awaitable callable for sending ASGI events.

        If the request is HTTP and contains the `'langsmith-trace'` header,
        it propagates the tracing context before calling the wrapped application.

        Otherwise, it calls the application directly without modifying the context.
        ÚtypeÚhttpÚheaderss   langsmith-trace)ÚparentN)Údictr   r	   )r
   r   ÚreceiveÚsendr   s        r   Ú__call__zTracingMiddleware.__call__   s  è è € ð �Œ=˜FÒ"Ð" y°EÐ'9Ð'9Ý˜5 Ô+Ñ,Ô,ˆGØ! WÐ,Ð,Ø×'Ò'¨wÐ'Ñ7Ô7ð 9ð 9ØŸ(š( 5¨'°4Ñ8Ô8Ð8Ð8Ð8Ð8Ð8Ð8Ð8ð9ð 9ð 9ñ 9ô 9ð 9ð 9ð 9ð 9ð 9ð 9øøøð 9ð 9ð 9ð 9à�Ø�hŠh�u˜g tÑ,Ô,Ð,Ð,Ð,Ð,Ð,Ð,Ð,Ð,Ð,s   ÁA,Á,A0Á3A0N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   © r   r   r   r      sH   € € € € € ð	ð 	ðð ð ð- Dð -ð -ð -ð -ð -ð -r   r   N)r   r   r   r   r   ú<module>r      s=   ðØ @Ð @ð&-ð &-ð &-ð &-ð &-ñ &-ô &-ð &-ð &-ð &-r   