§
    ~ŠtjÃ ã                  ó<	  — U d Z ddlmZ ddlZddlZddl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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ZddlZddlmZmZmZm Z m!Z! ddlm"Z"m#Z# ddl$m%Z% ddl&m'Z' ddl(m)Z)m*Z* dd	lm+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4 dd
l5m6Z7 ddl8Z9ddl:Z;ddl<Z<ddl=m>Z> ddl<m?Z@ ddlAmBZC ddlDmEZEmFZFmGZG ddlHmIZI ddlJmKZK ddlLZLddlLmMZN ddlLmOZP ddlLmQZR ddlSmTZU ddlSmVZVmWZWmXZX ddlYmZZZ ddl[m\Z\ ddl[m]Z^ ddl_mFZ` ddl_maZb ddl_mcZc ddldmeZe ddlfmgZgmhZhmiZimjZjmkZk ddllmmZmmnZnmoZompZpmqZq ddlrmsZsmtZtmuZu dd lvmwZwmxZxmyZymzZzm{Z{m|Z|m}Z}m~Z~ dd!lm€Z� dd"l‚mƒ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“ dd)l”m•Z•m–Z–  ej—        e˜¦  «        Z™d*Zšda›d+aœ ej�        ¦   «         Zže/d,         ZŸ e  e4eŸ¦  «        ¦  «        Z¡d-e¢d.<   dãd3„Z£däd4„Z¤dåd6„Z¥dæd:„Z¦d;Z§d<Z¨d=Z©dd>œdçdD„ZªdE„ Z«	 ddFl¬m­Z­ n# e®$ r  G dG„ dH¦  «        Z­Y nw xY w	 ddIl¯m°Z° n# e®$ r  G dJ„ dK¦  «        Z°Y nw xY we+r‡ddl±Z²ddLl³m´Z´ ddlLmOZO ddMlµm¶Z¶ ddNl·m¸Z¸ ddOl¹mºZ» ddPl¼m½Z½ ddQl¾m¿Z¿ ddRlÀmÁZÁ ddSlÂmÃZÃ ddTlÄmÅZÅ ddUlÆmÇZÈ 	 ddVlÉmÊZË ddWlÌmÍZÍ n# e®$ r e-ZËe-ZÍY nw xY wddXlÎmÏZÐ ddYlÑmÒZÒmÓZÓmÔZÔ ddZlÕmÖZÖm×Z×mØZØmÙZÙmÚZÚmÛZÛmÜZÜmÝZÝ  ej—        e˜¦  «        Z™ ej—        d[¦  «        ZÞd\Zßd]Zàd^e¢d_<    eá¦   «         Zâd` e%eI¦  «        jã        v ZädaZå eæ¦   «         Zçdbe¢dc<    e"dd¬e¦  «        dèdg„¦   «         Zèddhdidjœdédq„Zédêdt„Zêdëd|„Zë	 	 dìdíd„„Zìdîd†„Zíe2ejî        eïf         Zðe/d‡         Zñ ej"        dd¬e¦  «        dïd‰„¦   «         ZòdðdŠ„Zódñd�„ZôdŽd�œdòd‘„Zõdód”„Zödôd—„Z÷	 dõdöd›„Zød÷dŸ„Zùdõdød¤„Zúdùd¨„ZûejG        dúdª„¦   «         ZüejG        d«d¬œdûd¯„¦   «         Züd°d¬œdüd±„Zü ej"        dd¬e¦  «        d²„ ¦   «         Zý G d³„ d´e@jþ        ¦  «        Zÿ G dµ„ d¶e1¦  «        �Z dýd¸„�Zdþd¼„�Z G d½„ d¾¦  «        �Z	 dõdÿdÃ„�Z	 dõdÿdÄ„�Z G dÅ„ dÆe�j        ¦  «        �ZddÇœ�d dË„�Z�ddÎ„�Z	�ddÐ„�Z
�ddÒ„�Z�ddÔ„�Zd°dÕœ�dd×„�Z�ddÙ„�Z�ddá„�Z�ddâ„�ZdS (	  a¯  Client for interacting with the LangSmith API.

Use the client to customize API keys / workspace connections, SSL certs,
etc. for tracing.

Also used to create, read, update, and delete LangSmith resources
such as runs (~trace spans), datasets, examples (~records),
feedback (~metrics), projects (tracer sessions/groups), etc.

For detailed API documentation, visit the [LangSmith docs](https://docs.langchain.com/langsmith/home).
é    )ÚannotationsN)ÚAsyncIterableÚIterableÚIteratorÚMappingÚSequence)Ú	lru_cacheÚpartial)Ú	signature)ÚPath)ÚFullÚPriorityQueue)
ÚTYPE_CHECKINGÚ	AnnotatedÚAnyÚCallableÚLiteralÚOptionalÚ	TypedDictÚUnionÚcastÚget_args)Úparse)ÚField)Úadapters)Ú	multipart)Ú	TypeGuardÚ
deprecatedÚoverload)ÚPoolKey)ÚRetry)Úenv)Úschemas)Úutils)Ú_aiter)Ú_orjsonÚ	_profilesÚ_v2_migration_utils)Ú_check_backend_version)ÚTracingQueueItem)Útracing_control_thread_func)r   )Úsuppress_deprecation_warning)Ú	warn_beta)ÚCompressedTraces)Ú_AUTO_SCALE_UP_NTHREADS_LIMITÚ_BLOCKSIZE_BYTESÚ	_BOUNDARYÚ_SIZE_LIMIT_BYTESÚ_TRACING_QUEUE_MAX_SIZE)ÚHUBÚREPO_HANDLE_PATTERNÚbuild_commit_urlÚplatform_hub_pathÚvalidate_parent_commit)ÚMultipartPartÚMultipartPartsAndContextÚ join_multipart_parts_and_context)ÚSerializedFeedbackOperationÚSerializedRunOperationÚ#combine_serialized_queue_operationsÚ$compress_multipart_parts_and_contextÚserialize_feedback_dictÚserialize_run_dictÚ<serialized_feedback_operation_to_multipart_parts_and_contextÚ7serialized_run_operation_to_multipart_parts_and_context)Ú
dumps_json)Úuuid7)ÚQueryBackendÚget_query_backend)ÚAsyncLangsmith)Ú	Langsmith)ÚAsyncHttpxClientWrapper)ÚSyncHttpxClientWrapper)ÚPromptCacheÚprompt_cache_singleton)ÚAttachmentInfoÚExampleWithRunsé<   ç        )Ú	langsmithÚotelÚhybridzfrozenset[str]Ú_VALID_TRACING_MODESÚreasonÚstrÚreturnÚNonec                ó   — t           5  t          dz  at          j        ¦   «         }|t          z
  t          k    r-t          }da|at
                               d|t          | ¦  «         ddd¦  «         dS # 1 swxY w Y   dS )z;Rate-limited logging for dropped trace data (once per 60s).é   r   z1Dropped %d trace data item(s) in the last %ds: %sN)Ú_tracing_drops_lockÚ_tracing_drops_countÚtimeÚ_tracing_drops_last_log_timeÚ_TRACING_DROP_LOG_INTERVAL_SÚloggerÚwarning)rV   ÚnowÚcounts      úN/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langsmith/client.pyÚ_log_tracing_droprf   �   sÉ   € õ 
ð ð Ý Ñ!ÐÝŒi‰kŒkˆØÕ-Ñ-Õ1MÒMÐMÝ(ˆEØ#$Ð Ø+.Ð(Ý�NŠNØCØÝ,Øñ	ô ð ðð ð ñ ô ð ð ð ð ð ð ð øøøð ð ð ð ð ð s   ˆAA3Á3A7Á:A7c                 óN   — t           5  dadaddd¦  «         dS # 1 swxY w Y   dS )z7Reset rate-limit state for drop logging. Used in tests.r   rQ   N)r\   r]   r_   © ó    re   Ú_reset_tracing_drop_logrj   Ÿ   sz   € õ 
ð +ð +Ø ÐØ'*Ð$ð+ð +ð +ñ +ô +ð +ð +ð +ð +ð +ð +ð +øøøð +ð +ð +ð +ð +ð +s   ˆš¡Úapi_urlc                ó˜   — |                       d¦  «        } dD ]1}|                      |¦  «        r| dt          |¦  «         …         c S Œ2| S )zEConvert a handwritten client API URL to a generated OpenAPI base URL.ú/)z/api/v1z/apiN)ÚrstripÚendswithÚlen)rk   Úsuffixs     re   Ú_get_openapi_base_urlrr   §   s_   € à�nŠn˜SÑ!Ô!€GØ%ð +ð +ˆØ×Ò˜FÑ#Ô#ð 	+Ø˜>�c &™kœk˜\˜>Ô*Ð*Ð*Ð*ð	+à€Nri   Úsessionúrequests.Sessionúdict[str, Any]c                óà  ‡— d| j         i}t          j                             ¦   «         Šˆfd„| j                             ¦   «         D ¦   «         }|r||d<   | j        r
| j        |d<   | j        dur
| j        |d<   | j        r
| j        |d<   | j	         
                    d¦  «        p| j	         
                    d	¦  «        }|r.d
t          t          j        j        ¦  «        j        v rd
nd}|||<   |S )aŠ  Translate a `requests.Session`'s transport config into `httpx` kwargs.

    The generated OpenAPI client is `httpx`-based, so a `requests.Session`
    cannot be shared with it directly. Instead we carry over the settings that
    have a direct `httpx` equivalent, so that a caller-supplied session's TLS,
    proxy, cookie and header configuration also applies to the v2 endpoints.

    Not carried over (no `httpx` equivalent): custom mounted `HTTPAdapter`s,
    `session.auth`, and `session.hooks`. Connection pool bounds and retries are
    left at the generated client's own defaults rather than being derived from
    the session's adapter.
    Ú	trust_envc                óR   •— i | ]#\  }}|®‰                      |¦  «        |k    ¯ ||“Œ$S ©N©Úget)Ú.0ÚkeyÚvalueÚrequests_defaultss      €re   ú
<dictcomp>z._httpx_kwargs_from_session.<locals>.<dictcomp>Â   sH   ø€ ð ð ð áˆC�ØÐÐ!2×!6Ò!6°sÑ!;Ô!;¸uÒ!DÐ!Dð 	ˆUà!DÐ!DÐ!Dri   ÚheadersÚcookiesTÚverifyÚcertÚhttpsÚhttpÚproxyÚproxies)rw   Úrequestsr$   Údefault_headersr�   Úitemsr‚   rƒ   r„   rˆ   r{   r   Ú_httpxÚClientÚ__init__Ú
parameters)rs   Úkwargsr�   r‡   Úproxy_kwargr   s        @re   Ú_httpx_kwargs_from_sessionr’   °   s)  ø€ ð *¨7Ô+<Ð=€Fõ !œ×6Ò6Ñ8Ô8Ððð ð ð à!œ/×/Ò/Ñ1Ô1ðñ ô €Gð
 ð $Ø#ˆˆyÑØ„ð ,ð $œOˆˆyÑà„~˜TÐ!Ð!Ø"œ>ˆˆxÑØ„|ð &Ø œˆˆv‰ð ŒO×Ò Ñ(Ô(ÐG¨G¬O×,?Ò,?ÀÑ,GÔ,G€EØð $ð
 �)¥F¤MÔ$:Ñ;Ô;ÔFÐFÐFð ˆGàð 	ð
 $ˆˆ{ÑØ€Mri   )é   é
   ÚOPENAI_API_KEYÚANTHROPIC_API_KEY©Úotel_enabledÚtracing_modeúOptional[TracingMode]r˜   úOptional[bool]ÚTracingModec               ó$  — d}d}d}t          j        |¦  «        }| �^|                      ¦   «         } | t          vr?t          j        d| ›dd                     t          t          ¦  «        ¦  «        › �¦  «        ‚| S |�8t          j        dt          d	¬
¦  «         |rt          j
        |¦  «        rdS dS dS |�­|                     ¦   «         }|t          vr?t          j        d|›dd                     t          t          ¦  «        ¦  «        › �¦  «        ‚t          j
        |¦  «        }t          j
        |¦  «        }|s|r#t          j        d|› d|› d|› d|› d�	d	¬
¦  «         |S t          j
        |¦  «        rdS t          j
        d¦  «        rdS dS )a*  Resolve the effective tracing mode from the constructor arg and env vars.

    Priority: explicit ``tracing_mode`` argument >
    deprecated ``otel_enabled`` argument >
    ``LANGSMITH_TRACING_MODE`` env var >
    legacy ``OTEL_ENABLED`` / ``OTEL_ONLY`` env vars >
    default ``"langsmith"``.
    ÚTRACING_MODEÚOTEL_ENABLEDÚ	OTEL_ONLYNzInvalid tracing_mode=z. Must be one of: ú, z¸The 'otel_enabled' parameter is deprecated and will be removed in the next minor version. Use 'tracing_mode' instead, e.g. Client(tracing_mode="hybrid") or Client(tracing_mode="otel").r“   ©Ú
stacklevelrS   rT   rR   zInvalid LANGSMITH_TRACING_MODE=zBoth LANGSMITH_z and the legacy LANGSMITH_z / LANGSMITH_z env vars are set. LANGSMITH_z takes precedence.)Úls_utilsÚget_env_varÚlowerrU   ÚLangSmithUserErrorÚjoinÚsortedÚwarningsÚwarnÚFutureWarningÚis_env_var_truish)r™   r˜   Úmode_envvar_nameÚotel_enabled_envvar_nameÚotel_only_envvar_nameÚenv_modeÚlegacy_otelÚlegacy_onlys           re   Ú_resolve_tracing_moder´   é   sA  € ð &ÐØ-ÐØ'ÐåÔ#Ð$4Ñ5Ô5€HàÐØ#×)Ò)Ñ+Ô+ˆØÕ3Ð3Ð3ÝÔ-ðM¨ð Mð MØ#'§9¢9­VÕ4HÑ-IÔ-IÑ#JÔ#JðMð Mñô ð ð ÐàÐÝŒðLõ Øð	
ñ 	
ô 	
ð 	
ð ð 	ÝÔ)Ð*?Ñ@Ô@ð Ø�vØ�8Øˆ{àÐØ—>’>Ñ#Ô#ˆØÕ/Ð/Ð/ÝÔ-ðM°(ð Mð MØ#'§9¢9­VÕ4HÑ-IÔ-IÑ#JÔ#JðMð Mñô ð õ Ô0Ð1IÑJÔJˆÝÔ0Ð1FÑGÔGˆØð 	˜+ð 	ÝŒMðBÐ"2ð Bð BØ5ðBð Bà2ðBð Bð .ðBð Bð Bð ðñ ô ð ð ˆõ Ô!Ð"7Ñ8Ô8ð ØˆvÝÔ! .Ñ1Ô1ð ØˆxØˆ;ri   c                 óz   — 	 ddl m}  ddlm} ddlm} ddlm} | |||fS # t          $ r t          d¦  «        ‚w xY w)z,Dynamically import OTEL modules when needed.r   ©Útrace)Úset_span_in_context)Úget_otlp_tracer_provider©ÚOTELExporterzKTo use OTEL tracing, you must install it with `pip install langsmith[otel]`)	Úopentelemetryr·   Úopentelemetry.tracer¸   Ú%langsmith._internal.otel._otel_clientr¹   Ú'langsmith._internal.otel._otel_exporterr»   ÚImportError)Ú
otel_tracer¸   r¹   r»   s       re   Ú_import_otelrÂ   .  sŸ   € ð
Ø5Ð5Ð5Ð5Ð5Ð5Ø;Ð;Ð;Ð;Ð;Ð;ð	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	IÐHÐHÐHÐHÐHàÐ.Ð0HÈ,ÐVÐVøÝð 
ð 
ð 
ÝØYñ
ô 
ð 	
ð
øøøs   ‚   :)ÚZoneInfoc                  ó   — e Zd ZdZdS )rÃ   zIntroduced in python 3.9.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__rh   ri   re   rÃ   rÃ   D  s   € € € € € Ø'Ð'Ð'Ð'ri   rÃ   )ÚTracerProviderc                  ó   — e Zd ZdZdS )rÊ   zUsed for optional OTEL tracing.NrÅ   rh   ri   re   rÊ   rÊ   L  s   € € € € € Ø-Ð-Ð-Ð-ri   rÊ   )ÚRunnable)ÚAsyncAnnotationQueuesResource)ÚAsyncDatasetsResource)ÚAsyncOnlineEvaluatorsResource)ÚAsyncPublicResource)ÚAsyncRunsResource)ÚAsyncSandboxesResource)ÚAsyncThreadsResource)ÚAsyncTracesResource)ÚRunr¶   rº   ©Ú	evaluator)ÚAEVALUATOR_TÚ	ATARGET_TÚAsyncExperimentResults)ÚCOMPARATIVE_EVALUATOR_TÚDATA_TÚEVALUATOR_TÚEXPERIMENT_TÚSUMMARY_EVALUATOR_TÚTARGET_TÚComparativeExperimentResultsÚExperimentResultszurllib3.connectionpoolú	x-api-keyrh   ztuple[dict, ...]Ú	EMPTY_SEQÚkey_blocksizez:How are people using my agent? What are they asking about?zset[str]Ú_fallback_dirs_createdr[   ©ÚmaxsizeÚboolc                 ó¨  — d} 	 ddl m} t          j                             |¦  «        }|t          j                             d¦  «        k    o"|t          j                             d¦  «        k     p"|t          j                             d¦  «        k    } n?# t
          t          t          f$ r%}t           	                    d|¦  «         Y d}~nd}~ww xY w| S )	z®Check if the installed `langchain_core.load.load` supports the `allowed_objects` parameter.

    Returns `True` if `langchain-core >= 0.3.81` and `< 1.0`, or `>= 1.2.5`.
    Fr   )Ú__version__z0.3.81z1.0.0z1.2.5zbFailed to determine langchain-core version for allowed_objects support, defaulting to disabled: %sN)
Úlangchain_corerë   Ú	packagingÚversionr   rÀ   Ú
ValueErrorÚ	TypeErrorra   Údebug)Úallowed_objects_supportedrë   Ú
lc_versionÚexcs       re   Ú&_lc_load_allowed_objects_arg_supportedrõ   �  sÿ   € ð !&Ðð
Ø.Ð.Ð.Ð.Ð.Ð.åÔ&×,Ò,¨[Ñ9Ô9ˆ
ð �)Ô+×1Ò1°(Ñ;Ô;Ò;ð >Ø�YÔ.×4Ò4°WÑ=Ô=Ò=ð%>ð �IÔ-×3Ò3°GÑ<Ô<Ò<ð 	"Ð!øõ �¥YÐ/ð 
ð 
ð 
å�Šð2àñ	
ô 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
øøøøð
øøøð %Ð$s   „BB ÂCÂ*C
Ã
Cr”   é2   ©ÚdepthÚ	max_depthÚ	max_widthÚmanifestúdict | listrø   Úintrù   rú   c               ó&  ‡‡‡— ‰dk     rt          d¦  «        ‚‰dk     rt          d¦  «        ‚‰‰k    rdS t          | t          ¦  «        r#t          | ¦  «        h d£k    r| d         dk    rdS ‰dz   ‰k    rdS t          | t          ¦  «        rBt	          ˆˆˆfd	„t          j        |                      ¦   «         ‰¦  «        D ¦   «         ¦  «        S t          | t          t          f¦  «        r%t	          ˆˆˆfd
„| d‰…         D ¦   «         ¦  «        S dS )z<Recursively check if a manifest contains any secret objects.r[   zmax_depth must be positive.zmax_width must be positive.F>   ÚidÚlcÚtyper  ÚsecretTc              3  óD   •K  — | ]}t          |‰d z   ‰‰¬¦  «        V — ŒdS ©r[   r÷   N©Ú_manifest_has_secrets©r|   Úxrø   rù   rú   s     €€€re   ú	<genexpr>z(_manifest_has_secrets.<locals>.<genexpr>¼  óU   øè è € ð 
ð 
ð õ "Ø˜ ™¨iÀ9ðñ ô ð
ð 
ð 
ð 
ð 
ð 
ri   c              3  óD   •K  — | ]}t          |‰d z   ‰‰¬¦  «        V — ŒdS r  r  r  s     €€€re   r	  z(_manifest_has_secrets.<locals>.<genexpr>Ã  r
  ri   N)
rï   Ú
isinstanceÚdictÚsetÚanyÚ	itertoolsÚisliceÚvaluesÚtupleÚlist)rû   rø   rù   rú   s    ```re   r  r  ©  ss  øøø€ ð �1‚}€}ÝÐ6Ñ7Ô7Ð7Ø�1‚}€}ÝÐ6Ñ7Ô7Ð7Ø�	ÒÐØˆuå�8�TÑ"Ô"ðå�‰MŒMÐ1Ð1Ð1Ò1Ð1Ø�VÔ Ò(Ð(àˆtØ	�‰�iÒ	Ð	ØˆuÝ	�H�dÑ	#Ô	#ð Ýð 
ð 
ð 
ð 
ð 
ð 
õ Ô% h§o¢oÑ&7Ô&7¸ÑCÔCð	
ñ 
ô 
ñ 
ô 
ð 	
õ 
�H�u¥d˜mÑ	,Ô	,ð Ýð 
ð 
ð 
ð 
ð 
ð 
ð ˜j˜y˜jÔ)ð	
ñ 
ô 
ñ 
ô 
ð 	
ð ˆuri   Úprompt_identifierÚdangerously_pull_public_promptc               óh   — t          j        | ¦  «        \  }}}|dk    r|st          d¦  «        ‚d S d S )Nú-zÝPulling a public prompt by owner/name is disabled by default because prompts may contain untrusted serialized LangChain objects. If you trust this prompt, set `dangerously_pull_public_prompt=True` to acknowledge the risk.)r¤   Úparse_prompt_identifierrï   )r  r  ÚownerÚ_s       re   Ú_validate_public_prompt_pullr  Í  sK   € õ Ô2Ð3DÑEÔE�K€Eˆ1ˆaØ�‚|€|Ð:€|Ýð$ñ
ô 
ð 	
ð €|€|€|ri   Úprompt_objectr   Úinclude_modelúbool | NoneÚsecretsúdict[str, str] | NoneÚsecrets_from_envc          	     óØ  — 	 ddl m} ddlm} ddlm} ddlm} ddlm	} ddl
m}	m}
 n# t          $ r t          d¦  «        ‚w xY w	 dd	lm} n%# t          $ r t           j        d
„ ¦   «         }Y nw xY wi }t%          ¦   «         r	|rdnd|d<    |¦   «         5  	  || j        f||dœ|¤Ž}n># t(          $ r1}t+          | j        ¦  «        r|s|st-          d|› �¦  «        ‚|‚d}~ww xY w	 ddd¦  «         n# 1 swxY w Y   t/          ||¦  «        s%t/          ||
¦  «        r¦t/          |j        |¦  «        r‘t/          ||¦  «        r|n-t/          ||
¦  «        rt/          |j        |¦  «        r|j        nd}|€t3          j        d¦  «        ‚|j        €i |_        |j                             | j        | j        | j        dœ¦  «         |�r!t/          ||
¦  «        �rt/          |j        |¦  «        rûtA          |j!        ¦  «        dk    rãt/          |j"        |¦  «        sÎt/          |j"        |	¦  «        r“t/          |j"        j#        |¦  «        rytI          |
|j        |j"        j#        z  ¦  «        }tA          |j!        ¦  «        dk    r<|j!        d         } |
|j         |j%        di i |j"        j&        ¥¤Ž|j"        ¦  «        }n)|}n&t/          |j"        |¦  «        r|j        |j"        z  }n	 |S )at  Process a prompt manifest into a LangChain prompt object.

    This is the common logic shared between `Client.pull_prompt()` and
    `AsyncClient.pull_prompt()`.

    Args:
        prompt_object: The prompt commit object containing the manifest.
        include_model: Whether to include model information.
        secrets: Map of secrets to use when loading.
        secrets_from_env: Whether to load secrets from environment variables.

    Returns:
        The processed prompt object.

    Raises:
        ImportError: If `langchain-core` is not installed.
        ValueError: If secrets are required but not provided.
    r   )ÚBaseLanguageModel)Úload)ÚBaseOutputParser)ÚBasePromptTemplate©ÚStructuredPrompt©ÚRunnableBindingÚRunnableSequencezuThe client.pull_prompt function requires the langchain-core package to run.
Install with `pip install langchain-core`)Úsuppress_langchain_beta_warningc               3  ó   K  — d V — d S ry   rh   rh   ri   re   r-  zA_process_prompt_manifest.<locals>.suppress_langchain_beta_warning  s   è è € àˆEˆEˆEˆEˆEri   ÚallÚcoreÚallowed_objects)Úsecrets_mapr"  aÇ  Failed to load prompt. The prompt manifest contains secrets (like API keys or access tokens) but no secrets were provided. This is due to a security patch in langsmith 0.5.1 that disabled reading secrets from environment variables by default.

To resolve this:
- Recommended: Pass secrets directly via `secrets={'KEY_NAME': 'value'}`
- If this is a trusted prompt: Set `secrets_from_env=True` to read secrets from environment variables

Underlying error:
Nz-Prompt object is not a valid prompt template.)Úlc_hub_ownerÚlc_hub_repoÚlc_hub_commit_hashé   r“   r[   rh   )'Ú#langchain_core.language_models.baser$  Úlangchain_core.load.loadr%  Úlangchain_core.output_parsersr&  Úlangchain_core.promptsr'  Ú!langchain_core.prompts.structuredr)  Úlangchain_core.runnables.baser+  r,  rÀ   Úlangchain_core._apir-  Ú
contextlibÚcontextmanagerrõ   rû   Ú	Exceptionr  rï   r  Úfirstr¤   ÚLangSmithErrorÚmetadataÚupdater  ÚrepoÚcommit_hashrp   ÚstepsÚlastÚboundr   Úbindr�   )r  r  r   r"  r$  r%  r&  r'  r)  r+  r,  r-  Úload_kwargsÚpromptÚeÚprompt_templateÚseqÚrebound_llms                     re   Ú_process_prompt_manifestrQ  Ú  s…  € ð2
ØIÐIÐIÐIÐIÐIØ1Ð1Ð1Ð1Ð1Ð1ØBÐBÐBÐBÐBÐBØ=Ð=Ð=Ð=Ð=Ð=ØFÐFÐFÐFÐFÐFØSÐSÐSÐSÐSÐSÐSÐSÐSøÝð 
ð 
ð 
ÝðIñ
ô 
ð 	
ð
øøøð
ØGÐGÐGÐGÐGÐGÐGøÝð ð ð å	Ô	"ð	ð 	ñ 
#Ô	"ð	ð 	ð 	ðøøøð €KÝ-Ñ/Ô/ð LØ2?Ð)K¨¨ÀVˆÐ%Ñ&à	(Ð	(Ñ	*Ô	*ð ð ð	Ø�TØÔ&ðà#Ø!1ðð ð ð	ð ˆFˆFøõ ð 	ð 	ð 	å% mÔ&<Ñ=Ô=ðà(ðð  ðõ
 !ð.ð +,ð.ð .ñ
ô 
ð 
ð ˆGøøøøð#	øøøð ðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð õ8 	�6Ð-Ñ.Ô.ð
å�fÐ.Ñ/Ô/ð
õ �v”|Ð%7Ñ8Ô8ð
õ ˜&Ð"4Ñ5Ô5ðˆFˆFõ ˜fÐ&6Ñ7Ô7ðå˜vœ|Ð-?Ñ@Ô@ð�”�ð ð 	ð Ð"ÝÔ)Ø?ñô ð ð Ô#Ð+Ø')ˆOÔ$ØÔ ×'Ò'à -Ô 3Ø,Ô1Ø&3Ô&?ðð ñ	
ô 	
ð 	
ð 	ñå�vÐ/Ñ0Ô0ñõ �v”|Ð%5Ñ6Ô6ðõ
 �”ÑÔ !Ò#Ð#­J°v´{ÐDTÑ,UÔ,UÐ#å�f”k ?Ñ3Ô3ð 	½
ØŒKÔÐ0ñ9
ô 9
ð 	õ Ð'¨¬¸¼Ô8IÑ)IÑJÔJˆCÝ�3”9‰~Œ~ Ò"Ð"Ø!œi¨œl�Ø)Ð)Ø”LØ$�KÔ$Ð>Ð>Ð'=¨&¬+Ô*<Ð'=Ð>Ð>Ø”Hñô ��ð ��å˜œÐ%6Ñ7Ô7ð 	Ø'-¤|°f´kÑ'AˆFˆFàà€MsQ   ‚&) ©AÁA ÁA0Á/A0ÂC5ÂB*Â)C5Â*
C%Â4,C Ã C%Ã%C5Ã5C9Ã<C9r6  ÚdatasetÚurl_or_tokenúUnion[str, uuid.UUID]Ú	num_partsÚkindútuple[str, str]c                óè  — 	 t          | t          j        ¦  «        st          j        | ¦  «        r|t          | ¦  «        fS n# t          $ r Y nw xY wt          j        t          | ¦  «        ¦  «        }|j                             d¦  «        }t          |¦  «        |k    r||          }t          |d¬¦  «         nt          j        d|› d| › �¦  «        ‚|j        dk    rd}n|j        dk    rd	}||fS )
z*Parse a public dataset URL or share token.rm   ztoken parts)ÚvarzInvalid public z URL: zsmith.langchain.comúhttps://api.smith.langchain.comzbeta.smith.langchain.comz$https://beta.api.smith.langchain.com)r  ÚuuidÚUUIDrW   rï   Úurllib_parseÚurlparseÚpathÚsplitrp   Ú_as_uuidr¤   r§   Únetloc)rS  rk   rU  rV  Ú
parsed_urlÚ
path_partsÚ
token_uuids          re   Ú_parse_token_or_urlrf  c  s  € ðÝ�l¥D¤IÑ.Ô.ð 	.µ$´)¸LÑ2IÔ2Ið 	.Ø�C Ñ-Ô-Ð-Ð-ð	.øåð ð ð Øˆðøøøõ Ô&¥s¨<Ñ'8Ô'8Ñ9Ô9€Jà”×&Ò& sÑ+Ô+€JÝ
ˆ:�„˜)Ò#Ð#Ø  
Ô+ˆ
Ý� Ð/Ñ/Ô/Ð/Ð/åÔ)Ð*V¸DÐ*VÐ*VÈÐ*VÐ*VÑWÔWÐWØÔÐ1Ò1Ð1Ø3ˆˆØ	Ô	Ð8Ò	8Ð	8Ø8ˆØ�JÐÐs   ‚>A Á
AÁAÚurlc                óÀ   — 	 t          j        | ¦  «        j                             d¦  «        d         }|dk    p|                     d¦  «        S # t
          $ r Y dS w xY w)z¤Check if the URL is langchain hosted.

    Args:
        url: The URL to check.

    Returns:
        `True` if the URL is langchain hosted, `False` otherwise.
    ú:r   zlangchain.comz.langchain.comF)r]  Úurlsplitrb  r`  ro   r@  )rg  rb  s     re   Ú_is_langchain_hostedrk  €  sl   € ðÝÔ& sÑ+Ô+Ô2×8Ò8¸Ñ=Ô=¸aÔ@ˆØ˜Ò(ÐM¨F¯OªOÐ<LÑ,MÔ,MÐMøÝð ð ð Øˆuˆuðøøøs   ‚AA Á
AÁA)ÚtoolÚchainÚllmÚ	retrieverÚ	embeddingrL  Úparserr!   c                 ó  — t          dg d¢dddd¬¦  «        } t          j                             t          j                             d¦  «        ¦  «        }|t          j                             d¦  «        k    }|rd	| d
<   t          j        di | ¤ŽS )z¦Get the default retry configuration.

    If `urllib3` version is `1.26` or greater, retry on all methods.

    Returns:
        The default retry configuration.
    r“   )iö  i÷  iø  é˜  i©  ç      à?FT)ÚtotalÚstatus_forcelistÚbackoff_factorÚraise_on_redirectÚraise_on_statusÚrespect_retry_after_headerÚurllib3z1.26NÚallowed_methodsrh   )r  rí   rî   r   Ú	importlibrC  r¤   ÚLangSmithRetry)Úretry_paramsÚurllib3_versionÚuse_allowed_methodss      re   Ú_default_retry_configr‚  –  sŸ   € õ ØØ2Ð2Ð2ØàØØ#'ðñ ô €Lõ  Ô'×-Ò-­iÔ.@×.HÒ.HÈÑ.SÔ.SÑTÔT€OØ)­YÔ->×-DÒ-DÀVÑ-LÔ-LÒLÐàð /à*.ˆÐ&Ñ'åÔ"Ð2Ð2 \Ð2Ð2Ð2ri   c                ób   — t                                d¦  «         |                      ¦   «          dS )zIClose the session.

    Args:
        session: The session to close.
    zClosing Client.sessionN)ra   rñ   Úclose)rs   s    re   Úclose_sessionr…  ¶  s(   € õ ‡L‚LÐ)Ñ*Ô*Ð*Ø‡M‚M�O„O€O€O€Ori   ÚnameúOptional[str]c                ó”   — dD ]D}t           j                             |› d| › �¦  «        }|�|                     ¦   «         dk    r|c S ŒEd S )N)Ú	LANGSMITHÚ	LANGCHAINr  Ú )ÚosÚenvironr{   Ústrip)r†  Ú	namespacer~   s      re   Ú_get_langsmith_env_var_uncachedr�  À  sY   € Ø/ð ð ˆ	Ý”
—’ )Ð4Ð4¨dÐ4Ð4Ñ5Ô5ˆØÐ §¢¡¤°"Ò!4Ð!4ØˆLˆLˆLøØˆ4ri   rR   ©r™   Úapi_keyc               ó¨   — |sIt          | ¦  «        r<|dk    r8t          j        ¦   «         r't          j        dt          j        ¦  «         dS dS dS dS dS )ap  Verify API key is provided if url not localhost.

    Args:
        api_url: The API URL.
        api_key: The API key.
        tracing_mode: Resolved tracing mode; when ``"otel"`` the warning is
            suppressed because no LangSmith REST calls are made.

    Raises:
        LangSmithUserError: If the API key is not provided when using the hosted service.
    rS   z8API key must be provided when using hosted LangSmith APIN)rk  r¤   Útracing_is_enabledrª   r«   ÚLangSmithMissingAPIKeyWarning)rk   r’  r™   s      re   Ú_validate_api_key_if_hostedr–  È  s�   € ð" ð 	å  Ñ)Ô)ð	à Ò&Ð&ÝÔ+Ñ-Ô-ð 'õ ŒMØJÝÔ6ñô ð ð ð ð	ð 	ð	ð 	à&Ð&Ð&Ð&ri   ÚscoreúUnion[float, int, bool, None]c                óP   — t          | t          ¦  «        rt          | d¦  «        S | S )zËFormat a feedback score by truncating numerical values to 4 decimal places.

    Args:
        score: The score to format, can be a number or any other type

    Returns:
        The formatted score
    é   )r  ÚfloatÚround)r—  s    re   Ú_format_feedback_scorer�  å  s)   € õ �%�ÑÔð å�U˜A‰ŒÐØ€Lri   Úinfoúls_schemas.LangSmithInfoc                óº   — d}t          | j        ¦  «        t          j        k    rt	          d|› �¦  «        ‚t          j        d|› �t          j        d¬¦  «         dS )zuRaise on SmithDB-only deployments, warn elsewhere.

    Call only when run-level feedback has no ``session_id``.
    zJhttps://docs.langchain.com/langsmith/smithdb-sdk-migration#feedback-createztsession_id must be provided when creating feedback for a run: this deployment cannot locate the run without it. See zlCreating feedback for a run without session_id is deprecated and will stop working in a future release. See r“   r¢   N)	rG   Úinstance_flagsrF   ÚSMITHDB_ONLYrï   rª   r«   r¤   ÚLangSmithWarning)rž  Údocss     re   Ú_check_feedback_session_idr¥  ô  sŠ   € ð
 X€DÝ˜Ô,Ñ-Ô-µÔ1JÒJÐJÝðMØFJðMð Mñ
ô 
ð 	
õ „Mð	9Ø26ð	9ð 	9åÔ!Øð	ñ ô ð ð ð ri   Útracing_sampling_rateúOptional[float]úfloat | Nonec                ó¾   — | €t          j        d¦  «        }|sdS nt          | ¦  «        }t          |¦  «        }|dk     s|dk    rt          j        d|› �¦  «        ‚|S )zTGet the tracing sampling rate.

    Returns:
        The tracing sampling rate.
    NÚTRACING_SAMPLING_RATEr   r[   zELANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: )r¤   r¥   rW   r›  r§   )r¦  Úsampling_rate_strÚsampling_rates      re   Ú_get_tracing_sampling_rater­    s‘   € ð Ð$Ý$Ô0Ð1HÑIÔIÐØ ð 	Ø�4ð	õ  Ð 5Ñ6Ô6ÐÝÐ+Ñ,Ô,€MØ�qÒÐ˜M¨AÒ-Ð-ÝÔ)ð%Ø"ð%ð %ñ
ô 
ð 	
ð Ðri   Ú_write_api_urlsúOptional[dict[str, str]]údict[str, str]c                óÒ  — | pi } i }|                       ¦   «         D ]Ë\  }}|                     ¦   «         }|st          j        d¦  «        ‚|                     ¦   «                              d¦  «                             d¦  «                             d¦  «        }|                     ¦   «                              d¦  «                             d¦  «        }t          ||¦  «         |||<   ŒÌ|S )Nz&LangSmith runs API URL cannot be emptyú"ú'rm   )r‹   rŽ  r¤   r§   rn   r–  )r®  Úprocessed_write_api_urlsrg  r’  Úprocessed_urlÚprocessed_api_keys         re   Ú_get_write_api_urlsr·    så   € à%Ð+¨€OØ!ÐØ'×-Ò-Ñ/Ô/ð Dð D‰ˆˆWØŸ	š	™œˆØð 	XÝÔ-Ð.VÑWÔWÐWØ%×+Ò+Ñ-Ô-×3Ò3°CÑ8Ô8×>Ò>¸sÑCÔC×JÒJÈ3ÑOÔOˆØ#ŸMšM™OœO×1Ò1°#Ñ6Ô6×<Ò<¸SÑAÔAÐÝ# MÐ3DÑEÔEÐEØ2CÐ  Ñ/Ð/à#Ð#ri   r~   ÚID_TYPErY  ú	uuid.UUIDc                óÄ   — 	 t          | t          j        ¦  «        st          j        | ¦  «        n| S # t          $ r#}|pd}t	          j        |› d| › �¦  «        |‚d }~ww xY w)Nr~   z* must be a valid UUID or UUID string. Got )r  r[  r\  rï   r¤   r§   )r~   rY  rM  s      re   ra  ra  .  s~   € ðÝ'1°%½¼Ñ'CÔ'CÐN�tŒy˜ÑÔÐÈÐNøÝð ð ð Øˆn�WˆÝÔ)ØÐEÐE¸eÐEÐEñ
ô 
àð	øøøøðøøøs   ‚/2 ²
A¼AÁAÚrunúls_schemas.RunKeyÚindexc           	     óˆ  — | d         }t          |t          j        ¦  «        r|                     ¦   «         }t          t	          | d         d|› d�¦  «        ¦  «        t          t	          | d         d|› d�¦  «        ¦  «        |dœ}|                      d¦  «        }|�$t          t	          |d|› d
�¦  «        ¦  «        |d<   |S )zØBuild the JSON body for one `runs` entry of `add_runs_to_annotation_queue`.

    Serializes UUIDs and `start_time` to strings, since the `requests` `json=`
    encoder does not handle `UUID`/`datetime` natively.
    Ú
start_timeÚrun_idzruns[z].run_idÚ
session_idz].session_id)rÀ  rÁ  r¿  Úsource_proposed_example_idNz].source_proposed_example_id)r  ÚdatetimeÚ	isoformatrW   ra  r{   )r»  r½  r¿  ÚbodyrÂ  s        re   Ú_serialize_run_keyrÆ  8  sã   € ð �\Ô"€JÝ�*�hÔ/Ñ0Ô0ð ,Ø×)Ò)Ñ+Ô+ˆ
å•h˜s 8œ}Ð.E°eÐ.EÐ.EÐ.EÑFÔFÑGÔGÝ�( 3 |Ô#4Ð6Q¸eÐ6QÐ6QÐ6QÑRÔRÑSÔSØ ðð €Dð
 "%§¢Ð)EÑ!FÔ!FÐØ!Ð-Ý-0ÝØ*Ø;˜Ð;Ð;Ð;ñô ñ.
ô .
ˆÐ)Ñ*ð €Kri   úOptional[Union[str, uuid.UUID]]c                ó   — d S ry   rh   )r~   s    re   Ú_ensure_uuidrÉ  Q  s   € ØGJÀsri   T©Úaccept_nullrË  úOptional[uuid.UUID]c               ó   — d S ry   rh   ©r~   rË  s     re   rÉ  rÉ  U  s	   € ð ˜#ri   Fc               óH   — | €|rd S t          ¦   «         S t          | ¦  «        S ry   )rE   ra  rÎ  s     re   rÉ  rÉ  [  s)   € Ø€}Øð 	Ø�4Ý‰wŒwˆÝ�E‰?Œ?Ðri   c                ón   — t          j        | ¦  «        }|j                             d¦  «        d         }|S )Nri  r   )r]  r^  rb  r`  )rg  rc  Úhosts      re   Ú
_parse_urlrÒ  c  s2   € åÔ& sÑ+Ô+€JØÔ×"Ò" 3Ñ'Ô'¨Ô*€DØ€Kri   c                  óh   ‡ — e Zd Zg d¢Zej        ej        ej        ej        dfdˆ fd„Zdˆ fd„	Z	ˆ xZ
S )Ú_LangSmithHttpAdapter)Úmax_retriesÚconfigÚ_pool_connectionsÚ_pool_maxsizeÚ_pool_blockÚ
_blocksizei @  Úpool_connectionsrý   Úpool_maxsizerÕ  úUnion[Retry, int, None]Ú
pool_blockré   Ú	blocksizerX   rY   c                ó^   •— || _         t          ¦   «                              ||||¦  «         d S ry   )rÚ  ÚsuperrŽ   )ÚselfrÛ  rÜ  rÕ  rÞ  rß  Ú	__class__s         €re   rŽ   z_LangSmithHttpAdapter.__init__t  s1   ø€ ð $ˆŒÝ‰Œ×ÒÐ)¨<¸ÀjÑQÔQÐQÐQÐQri   Fc                ó   •— t           r
| j        |d<   	  t          ¦   «         j        |||fi |¤ŽS # t          $ rS d|v rMt
                               d¦  «         |                     d¦  «          t          ¦   «         j        |||fi |¤ŽcY S ‚ w xY w)Nrß  zWAn intermediate HTTPAdapter does not accept the 'blocksize' kwarg. Retrying without it.)ÚURLLIB3_SUPPORTS_BLOCKSIZErÚ  rá  Úinit_poolmanagerrð   ra   rb   Úpop)râ  Úconnectionsrè   ÚblockÚpool_kwargsrã  s        €re   ræ  z&_LangSmithHttpAdapter.init_poolmanager  sÒ   ø€ Ý%ð 	7à'+¤ˆK˜Ñ$ð	Ø+•5‘7”7Ô+¨K¸À%ÐWÐWÈ;ÐWÐWÐWøÝð 
	ð 
	ð 
	Ø˜kÐ)Ð)Ý—’ð2ñô ð ð —’ Ñ,Ô,Ð,Ø/•u‘w”wÔ/Ø ¨%ðð Ø3>ðð ð ð ð ð ð
	øøøs   ”0 °ABÂB)rÛ  rý   rÜ  rý   rÕ  rÝ  rÞ  ré   rß  rý   rX   rY   ©F)rÆ   rÇ   rÈ   Ú	__attrs__Úrequests_adaptersÚDEFAULT_POOLSIZEÚDEFAULT_RETRIESÚDEFAULT_POOLBLOCKrŽ   ræ  Ú__classcell__©rã  s   @re   rÔ  rÔ  j  s•   ø€ € € € € ðð ð €Ið !2Ô BØ-Ô>Ø/@Ô/PØ,Ô>Øð	Rð 	Rð 	Rð 	Rð 	Rð 	Rð 	Rðð ð ð ð ð ð ð ð ð ri   rÔ  c                  óF   — e Zd ZU dZded<   ded<   ded<   ded	<   ded
<   dS )ÚListThreadsItemz-Item returned by :meth:`Client.list_threads`.rW   Ú	thread_idzlist[ls_schemas.Run]Úrunsrý   rd   r‡  Úmin_start_timeÚmax_start_timeN)rÆ   rÇ   rÈ   rÉ   Ú__annotations__rh   ri   re   rô  rô  ’  sN   € € € € € € Ø7Ð7à€N€N�NØÐÐÑØ€J€J�JØ!Ð!Ð!Ñ!Ø!Ð!Ð!Ñ!Ð!Ð!ri   rô  Ú
attachmentc                óÊ   — t          | t          ¦  «        rdS t          | t          t          f¦  «        r/t	          | ¦  «        dk    rt          | d         t          ¦  «         S dS )aÞ  Return True if an attachment is a filesystem path rather than inline bytes.

    Serialization opens any attachment data that isn't ``bytes`` as a file path
    (see ``serialized_run_operation_to_multipart_parts_and_context``). Inline data
    is ``bytes`` or a 2-element ``(content_type, bytes)``; anything else is treated
    as a filesystem reference (fail closed). Unlike the old ``(tuple, Path)`` guard,
    this also catches JSON/dict-shaped input (``list``/``str``).
    Fr6  r[   T)r  Úbytesr  r  rp   )rú  s    re   Ú!_attachment_references_filesystemrý  œ  s]   € õ �*�eÑ$Ô$ð ØˆuÝ�*�u¥d˜mÑ,Ô,ð 4µ°Z±´ÀAÒ1EÐ1EÝ˜j¨œm­UÑ3Ô3Ð3Ð3Øˆ4ri   ÚattachmentsúOptional[dict]Údangerously_allow_filesystemc                ó|   — |s| sdS |                       ¦   «         D ] }t          |¦  «        rt          d¦  «        ‚Œ!dS )zÁRaise unless every attachment is inline data, or filesystem access is opted in.

    Centralizes the guard that previously lived (incorrectly) in three places.
    See GHSA-f4xh-w4cj-qxq8.
    Nz–Attachments must be inline bytes or a (content_type, bytes) pair. To load an attachment from a filesystem path, set dangerously_allow_filesystem=True.)r  rý  rï   )rþ  r   rú  s      re   Ú_reject_filesystem_attachmentsr  ¬  si   € ð $ð ¨;ð ØˆØ!×(Ò(Ñ*Ô*ð ð ˆ
Ý,¨ZÑ8Ô8ð 	Ýð5ñô ð ð	ðð ri   c                  óŒ  — e Zd ZU dZg d¢Zded<   ded<   ded<   ded<   d	ed
<   ded<   ded<   ded<   ded<   ded<   ded<   	 �d+dddddddddddddddddddddddddddœ�d,dE„Z�d-dG„Z�d.dI„Z�d/dK„Z	e
�d0dM„¦   «         Ze
�d1dO„¦   «         Ze
�d2dQ„¦   «         Ze
�d3dS„¦   «         Ze
�d4dU„¦   «         Ze
�d5dW„¦   «         Ze
�d6dY„¦   «         Ze
�d7d[„¦   «         Z�d8d_„Zedd`œ�d9dg„¦   «         Z�d:dh„Z�d;dk„Z�d:dl„Ze
�d:dm„¦   «         Ze
�d:dn„¦   «         Z�d<do„Z�d=ds„Z�d>dt„Ze
�d?du„¦   «         Zej        �d@dv„¦   «         Ze
�d?dw„¦   «         Z e j        �d@dx„¦   «         Z e
�d<dy„¦   «         Z!e!j        �dAdz„¦   «         Z!e
�dBd|„¦   «         Z"�dCd~„Z#�dDd€„Z$dd�dddd‚dƒœ�dEd“„Z%dd”œ�dFd™„Z&ddšd›dœœ�dGd „Z'de(j)        j*        d¡œ�dHd¬„Z+dde(j)        j*        d­œ�dId°„Z,	 	 �dJ�dKdµ„Z-�dLd·„Z.�dMd¸„Z/dd¹œ�dNd½„Z0e
�dOd¿„¦   «         Z1�dPdÂ„Z2ddddddÃœ�dQdË„Z3dddddddÌœ�dRdÒ„Z4dddddddÌœ�dSdÓ„Z5�dTdÔ„Z6�dUdÖ„Z7�dVd×„Z8�dWdÙ„Z9e�dXdÝ„¦   «         Z:�dMdÞ„Z;�d>dß„Z<dddddddàœ�dYdã„Z=	 	 �dZ�d[dæ„Z>dddddddàœ�d\dç„Z?dddddddàœ�d]dé„Z@	 	 �dZddêœ�d^dë„ZAdìdddddddíœ�d_dñ„ZBdìdòœ�d`d÷„ZCddddddddddddddddddddøœ�da�d„ZDdddddddÌœ�db�d„ZEdddddddÌœ�dc�d	„ZF	 �dd�de�d„ZG�d+�df�d„ZH�dg�d„ZI eJ�d¦  «        	 �dhdd�dœ�di�d„¦   «         ZK eJ�d¦  «        dddddd�d�dœ�dj�d#„¦   «         ZL eJ�d$¦  «        dddddddddddddddd�d%œ�dk�d-„¦   «         ZM eJ�d.¦  «        ddd�d/dd�d0œ�dl�d3„¦   «         ZNdddddddddddddddd�d4œ�dm�d=„ZO eJ�d>¦  «        dd�d?œ�dn�dA„¦   «         ZPdd�d?œ�dn�dB„ZQ eJ�dC¦  «        d�dDœ�do�dF„¦   «         ZR eJ�dG¦  «        �dp�dH„¦   «         ZS eJ�dI¦  «        �dq�dJ„¦   «         ZT�dr�dK„ZU eJ�dL¦  «        	 �d+�ds�dO„¦   «         ZV eJ�dP¦  «        	 �d+�dt�dQ„¦   «         ZW	 �d+d�dRœ�du�dV„ZX	 �d+d�dRœ�du�dW„ZY�dv�dX„ZZ�dw�dY„Z[dd�dZœ�dx�d]„Z\dddd�d^œ�dy�db„Z]dddddddd�dcœ�dz�dk„Z^ddddd�dlœ�d{�dm„Z_�d|�do„Z`�d}�dq„Za ebjc        �dr¦  «        ddd�dsœ�d~�dv„¦   «         Zdddd�dsœ�d~�dw„Zed�dxœ�d�dy„Zfdd�drœ�d€�dz„Zg	 	 	 	 	 	 	 	 	 	 �d��d‚�d„Zh ebjc        �d?¦  «        dd�d?œ�dƒ�d€„¦   «         Zide(j)        j*        dddd�d�œ�d„�d‡„Zjdd�dˆœ�d…�d‰„Zk ebjc        �dˆ¦  «        dd�dˆœ�d†�dŠ„¦   «         Zl	 �d+d�dRœ�d‡�d�„Zm	 �d+d�dRœ�dˆ�d�„Zndddddd�d‘œ�d‰�d•„Zo ebjc        �d–¦  «        dd�d–œ�dŠ�d—„¦   «         Zpdd�d–œ�d‹�d›„Zqdddd�dœœ�dŒ�dŸ„Zrdddd�d œ�d��d¢„Zsdd�d£œ�dŽ�d¦„Zt�d��d§„Zu ebjc        �d–¦  «        	 	 	 	 �d��d‘�d¬„¦   «         Zv ebjc        �d–¦  «        	 	 	 	 �d��d’�d±„¦   «         Zw	 	 	 �d“�d”�d²„Zx	 	 �dJ�d•�d·„Zydd�d¸œ�d–�d¼„Zzdd�d¸œ�d–�d½„Z{dd�d¾œ�d—�dÁ„Z|�d˜�dÄ„Z}	 �d™�dš�dÈ„Z~dd�d¾œ�d—�dÉ„Zdd�dÊœ�d›�dÍ„Z€ ebjc        �d–¦  «        ddddd��dÎœ�dœ�dÓ„¦   «         Z��dÔ„ Z‚�dÕ„ Zƒ ebjc        �d–¦  «        	 	 	 	 	 	 	 	 	 	 	 	 �d��dž�dÝ„¦   «         Z„d�dÞœ�dŸ�dß„Z…	 	 	 	 	 	 �d �d/dddd�dàœ�d¡�då„Z†ddddddd�dæœ�d¢�dé„Z‡dddd�dêœ�d£�dî„Zˆ�d¤�dï„Z‰d�dðœ�d¥�dó„ZŠddd�dôœ�d¦�d÷„Z‹ddd�døœ�d§�dü„ZŒdd�dœ�d¨�dÿ„Z��d©�d„ZŽd�dœ�dª�d„Z� eJ�d	¦  «        ddddd�d
œ�d«�d„¦   «         Z�	 	 	 �d“d�dœ�d¬�d„Z‘ eJ�d¦  «        ddddd�d
œ�d«�d„¦   «         Z’	 	 �d­dddddde(j“        j”        ddd�ddddddddd�dœ�d®�d/„Z•dddd�d0œ�d¯�d1„Z–�d°�d2„Z—dddd�d3œ�d±�d7„Z˜�d²�d8„Z™	 �d+dddd�d9œ�d³�d;„Zšddd�d<œ�d´�d@„Z›dd�dAœ�dµ�dF„Zœd�dGœ�d¶�dI„Z��dJZž eŸ�dJ¦  «        ddd�d/�dKœ�d·�dM„¦   «         Z  eŸ�dJ¦  «        �d¸�dP„¦   «         Z¡ eŸ�dJ¦  «        dd�dQœ�d¹�dV„¦   «         Z¢ eŸ�dJ¦  «        �dº�dW„¦   «         Z£ eŸ�dJ¦  «        �d»�dX„¦   «         Z¤d�dYœ�d¼�d]„Z¥ddd�d/�d^œ�d½�d`„Z¦dd�daœ�d¾�db„Z§�d¿�dc„Z¨dddd�ddœ�dÀ�dg„Z©dddd�dhœ�dÁ�dn„Zª�dÂ�dp„Z«dddd�dqœ�dÃ�dr„Z¬�dÄ�ds„Z­dd�dtœ�dÅ�dv„Z®�dÆ�dw„Z¯�dÇ�dz„Z°dd�d{œ�dÈ�d„Z±ddddd�d€œ�dÉ�d„„Z²�dÊ�d†„Z³�dË�d‰„Z´	 �dÌ�dÍ�d‹„Zµ�dÎ�dŽ„Z¶�dÏ�d’„Z·�dÐ�d“„Z¸�dÑ�d”„Z¹�dÒ�d•„Zº�dÒ�d–„Z»�d—�d/dde(j¼        j½        �d˜d�d™œ�dÓ�d¡„Z¾�dÔ�d£„Z¿dddd�d¤œ�dÕ�d§„ZÀddd�d¨œ�dÖ�d«„ZÁddddd�d¬œ�d×�d­„ZÂ�dØ�d®„ZÃ	 �dh�dÙ�d°„ZÄ	 �dh�dÚ�d²„ZÅddd�d³œ�dÛ�d¶„ZÆd�d/d�d·œ�dÜ�d¹„ZÇddddd�dºœ�dÝ�d¿„ZÈd�dÀdddddd�dÁœ�dÞ�dÅ„ZÉd�dÆœ�dß�dÊ„ZÊddddd�dËœ�dà�dÏ„ZËd�dÆœ�dá�dÑ„ZÌddddd�dËœ�dà�dÒ„ZÍ�dâ�dÓ„ZÎ�dâ�dÔ„ZÏ�dã�dÕ„ZÐ�dã�dÖ„ZÑ�d—�d/ddd�d×œ�dä�dØ„ZÒ�d—�d/ddd�d×œ�dä�dÙ„ZÓ�då�dÜ„ZÔ�dæ�dÝ„ZÕ�dâ�dÞ„ZÖ�dç�dß„Z×�dè�dà„ZØ�dé�dá„ZÙ�dê�dâ„ZÚ�d+�df�dã„ZÛ�d+�df�dä„ZÜeÝ	 	 	 	 	 	 	 	 	 	 	 �dë�dì�dó„¦   «         ZÞeÝ	 	 	 	 	 	 	 	 	 	 	 �dë�dí�d÷„¦   «         ZÞ	 	 	 	 	 	 	 	 	 	 	 	 �dî�dï�dþ„ZÞ	 	 	 	 	 	 	 	 	 	 	 	 �dî�dð�d„Zß	 	 	 	 �dñ�dò�d	„Zà eJ�d
¦  «        	 	 	 	 	 	 �dó�dô�d„¦   «         Záeâeãdddd�dœ�dõ�d„¦   «         Zäeâddd�d�dd�dœ�dö�d„¦   «         Zåeâdddd�dœ�d÷�d"„¦   «         Zædd�d#œ�dø�d&„Zçddd�d'œ�dù�d)„Zè�dú�d*„ZédS (û  r�   z.Client for interacting with the LangSmith API.)5Ú__weakref__rk   Ú_api_keyÚ_oauth_access_tokenÚ_workspace_idÚ_headersÚ_custom_headersÚretry_configÚ
timeout_msÚ_timeoutrs   Ú_get_data_type_cachedÚ_web_urlÚ
_tenant_idÚtracing_sample_rateÚ_filtered_post_uuidsÚtracing_queueÚ_anonymizerÚ_hide_inputsÚ_hide_outputsÚ_hide_metadataÚ_omit_traced_runtime_infoÚ_process_buffered_run_opsÚ_run_ops_buffer_sizeÚ_run_ops_buffer_timeout_msÚ_run_ops_buffer_last_flush_timeÚ_infor®  Ú	_settingsÚ_manual_cleanupÚ_atexit_handlerÚ_pyo3_clientÚcompressed_tracesÚ_data_available_eventÚ_futuresÚ_run_ops_bufferÚ_run_ops_buffer_lockÚotel_exporterÚ_otel_traceÚ_set_span_in_contextÚ_max_batch_size_bytesÚ_use_daemon_threadsÚ_tracing_error_callbackÚ_multipart_disabledÚ_cacheÚ_failed_traces_dirÚ_failed_traces_max_bytesÚ_tracing_modeÚ_profile_authÚ_profile_auth_headersÚ_langsmith_apiÚ_langsmith_api_syncÚ_session_providedr‡  r  r  r°  r  r	  ztuple[float, float]r  ré   r  zOptional[_profiles.ProfileAuth]r1  r2  z Optional[LangsmithOpenAPIClient]r3  z$Optional[SyncLangsmithOpenAPIClient]r4  r5  NTF)r’  r
  r  Úweb_urlrs   Úauto_batch_tracingÚ
anonymizerÚhide_inputsÚhide_outputsÚhide_metadataÚomit_traced_runtime_infoÚprocess_buffered_run_opsÚrun_ops_buffer_sizeÚrun_ops_buffer_timeout_msrž  Úapi_urlsÚotel_tracer_providerr™   r˜   r¦  Úworkspace_idÚmax_batch_size_bytesr�   Útracing_error_callbackÚdisable_prompt_cacheÚcacherk   r’  r
  úOptional[Retry]r  ú%Optional[Union[int, tuple[int, int]]]r6  rs   úOptional[requests.Session]r7  r8  ú Optional[Callable[[dict], dict]]r9  ú-Optional[Union[Callable[[dict], dict], bool]]r:  r;  r<  r=  ú4Optional[Callable[[Sequence[dict]], Sequence[dict]]]r>  úOptional[int]r?  r§  rž  ú/Optional[Union[dict, ls_schemas.LangSmithInfo]]r@  r¯  rA  úOptional[TracerProvider]r™   rš   r˜   r›   r¦  rB  rC  r�   rD  ú%Optional[Callable[[Exception], None]]rE  rF  ú"Optional[Union[bool, PromptCache]]rX   rY   c               óÖ  — |r|rt          j        d¦  «        ‚t          j        d¦  «        st          j        d¦  «        r(t          j        d¦  «        rt          j        d¦  «        ‚t	          ||¬¦  «        }|| _        t          d¦  «        }t          d¦  «        }t          d	¦  «        }t          j        ¦   «         } |�|n|p| j	        }!|�|n|}"|d
u o|d
u }#|#o| j
        }$|"�|"n
|$rd
n| j        }%|�|n|p| j        }&|$r| j        nd
| _        d
| _        i | _        t#          |¦  «        | _        t'          ¦   «         | _        t+          |¦  «        | _        t          j        |&¦  «        | _        |pi | _        | j        rSt5          t7          | j        ¦  «        ¦  «        | _	        d
| _        d
| _        i | _        | j        | j	                 | _        nÐt          j        |!¦  «        | _	        |$rOt          j        | t<          ¬¦  «        | _        | j                             ¦   «         | _        | j        j        | _        t          j         |%¦  «        | _        tC          | j	        | j        p| j        p| j        �| j        j"        rdnd
|¬¦  «         | j	        | j        i| _        |ptG          ¦   «         | _$        tK          |tL          ¦  «        r||fn|pd| _'        | j'        d         dz  | j'        d         dz  f| _(        || _)        d
| _*        |r|ntW          j,        ¦   «         }'|'| _-        |d
u| _.        |�tK          |t^          j0        ¦  «        r|nt_          j0        d7i |¤Ž| _1        te          j3        | th          | j-        ¦  «         tk          j6        th          |'¦  «        | _7        tq          j9        | j7        ¦  «         d
| _:        d
| _;        d
| _<        g | _=        t}          j?        ¦   «         | _@        d
| _A        || _B        d| _C        t          jD        d¦  «        dk    | _E        |dv �rS	 t�          ¦   «         \  }(})}*}+ |(jG        ¦   «         },|, H                    t’          ¦  «        }-|€‚tK          |,|(jJ        ¦  «        r=t—          |-d¦  «        r-tK          t™          |(jM        |-¦  «        jN        |(jO        ¦  «        st™          t           |,¦  «        }n |*¦   «         } |(jQ        |¦  «          |+|¬¦  «        | _A        |(| _R        |)| _S        nr# t¨          $ re t«          jV        d|›d�d¬¦  «         d
| _A        d| _        tC          | j	        | j        p| j        p| j        �| j        j"        rdnd
d¬¦  «         Y nw xY w|rˆt          jD        d¦  «        }.|.�tM          |.¦  «        nt®          }/t±          |/¬¦  «        | _Y        t}          jZ        t¶          te          j\        | ¦  «        f| jE        ¬¦  «         ]                    ¦   «          nd
| _Y        t½          | j$        t¾          tÀ          dz   ¬ ¦  «        }0| j-         a                    d!|0¦  «         | j-         a                    d"|0¦  «          tk          jb        d#¬¦  «        | jc        ¦  «        | _d        || _e        |	�|	nt          jD        d$¦  «        dk    | _f        |
�|
nt          jD        d%¦  «        dk    | _g        |�|nt          jD        d&¦  «        dk    | _h        || _i        || _j        || _k        |pd'| _l        tÛ          jm        ¦   «         | _n        |�|€tß          d(¦  «        ‚|€|�tß          d)¦  «        ‚d
| _p        t          jD        d*¦  «        �»d
}1	 dd
lq}1n?# t¨          $ r2}2tä           s                    d+té          |2¦  «        ¦  «         Y d
}2~2nd
}2~2ww xY w|1rrd,}3d-}4d}5d}6	 |1 u                    | j	        | j        |3|4|5|6¦  «        | _p        n?# tì          $ r2}2tä           s                    d.té          |2¦  «        ¦  «         Y d
}2~2nd
}2~2ww xY wd
| _w        d| _x        || _y        |�|rt«          jV        d/tô          d¬¦  «         |�At«          jV        d0tô          d¬¦  «         |du rd
| _{        n/|d1u rtø          | _{        n|| _{        n|stø          | _{        nd
| _{        t          jD        d2¦  «        | _}        t          jD        d3¦  «        }7	 |7rtM          |7¦  «        nd}8|8dk    rtM          |8d4z  d4z  ¦  «        nd5| _~        n9# tÞ          tþ          f$ r% tä           s                    d6|7¦  «         d5| _~        Y nw xY wd
| _€        d
| _�        d
S )8uá!  Initialize a `Client` instance.

        Args:
            api_url: URL for the LangSmith API.

                Defaults to the `LANGCHAIN_ENDPOINT` environment variable or
                `https://api.smith.langchain.com` if not set.
            api_key: API key for the LangSmith API.

                Defaults to the `LANGCHAIN_API_KEY` environment variable.
            retry_config: Retry configuration for the `HTTPAdapter`.
            timeout_ms: Timeout for the `HTTPAdapter`.

                Can also be a 2-tuple of `(connect timeout, read timeout)` to set them
                separately.
            web_url: URL for the LangSmith web app.

                Default is auto-inferred from the `ENDPOINT`.
            session: The session to use for requests.

                If `None`, a new session will be created.

                v2 endpoints are served by an `httpx`-based client, which cannot
                share the session itself. Its headers, cookies, `verify`, `cert`,
                proxies and `trust_env` settings are translated onto that client;
                custom mounted `HTTPAdapter`s, `session.auth` and `session.hooks`
                are not.
            auto_batch_tracing: Whether to automatically batch tracing.
            anonymizer: A function applied for masking serialized run inputs,
                outputs, metadata and error, before sending to the API.
            hide_inputs: Whether to hide run inputs when tracing with this client.

                If `True`, hides the entire inputs.

                If a function, applied to all run inputs when creating runs.
            hide_outputs: Whether to hide run outputs when tracing with this client.

                If `True`, hides the entire outputs.

                If a function, applied to all run outputs when creating runs.
            hide_metadata: Whether to hide run metadata when tracing with this client.

                If `True`, hides the entire metadata.

                If a function, applied to all run metadata when creating runs.
            omit_traced_runtime_info: Whether to omit runtime information from traced
                runs.

                If `True`, runtime information (SDK version, platform, Python version,
                etc.) will not be stored in the `extra.runtime` field of runs.

                Defaults to `False`.
            process_buffered_run_ops: A function applied to buffered run operations that
                allows for modification of the raw run dicts before they are converted
                to multipart and compressed.

                Useful specifically for high throughput tracing where you need to apply
                a rate-limited API or other costly process to the runs before they are
                sent to the API.

                Note that the buffer will only flush automatically when
                `run_ops_buffer_size` is reached or a new run is added to the buffer
                after `run_ops_buffer_timeout_ms` has elapsed - it will not flush
                outside of these conditions unless you manually call `client.flush()`,
                so be sure to do this before your code exits.
            run_ops_buffer_size: Maximum number of run operations to collect in the
                buffer before applying `process_buffered_run_ops` and sending to the
                API.

                Required when `process_buffered_run_ops` is provided.
            run_ops_buffer_timeout_ms: Maximum time in milliseconds to wait before
                flushing the run ops buffer when new runs are added.

                Defaults to `5000`.

                Only used when `process_buffered_run_ops` is provided.
            info: The information about the LangSmith API.

                If not provided, it will be fetched from the API.
            api_urls: A dictionary of write API URLs and their corresponding API keys.

                Useful for multi-tenant setups.

                Data is only read from the first URL in the dictionary. However, ONLY
                Runs are written (`POST` and `PATCH`) to all URLs in the dictionary.
                Feedback, sessions, datasets, examples, annotation queues and evaluation
                results are only written to the first.
            otel_tracer_provider: Optional tracer provider for OpenTelemetry
                integration.

                If not provided, a LangSmith-specific tracer provider will be used.
            tracing_mode: Where to send traces.  One of:

                - ``"langsmith"`` (default) â€” LangSmith only.
                - ``"otel"`` â€” OpenTelemetry export only.
                - ``"hybrid"`` â€” both OTel and LangSmith.

                Falls back to the ``LANGSMITH_TRACING_MODE`` env var, then to
                the legacy ``OTEL_ENABLED`` / ``OTEL_ONLY`` env vars, then to
                ``"langsmith"``.
            otel_enabled: *Deprecated.* Use ``tracing_mode`` instead.

                When ``True``, interpreted as ``tracing_mode="hybrid"``
                (or ``"otel"`` if the ``OTEL_ONLY`` env var is set).
                Will be removed in the next minor version.
            tracing_sampling_rate: The sampling rate for tracing.

                If provided, overrides the `LANGCHAIN_TRACING_SAMPLING_RATE` environment
                variable.

                Should be a float between `0` and `1`, where `1` means trace everything
                and `0` means trace nothing.
            workspace_id: The workspace ID.

                Required for org-scoped API keys.
            max_batch_size_bytes: The maximum size of a batch of runs in bytes.

                If not provided, the default is set by the server.
            headers: Additional HTTP headers to include in all requests.

                These headers will be merged with the default headers (User-Agent,
                Accept, x-api-key, etc.). Custom headers will not override the default
                required headers.
            tracing_error_callback (Optional[Callable[[Exception], None]]): Optional callback function to handle errors.

                Called when exceptions occur during tracing operations.
            disable_prompt_cache: Disable prompt caching for this client.

                By default, prompt caching is enabled globally using a singleton cache.
                Set this to `True` to disable caching for this specific client instance.

                To configure the global cache, use `configure_global_prompt_cache()`.

                !!! example

                    ```python
                    from langsmith import Client, configure_global_prompt_cache

                    # Use default global cache
                    client = Client()

                    # Disable caching for this client
                    client_no_cache = Client(disable_prompt_cache=True)

                    # Configure global cache settings
                    configure_global_prompt_cache(max_size=200, ttl_seconds=7200)
                    ```
            cache: **[Deprecated]** Control prompt caching behavior.

                This parameter is deprecated. Use `configure_global_prompt_cache()` to
                configure caching, or `disable_prompt_cache=True` to disable it.

                - `True`: Enable caching with the global singleton (default behavior)
                - `False`: Disable caching (equivalent to `disable_prompt_cache=True`)
                - `Cache(...)`/`PromptCache(...)`: Use a custom cache instance

                !!! example

                    ```python
                    from langsmith import Client, Cache, configure_global_prompt_cache

                    # Old API (deprecated but still supported)
                    client = Client(cache=True)  # Use global cache
                    client = Client(cache=False)  # Disable cache

                    # Use custom cache instance
                    my_cache = Cache(max_size=100, ttl_seconds=3600)
                    client = Client(cache=my_cache)

                    # New API (recommended)
                    client = Client()  # Use global cache (default)

                    # Configure global cache for all clients
                    configure_global_prompt_cache(max_size=200, ttl_seconds=7200)

                    # Or disable for a specific client
                    client = Client(disable_prompt_cache=True)
                    ```

        Raises:
            LangSmithUserError: If the API key is not provided when using the hosted service.
            LangSmithUserError: If both `api_url` and `api_urls` are provided.
        z-You cannot provide both api_url and api_urls.ÚLANGSMITH_ENDPOINTÚLANGCHAIN_ENDPOINTÚLANGSMITH_RUNS_ENDPOINTSz]You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS.r—   ÚENDPOINTÚAPI_KEYÚWORKSPACE_IDN)Úapi_key_headerzprofile-authr‘  )i'  i`ê  r   éè  r[   FÚ
USE_DAEMONÚtrue)rS   rT   Ú_tracer)Útracer_providerztracing_mode=zu requires OpenTelemetry packages. Install with `pip install langsmith[otel]`. Falling back to LangSmith-only tracing.r6  r¢   rR   ÚTRACING_QUEUE_MAX_SIZErç   )ÚtargetÚargsÚdaemon)rÕ  rß  rÜ  úhttp://úhttps://r”   ÚHIDE_INPUTSÚHIDE_OUTPUTSÚHIDE_METADATAiˆ  zOrun_ops_buffer_size must be provided when process_buffered_run_ops is specifiedzOprocess_buffered_run_ops must be provided when run_ops_buffer_size is specifiedÚUSE_PYO3_CLIENTzaFailed to import `langsmith_pyo3` when PyO3 client was requested, falling back to Python impl: %sé@B éd   z|Failed to instantiate `langsmith_pyo3.BlockingTracingClient` when PyO3 client was requested, falling back to Python impl: %sz¢Both 'cache' and 'disable_prompt_cache' were provided. The 'cache' parameter is deprecated and will be removed in a future version. Using 'cache' parameter value.zÔThe 'cache' parameter is deprecated and will be removed in a future version. Use 'configure_global_prompt_cache()' to configure the global cache, or 'disable_prompt_cache=True' to disable caching for this client.TÚFAILED_TRACES_DIRÚFAILED_TRACES_MAX_MBi   i  @zJInvalid value for LANGSMITH_FAILED_TRACES_MAX_MB: %r, using default 100 MBrh   )‚r¤   r§   rŒ  Úgetenvr´   r0  r�  r'   Úload_profile_client_configrk   Ú	has_oauthr’  rB  Úoauth_access_tokenr  r1  r2  r­  r  r  r  r·  r®  Úget_workspace_idr  r	  ÚnextÚiterÚget_api_urlÚProfileAuthÚ	X_API_KEYÚcurrent_auth_headersÚget_api_keyr–  Úhas_authr‚  r
  r  rý   r  r  r  r  r‰   ÚSessionrs   r5  Ú
ls_schemasÚLangSmithInfor  ÚweakrefÚfinalizer…  Ú	functoolsr
   r  ÚatexitÚregisterr!  r"  r#  r$  Ú	threadingÚLockr%  r&  r)  r,  r¥   r*  rÂ   Úget_tracer_providerÚ
get_tracerrÆ   ÚProxyTracerProviderÚhasattrr   ÚProxyTracerr]  Ú
NoOpTracerrÊ   Úset_tracer_providerr'  r(  rÀ   rª   r«   r3   r   r  ÚThreadÚ_tracing_control_thread_funcÚrefÚstartrÔ  r0   r/   Úmountr	   Ú_get_data_typer  r  r  r  r  r  r  r  r  r^   r  rï   r   Úlangsmith_pyo3ra   rb   ÚreprÚBlockingTracingClientr@  r  r  r+  ÚDeprecationWarningr-  rM   r.  r/  ÚOverflowErrorr3  r4  )9râ  rk   r’  r
  r  r6  rs   r7  r8  r9  r:  r;  r<  r=  r>  r?  rž  r@  rA  r™   r˜   r¦  rB  rC  r�   rD  rE  rF  Úresolved_modeÚenv_api_urlÚenv_api_keyÚenv_workspace_idÚprofile_configÚapi_url_Úexplicit_or_env_api_keyÚprofile_auth_enabledÚuse_profile_oauthÚapi_key_Úworkspace_id_Úsession_rÁ   r¸   r¹   r»   Úexisting_providerÚtracerÚqueue_maxsize_strÚqueue_maxsizeÚadapterr‘  rM  Úqueue_capacityÚ
batch_sizeÚbatch_timeout_millisÚworker_threadsÚ_max_mb_strÚ_max_mbs9                                                            re   rŽ   zClient.__init__  sŠ  € ðp ð 	�xð 	ÝÔ-Ø?ñô ð õ
 ŒIÐ*Ñ+Ô+ð	Ý/1¬yÐ9MÑ/NÔ/Nð	åŒiÐ2Ñ3Ô3ð	õ Ô-ð0ñô ð õ
 .¨lÈÐVÑVÔVˆØ*7ˆÔÝ5°jÑAÔAˆÝ5°iÑ@Ô@ˆÝ:¸>ÑJÔJÐÝ"Ô=Ñ?Ô?ˆàÐ*ˆGˆG°Ð0U¸~Ô?Uð 	ð .5Ð-@ ' 'ÀkÐØ&¨$˜ÐF°;À$Ð3FÐØ0ÐM°^Ô5MÐð 'Ð2ð $Ð#ð !ð(��àÔ'ð 	ð Ð'ð ˆLà!Ð@ ^Ô%@ð 	ð 2CÐLˆNÔ-Ð-Èð 	Ô ð ?CˆÔØ57ˆÔ"å#=Ð>SÑ#TÔ#TˆÔ Ý47±E´EˆÔ!Ý<OØñ=
ô =
ˆÔõ &Ô6°}ÑEÔEˆÔà&˜}¨"ˆÔàÔð 	@Ý¥ TÔ%9Ñ :Ô :Ñ;Ô;ˆDŒLØ'+ˆDÔ$Ø!%ˆDÔØ)+ˆDÔ&ØÔ/°´Ô=ˆDŒLˆLå#Ô/°Ñ9Ô9ˆDŒLØ ð QÝ%.Ô%:Ø"Ý#,ð&ñ &ô &�Ô"ð .2Ô-?×-TÒ-TÑ-VÔ-V�Ô*Ø+/Ô+=Ô+P�Ô(Ý#Ô/°Ñ9Ô9ˆDŒLÝ'Ø”Ø”ð ØÔ+ðð Ô)Ð5¸$Ô:LÔ:UÐ5ð #�Nàà*ð
ñ 
ô 
ð 
ð %)¤L°$´,Ð#?ˆDÔ Ø(ÐCÕ,AÑ,CÔ,CˆÔõ ˜*¥cÑ*Ô*ð2ˆZ˜Ð$Ð$àÐ0Ð 0ð 	Œð
 œ¨Ô+¨dÑ2°D´OÀAÔ4FÈÑ4MÐNˆŒØˆŒØ/3ˆŒà%Ð=�7�7­8Ô+;Ñ+=Ô+=ˆØˆŒð ")°Ð!4ˆÔð ˆ|�z¨$µ
Ô0HÑIÔIˆ|ð ˆDåÔ)Ð1Ð1¨DÐ1Ð1ð 	Œ
õ
 	Ô˜�}¨d¬lÑ;Ô;Ð;Ý=FÔ=NÝ˜8ñ>
ô >
ˆÔõ 	Œ˜Ô,Ñ-Ô-Ð-Ø=AˆÔØ@DˆÔ"Ø>BˆŒØQSˆÔÝ$-¤NÑ$4Ô$4ˆÔ!Ø59ˆÔØ%9ˆÔ"Ø).ˆÔ Ý#+Ô#7¸Ñ#EÔ#EÈÒ#OˆÔ àÐ.Ð.Ñ.ð3õ !‘N”NñØØ'Ø,Ø ð %C JÔ$BÑ$DÔ$DÐ!Ø*×5Ò5µhÑ?Ô?�Ø'Ð/å"Ð#4°jÔ6TÑUÔUðMå# F¨IÑ6Ô6ðMõ 'Ý Ø *Ô 6Ø &ñô ô &Ø&Ô1ñô ðMõ 04µNÐDUÑ/VÔ/VÐ,Ð,à/GÐ/GÑ/IÔ/IÐ,Ø6˜
Ô6Ð7KÑLÔLÐLà%1 \ÐBVÐ%WÑ%WÔ%W�Ô"Ø#-�Ô Ø,?�Ô)Ð)øåð ð ð Ý”ð> Mð >ð >ð >ð  !ð	ñ ô ð ð &*�Ô"Ø%0�Ô"Ý+Ø”LØ”Lð ØÔ/ðð  Ô-Ð9Ø Ô.Ô7ð :ð '˜ð "à!,ðñ ô ð ð ð ðøøøð. ð 	&Ý (Ô 4Ð5MÑ NÔ NÐð %Ð0õ Ð%Ñ&Ô&Ð&å,ð õ
 ;HØ%ð;ñ ;ô ;ˆDÔõ ÔÝ3õ ”k $Ñ'Ô'Ð)ØÔ/ðñ ô ÷ Še‰gŒgˆgˆgà!%ˆDÔõ (ØÔ)Ý&õ 7¸Ñ:ð
ñ 
ô 
ˆð 	Œ×Ò˜9 gÑ.Ô.Ð.ØŒ×Ò˜: wÑ/Ô/Ð/Ø%D¥YÔ%8ÀÐ%DÑ%DÔ%DØÔñ&
ô &
ˆÔ"ð &ˆÔð Ð&ð ˆKåÔ% mÑ4Ô4¸Ò>ð 	Ôð Ð'ð ˆLåÔ% nÑ5Ô5¸Ò?ð 	Ôð Ð(ð ˆMåÔ% oÑ6Ô6¸&Ò@ð 	Ôð
 *BˆÔ&Ø)AˆÔ&Ø$7ˆÔ!Ø*CÐ*KÀtˆÔ'Ý/3¬y©{¬{ˆÔ,ð $Ð/Ð4GÐ4OÝØañô ð ð $Ð+Ð0CÐ0OÝØañô ð ð
 !ˆÔÝÔÐ 1Ñ2Ô2Ð>Ø!ˆNðØ%Ð%Ð%Ð%Ð%øÝð ð ð Ý—’ð6å˜‘G”Gñô ð ð ð ð ð ð øøøøðøøøð ð à!*�Ø �
Ø'+Ð$Ø!"�ðØ(6×(LÒ(LØœØœØ&Ø"Ø,Ø&ñ)ô )�DÔ%Ð%øõ !ð ð ð Ý—N’NðZå˜Q™œñô ð ð ð ð ð ð øøøøðøøøð EIˆŒà$ˆÔà'=ˆÔ$ð ÐÐ!5ÐÝŒMð1õ #Øðñ ô ð ð ÐÝŒMðRõ #Øðñ ô ð ð ˜ˆ~ˆ~Ø59�”�Ø˜$��Ý4�”�ð $�”�Ø%ð 	å0ˆDŒKˆKàˆDŒKå19Ô1EØñ2
ô 2
ˆÔõ Ô*Ð+AÑBÔBˆð	>Ø*5Ð<•c˜+Ñ&Ô&Ð&¸1ˆGà.5¸ªk¨k•�G˜d‘N TÑ)Ñ*Ô*Ð*Ð?Pð Ô)Ð)øõ �MÐ*ð 	>ð 	>ð 	>Ý�NŠNð'àñô ð ð
 ->ˆDÔ)Ð)Ð)ð	>øøøð #ˆÔØ#'ˆÔ Ð Ð sV   Ð/CT ÔA,U>Õ=U>Ý8]= Ý=
^9Þ(^4Þ4^9ß)_1 ß1
`-ß;(`(à(`-ã,5d" ä"3eåeú_httpx.Timeoutc                óŠ   — t          j        | j        d         | j        d         | j        d         | j        d         ¬¦  «        S )Nr   r[   )ÚconnectÚreadÚwriteÚpool)rŒ   ÚTimeoutr  ©râ  s    re   Ú_openapi_timeoutzClient._openapi_timeout4  sC   € ÝŒ~Ø”M !Ô$Ø”˜qÔ!Ø”- Ô"Ø”˜qÔ!ð	
ñ 
ô 
ð 	
ri   ÚLangsmithOpenAPIClientc                óD  — | j         €“t          | j        ¦  «        }|                      ¦   «         }d }| j        r!t          d||dœt          | j        ¦  «        ¤Ž}t          | j	        | j
        rt          | j
        ¦  «        nd ||| j        pd |¬¦  «        | _         | j         S ©N)Úbase_urlÚtimeout)r’  Ú	tenant_idr¹  rº  rŠ   Úhttp_clientrh   )r3  rr   rk   rµ  r5  Ú_AsyncHttpxClientWrapperr’   rs   r¶  r  r  rW   r  ©râ  r¹  rº  r¼  s       re   Ú_get_langsmith_apizClient._get_langsmith_api<  sÅ   € ØÔÐ&Ý,¨T¬\Ñ:Ô:ˆHØ×+Ò+Ñ-Ô-ˆGØˆKØÔ%ð Ý6ð Ø%Ø#ðð õ 1°´Ñ>Ô>ðð �õ
 #9ØœØ59Ô5GÐQ�#˜dÔ0Ñ1Ô1Ð1ÈTØ!ØØ $¤Ð 5°Ø'ð#ñ #ô #ˆDÔð Ô"Ð"ri   ÚSyncLangsmithOpenAPIClientc                óD  — | j         €“t          | j        ¦  «        }|                      ¦   «         }d }| j        r!t          d||dœt          | j        ¦  «        ¤Ž}t          | j	        | j
        rt          | j
        ¦  «        nd ||| j        pd |¬¦  «        | _         | j         S r¸  )r4  rr   rk   rµ  r5  Ú_SyncHttpxClientWrapperr’   rs   rÀ  r  r  rW   r  r¾  s       re   Ú_get_langsmith_api_synczClient._get_langsmith_api_syncQ  sÆ   € ØÔ#Ð+Ý,¨T¬\Ñ:Ô:ˆHØ×+Ò+Ñ-Ô-ˆGØˆKØÔ%ð Ý5ð Ø%Ø#ðð õ 1°´Ñ>Ô>ðð �õ
 (BØœØ59Ô5GÐQ�#˜dÔ0Ñ1Ô1Ð1ÈTØ!ØØ $¤Ð 5°Ø'ð(ñ (ô (ˆDÔ$ð Ô'Ð'ri   rÑ   c                ój   — t          | j        j        d¬¦  «         |                      ¦   «         j        S )zAccess the runs resource.ú0.16.0©Úmin_version)r)   rž  rî   r¿  rö  r´  s    re   rö  zClient.runsf  s1   € õ 	˜tœyÔ0¸hÐGÑGÔGÐGØ×&Ò&Ñ(Ô(Ô-Ð-ri   ÚAsyncEvaluatorsResourcec                ój   — t          | j        j        d¬¦  «         |                      ¦   «         j        S )zAccess the evaluator resource.rÅ  rÆ  )r)   rž  rî   r¿  Úonline_evaluatorsr´  s    re   Ú
evaluatorszClient.evaluatorsl  s1   € õ 	˜tœyÔ0¸hÐGÑGÔGÐGØ×&Ò&Ñ(Ô(Ô:Ð:ri   rÒ   c                ój   — t          | j        j        d¬¦  «         |                      ¦   «         j        S )z=Access the sandboxes resource (registries, snapshots, boxes).rÅ  rÆ  )r)   rž  rî   r¿  Ú	sandboxesr´  s    re   rÍ  zClient.sandboxesr  s1   € õ 	˜tœyÔ0¸hÐGÑGÔGÐGØ×&Ò&Ñ(Ô(Ô2Ð2ri   rÎ   c                ój   — t          | j        j        d¬¦  «         |                      ¦   «         j        S )z8Access the v2 datasets resource (experiment_runs, etc.).rÅ  rÆ  )r)   rž  rî   r¿  Údatasetsr´  s    re   rÏ  zClient.datasetsx  s1   € õ 	˜tœyÔ0¸hÐGÑGÔGÐGØ×&Ò&Ñ(Ô(Ô1Ð1ri   rÍ   c                ój   — t          | j        j        d¬¦  «         |                      ¦   «         j        S )z4Access the annotation queues resource (runs, items).z0.16.14rÆ  )r)   rž  rî   r¿  Úannotation_queuesr´  s    re   rÑ  zClient.annotation_queues~  s1   € õ 	˜tœyÔ0¸iÐHÑHÔHÐHØ×&Ò&Ñ(Ô(Ô:Ð:ri   rÓ   c                ój   — t          | j        j        d¬¦  «         |                      ¦   «         j        S )z8Access the threads resource (query, stats, list_traces).rÅ  rÆ  )r)   rž  rî   r¿  Úthreadsr´  s    re   rÓ  zClient.threads…  s1   € õ 	˜tœyÔ0¸hÐGÑGÔGÐGØ×&Ò&Ñ(Ô(Ô0Ð0ri   rÔ   c                ój   — t          | j        j        d¬¦  «         |                      ¦   «         j        S )z.Access the traces resource (query, list_runs).rÅ  rÆ  )r)   rž  rî   r¿  Útracesr´  s    re   rÕ  zClient.traces‹  ó1   € õ 	˜tœyÔ0¸hÐGÑGÔGÐGØ×&Ò&Ñ(Ô(Ô/Ð/ri   rÐ   c                ój   — t          | j        j        d¬¦  «         |                      ¦   «         j        S )z&Access the public shared-run resource.rÅ  rÆ  )r)   rž  rî   r¿  Úpublicr´  s    re   rØ  zClient.public‘  rÖ  ri   Úbody_fnúCallable[[], bytes]r  c                óì   — | j         sdS 	  |¦   «         }t          |t          ¦  «        r|                     d¦  «        }|                      | j         |d|| j        ¬¦  «         dS # t          $ r Y dS w xY w)uø   Dump a failed trace payload to disk if a fallback directory is configured.

        *body_fn* is called lazily inside a try/except so that any serialization
        errors are silently swallowed â€” we must never raise from a failure path.
        Nzutf-8zruns/multipart)Úendpointr�   Ú	max_bytes)r.  r  rW   ÚencodeÚ_write_trace_to_fallback_dirr/  r@  )râ  rÙ  r�   rÅ  s       re   Ú_dump_failed_tracezClient._dump_failed_trace—  s§   € ð Ô&ð 	ØˆFð	Ø�7‘9”9ˆDÝ˜$¥Ñ$Ô$ð ,Ø—{’{ 7Ñ+Ô+�Ø×-Ò-ØÔ'ØØ)ØØÔ7ð .ñ ô ð ð ð øõ ð 	ð 	ð 	ØˆDˆDð	øøøs   ‹AA% Á%
A3Á2A3)rÝ  Ú	directoryrW   rÅ  rü  rÜ  rÝ  c               ó¬  — d||t          j        |¦  «                             ¦   «         dœ}dt          j        ¦   «         d›dt	          j        ¦   «         j        dd…         › d�}t          | ¦  «        |z  }	 | t          vr6|j	         
                    d	d	¬
¦  «         t                               | ¦  «         |�f|dk    r`t          | ¦  «        }t          d„ |                     d¦  «        D ¦   «         ¦  «        }	|	|k    rt                               d| |	|¦  «         dS |                     d¦  «        }
|
                     t%          j        |¦  «        ¦  «         |
                     d¦  «         |
                     |¦  «         t                               d|¦  «         dS # t,          $ r'}t                               d| |¦  «         Y d}~dS d}~ww xY w)a&  Persist a failed trace payload to a local fallback directory.

        Saves a self-contained JSON file with the endpoint, the HTTP headers
        required for replay, and the base64-encoded request body.  Can be
        replayed later with a simple POST:

            POST /<endpoint>
            Content-Type: <value from saved headers>
            [Content-Encoding: <value from saved headers>]
            <decoded body>

        If *max_bytes* is set, new traces are dropped when the directory is
        already at or over the budget.
        r[   )rî   rÜ  r�   Úbody_base64Útrace_z.6fr  Né   z.jsonT)ÚparentsÚexist_okr   c              3  óp   K  — | ]1}|                      ¦   «         ¯|                     ¦   «         j        V — Œ2d S ry   )Úis_fileÚstatÚst_size)r|   Úfs     re   r	  z6Client._write_trace_to_fallback_dir.<locals>.<genexpr>×  sO   è è € ð ð àØ—y’y‘{”{ðØ—F’F‘H”HÔ$ðð ð ð ð ð ri   ztrace_*.jsonz•Could not write trace to fallback dir %s as it's already over size limit (%d bytes >= %d bytes). Increase LANGSMITH_FAILED_TRACES_MAX_MB if possible.z.tmpi€  zALangSmith trace upload failed; data saved to %s for later replay.zELangSmith tracing error: could not write trace to fallback dir %s: %s)Úbase64Ú	b64encodeÚdecoder^   r[  Úuuid4Úhexr   ræ   ÚparentÚmkdirÚaddÚsumÚglobra   rb   Úwith_suffixÚ
write_textÚjsonÚdumpsÚchmodÚrenamer@  Úerror)rá  rÅ  rÜ  r�   rÝ  ÚenvelopeÚfilenameÚfilepathÚdir_pathru  Ú	temp_pathÚ	write_excs               re   rß  z#Client._write_trace_to_fallback_dir±  s  € ð0 Ø ØÝ!Ô+¨DÑ1Ô1×8Ò8Ñ:Ô:ð	
ð 
ˆð J�DœI™KœKÐIÐIÐI­d¬j©l¬lÔ.>¸rÀ¸rÔ.BÐIÐIÐIˆÝ˜	‘?”? XÑ-ˆð#	ØÕ 6Ð6Ð6Ø”×%Ò%¨d¸TÐ%ÑBÔBÐBÝ&×*Ò*¨9Ñ5Ô5Ð5ØÐ$¨°Qª¨å 	™?œ?�Ýð ð à%Ÿ]š]¨>Ñ:Ô:ðñ ô ñ ô �ð
 ˜IÒ%Ð%Ý—N’NðOð "ØØ!ñô ð ð �FØ ×,Ò,¨VÑ4Ô4ˆIØ× Ò ¥¤¨HÑ!5Ô!5Ñ6Ô6Ð6Ø�OŠO˜EÑ"Ô"Ð"Ø×Ò˜XÑ&Ô&Ð&Ý�NŠNØSØñô ð ð ð øõ ð 	ð 	ð 	Ý�LŠLØWØØñô ð ð ð ð ð ð ð øøøøð	øøøs    Á8B%F" ÄBF" Æ"
GÆ,GÇGc                ó   — | j         }d|› d�S )z•Return an HTML representation of the instance with a link to the URL.

        Returns:
            The HTML representation of the instance.
        z	<a href="z6", target="_blank" rel="noopener">LangSmith Client</a>)Ú	_host_url)râ  Úlinks     re   Ú_repr_html_zClient._repr_html_õ  s   € ð Œ~ˆØW˜4ÐWÐWÐWÐWri   rý  r@  c                óž   — | j         rE	 |                       |¦  «         dS # t          $ r  t                               dd¬¦  «         Y dS w xY wdS )z�Invoke the background tracing error callback if configured.

        Args:
            error: The exception that occurred during background tracing.
        z!Error in tracing_error_callback:
T©Úexc_infoN)r+  r@  ra   rý  )râ  rý  s     re   Ú_invoke_tracing_error_callbackz%Client._invoke_tracing_error_callbackþ  sƒ   € ð Ô'ð 	ðØ×,Ò,¨UÑ3Ô3Ð3Ð3Ð3øÝð ð ð Ý—’Ø8Ø!ð ñ ô ð ð ð ð ðøøøð	ð 	s   ‰   &A
Á	A
c                ó   — d| j         › d�S )z˜Return a string representation of the instance with a link to the URL.

        Returns:
            The string representation of the instance.
        zClient (API URL: ú)©rk   r´  s    re   Ú__repr__zClient.__repr__  s   € ð 3 4¤<Ð2Ð2Ð2Ð2ri   c                ó*   — t          | j        ¦  «        S ry   )rÒ  rk   r´  s    re   Ú_hostzClient._host  s   € å˜$œ,Ñ'Ô'Ð'ri   c                ó@   — t          j        | j        | j        ¦  «        S )zThe web host url.)r¤   Úget_host_urlr  rk   r´  s    re   r  zClient._host_url  s   € õ Ô$ T¤]°D´LÑAÔAÐAri   c                ó  — dt           j        › �ddœ}|                     | j        ¦  «         | j        r| j        |t
          <   n6| j        r|                     | j        ¦  «         n| j        rd| j        › �|d<   | j        r
| j        |d<   |S )Nzlangsmith-py/úapplication/json)z
User-AgentÚAcceptzBearer ÚAuthorizationúX-Tenant-Id)	rR   rë   rD  r	  r’  rv  r2  r  r  )râ  r�   s     re   Ú_compute_headerszClient._compute_headers  s²   € àA­)Ô*?ÐAÐAØ(ð
ð 
ˆð
 	�Š�tÔ+Ñ,Ô,Ð,ØŒ<ð 	LØ!%¤ˆG•IÑÐØÔ'ð 	LØ�NŠN˜4Ô5Ñ6Ô6Ð6Ð6ØÔ%ð 	LØ'K°Ô1IÐ'KÐ'KˆG�OÑ$ØÔð 	8Ø%)Ô%7ˆG�MÑ"Øˆri   Ú	attr_namer~   r   c                óš   — t                                | ||¦  «         t                                | d|                      ¦   «         ¦  «         dS )z8Set attributes that affect headers and recalculate them.r  N)ÚobjectÚ__setattr__r  )râ  r  r~   s      re   Ú_set_header_affecting_attrz!Client._set_header_affecting_attr/  sD   € å×Ò˜4 ¨EÑ2Ô2Ð2Ý×Ò˜4 ¨T×-BÒ-BÑ-DÔ-DÑEÔEÐEÐEÐEri   c                ó8  — | j         s| j        €d S | j                             ¦   «         }t                               | d|¦  «         t                               | d| j        j        ¦  «         t                               | d|                      ¦   «         ¦  «         d S )Nr2  r  r  )r’  r1  Úget_auth_headersr  r  rp  r  )râ  Úauth_headerss     re   Ú_ensure_profile_authzClient._ensure_profile_auth4  s˜   € ØŒ<ð 	˜4Ô-Ð5ØˆFØÔ)×:Ò:Ñ<Ô<ˆÝ×Ò˜4Ð!8¸,ÑGÔGÐGÝ×ÒØÐ'¨Ô);Ô)Nñ	
ô 	
ð 	
õ 	×Ò˜4 ¨T×-BÒ-BÑ-DÔ-DÑEÔEÐEÐEÐEri   c                ó   — | j         S )z+Return the API key used for authentication.)r  r´  s    re   r’  zClient.api_key>  s   € ð Œ}Ðri   c                ó2   — |                       d|¦  «         d S )Nr  ©r  ©râ  r~   s     re   r’  zClient.api_keyC  s   € à×'Ò'¨
°EÑ:Ô:Ð:Ð:Ð:ri   c                ó   — | j         S )z.Return the workspace ID used for API requests.)r  r´  s    re   rB  zClient.workspace_idG  ó   € ð Ô!Ð!ri   c                ó2   — |                       d|¦  «         d S )Nr  r%  r&  s     re   rB  zClient.workspace_idL  s   € à×'Ò'¨¸Ñ?Ô?Ð?Ð?Ð?ri   c                ó   — | j         S )z0Return the custom headers used for API requests.)r	  r´  s    re   r�   zClient.headersP  s   € ð Ô#Ð#ri   c                ó6   — |                       d|pi ¦  «         d S )Nr	  r%  r&  s     re   r�   zClient.headersU  s#   € à×'Ò'Ð(9¸5¸;ÀBÑGÔGÐGÐGÐGri   rŸ  c           	     ó  — | j         �| j         S | j        dk    r&| j        �t          j        ¦   «         | _         | j         S 	 |                      ddddi| j        ¬¦  «        }t          j        |¦  «         t          j        d
i | 	                    ¦   «         ¤Ž| _         na# t          $ rT}t                               d| j        › d	t          |¦  «        › �¦  «         t          j        ¦   «         | _         Y d}~nd}~ww xY w| j         S )z£Get the information about the LangSmith API.

        Returns:
            The information about the LangSmith API, or `None` if the API is not available.
        NrS   ÚGETz/infor  r  )r�   rº  zFailed to get info from ú: rh   )r  r0  r&  r{  r|  Úrequest_with_retriesr  r¤   Úraise_for_status_with_textrù  ÚBaseExceptionra   rb   rk   r’  )râ  ÚresponserM  s      re   rž  zClient.infoY  s"  € ð Œ:Ð!Ø”:Ðð Ô Ò'Ð'¨DÔ,>Ð,JÝ#Ô1Ñ3Ô3ˆDŒJØ”:Ðð	4Ø×0Ò0ØØØ!Ð#5Ð6Øœð	 1ñ ô ˆHõ Ô/°Ñ9Ô9Ð9Ý#Ô1ÐDÐD°H·M²M±O´OÐDÐDˆDŒJˆJøÝð 	4ð 	4ð 	4Ý�NŠNØD¨4¬<ÐDÐD½4À¹7¼7ÐDÐDñô ð õ $Ô1Ñ3Ô3ˆDŒJˆJˆJˆJˆJˆJøøøøð		4øøøð ŒzÐs   ÁAB Â
C<Â(A
C7Ã7C<úls_schemas.LangSmithSettingsc                óÂ   — | j         €R|                      dd¦  «        }t          j        |¦  «         t	          j        di |                     ¦   «         ¤Ž| _         | j         S )ztGet the settings for the current tenant.

        Returns:
            The settings for the current tenant.
        Nr-  z	/settingsrh   )r  r/  r¤   r0  r{  ÚLangSmithSettingsrù  )râ  r2  s     re   Ú_get_settingszClient._get_settingsz  sZ   € ð Œ>Ð!Ø×0Ò0°¸ÑDÔDˆHÝÔ/°Ñ9Ô9Ð9Ý'Ô9ÐLÐL¸H¿MºM¹O¼OÐLÐLˆDŒNàŒ~Ðri   Úcontent_lengthc                óÎ   — |�| j         €d S t          t          j        | j         ¦  «        }|j        }|sd S | j        p|                     d¦  «        }|€d S ||k    r	d|› d|› d�S d S )NÚsize_limit_byteszThe content length of z) bytes exceeds the maximum size limit of z bytes.)r  r   r{  r|  Úbatch_ingest_configr)  r{   )râ  r7  rž  ÚbicÚ
size_limits        re   Ú_content_above_sizezClient._content_above_size‡  sœ   € ØÐ! T¤ZÐ%7Ø�4Ý•JÔ,¨d¬jÑ9Ô9ˆØÔ&ˆØð 	Ø�4ØÔ/ÐN°3·7²7Ð;MÑ3NÔ3Nˆ
ØÐØ�4Ø˜JÒ&Ð&ð=¨ð =ð =Ø)3ð=ð =ð =ðð ˆtri   r[   r‹  )Úrequest_kwargsÚstop_after_attemptÚretry_onÚ	to_ignoreÚhandle_responseÚ_contextÚmethodú0Literal['GET', 'POST', 'PUT', 'PATCH', 'DELETE']Úpathnamer>  úOptional[Mapping]r?  rý   r@  ú'Optional[Sequence[type[BaseException]]]rA  rB  ú1Optional[Callable[[requests.Response, int], Any]]rC  r�   úrequests.Responsec              ó~  — |                       ¦   «          |pi }i | j        ¥|                     di ¦  «        ¥|	                     di ¦  «        ¥}
| j        �| j                             |
¦  «        }
d| j        i|¥|	¥d|
i¥}|dk    r.d|v r*d|vr&|d                              d¦  «        sd|d         d<   t          j        ¦   «         t          j        t          | j
        ¦  «        ¬	¦  «        g}g |pd
¢t          j        t          j        t          j        f¢R }g |pd
¢R }d}t          |¦  «        D �]r}	 	 t          j        t           |¦  «        5   | j        j        |t'          | j        |¦  «        fddi|¤Ž}ddd¦  «         n# 1 swxY w Y   t          j        |¦  «         |c S # t,          j        j        $ r_}t2                               d|¦  «         |dz   |k    r‚ d|z  t7          j        ¦   «         dz  z   }t9          j        |¦  «         Y d}~Œæd}~wt,          j        $ �rF}|��|� |dz   |k     r |||dz   ¦  «        }|rY d}~�Œ|j        dk    r4t          j        d|j        › d|› d|› dtA          |¦  «        › |› �	¦  «        ‚|j        dk    rt          j        d|› |› d|› �¦  «        ‚|j        dk    r)t          j!        d|› dtA          |¦  «        › |› �¦  «        ‚|j        dk    r)t          j"        d|› dtA          |¦  «        › |› �¦  «        ‚|j        dk    r)t          j#        d|› dtA          |¦  «        › |› �¦  «        ‚|j        dk    r)t          j$        d |› dtA          |¦  «        › |› �¦  «        ‚|j        d!k    r‡	 | %                    ¦   «         }|                     d"d#¦  «        }|d$k    rt          j&        d%¦  «        ‚n# tN          tP          f$ r Y nw xY wt          j)        d&|› d|› dtA          |¦  «        › �¦  «        ‚t          j)        d&|› d|› dtA          |¦  «        › �¦  «        ‚t          j&        d&|› d|› dtA          |¦  «        › �¦  «        ‚d}~wt,          j*        $ �r"}| j        d'k    rd(nd)}	 tW          |j        r,t          |j        j,                             d*¦  «        ¦  «        nd#¦  «        }|  -                    |¦  «        }|r|}n# tN          $ r d}Y nw xY w|j        r!|j        j,                             d+¦  «        pd#nd#}|dd,…         |d-d…         }}d.t]          d/t_          |¦  «        d0z
  ¦  «        z  }|› |› |› �}t          j        d1|› d|› d|› dtA          |¦  «        › d2|› d3|› |› �¦  «        |‚d}~wt`          $ rÈ}tc          |j2        ¦  «        }t_          |¦  «        dk    r|d         nd#}| 3                    d4d5¦  «        }|rXd6 4                    t          |d/         ¦  «        g|gz   d7„ t_          |¦  «        dk    r
|dd…         ng D ¦   «         z   ¦  «        }n|}t          j)        d&|› d|› d|› |› �¦  «        |‚d}~ww xY w# |$ r1}|�$t2                               d|¦  «         |cY d}~c S Y d}~�Œsd}~wt          j!        $ r« |dz   |k    r‚ |�k	 tk          |j,                             d8d9¦  «        ¦  «        } nA# t`          $ r4}t2           6                    d:tA          |¦  «        ¦  «         d;} Y d}~nd}~ww xY w| d|z  z  t7          j        ¦   «         z   } t9          j        | ¦  «         Y �Œ/|$ r> |dz   |k    r‚ d|z  t7          j        ¦   «         dz  z   }t9          j        |¦  «         Y �Œpw xY wt          j)        d&|› d|› d<�¦  «        ‚)=a  Send a request with retries.

        Args:
            method: The HTTP request method.
            pathname: The pathname of the request URL. Will be appended to the API URL.
            request_kwargs: Additional request parameters.
            stop_after_attempt: The number of attempts to make.
            retry_on: The exceptions to retry on.

                In addition to: `[LangSmithConnectionError, LangSmithAPIError]`.
            to_ignore: The exceptions to ignore / pass on.
            handle_response: A function to handle the response and return whether to
                continue retrying.
            _context: The context of the request.
            **kwargs: Additional keyword arguments to pass to the request.

        Returns:
            The response object.

        Raises:
            LangSmithAPIError: If a server error occurs.
            LangSmithUserError: If the request fails.
            LangSmithConnectionError: If a connection error occurs.
            LangSmithError: If the request fails.
        r�   Nrº  r-  ÚdataÚfilesúContent-Typer  )rÑ  rh   ÚstreamFzPassing on exception %sr[   r6  rt  iô  zServer error (z) caused failure to ú z in LangSmith API. rs  z(Client took too long to send request to i­  zRate limit exceeded for z. i‘  zAuthentication failed for i”  zResource not found for i™  zConflict for i“  rý  r‹  Ú!org_scoped_key_requires_workspacez�This API key is org-scoped and requires workspace specification. Please provide 'workspace_id' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.z
Failed to rZ  z'Please confirm your LANGCHAIN_ENDPOINT.z(Please confirm your internet connection.zContent-Lengthrã   é   éþÿÿÿÚ*r   é   z#Connection error caused failure to z
Content-Length: z

API Key: rs   zsession (project)ú
c                ó,   — g | ]}t          |¦  «        ‘ŒS rh   ©rW   )r|   Úargs     re   ú
<listcomp>z/Client.request_with_retries.<locals>.<listcomp>`  s   € ÐWÐWÐW¨C�s 3™xœxÐWÐWÐWri   zretry-afterÚ30zInvalid retry-after header: %sé   z in LangSmith API.)7r"  r  r{   r1  Úprepare_request_headersr  r¤   ÚFilterLangSmithRetryÚFilterPoolFullWarningrW   r  ÚLangSmithConnectionErrorÚLangSmithRequestTimeoutÚLangSmithAPIErrorÚrangeÚfilter_logsÚ_urllib3_loggerrs   ÚrequestÚ_construct_urlrk   r0  r‰   Ú
exceptionsÚReadTimeoutra   rñ   Úrandomr^   ÚsleepÚ	HTTPErrorÚstatus_coder’  ÚLangSmithRateLimitErrorÚLangSmithAuthErrorÚLangSmithNotFoundErrorÚLangSmithConflictErrorrù  r§   rï   ÚKeyErrorrB  ÚConnectionErrorrý   r�   r=  Úmaxrp   r@  r  ra  Úreplacer¨   r›  rb   )!râ  rD  rF  r>  r?  r@  rA  rB  rC  r�   r�   Úlogging_filtersÚ	retry_on_Ú
to_ignore_r2  ÚidxrM  Ú
sleep_timeÚshould_continueÚ
error_dataÚ
error_codeÚrecommendationr7  Úsize_recr’  Úprefixrq   ÚfillerÚmasked_api_keyra  ÚmsgÚemsgÚretry_afters!                                    re   r/  zClient.request_with_retries˜  s  € ðN 	×!Ò!Ñ#Ô#Ð#Ø'Ð-¨2ˆð
ØŒmð
à× Ò  ¨BÑ/Ô/ð
ð �jŠj˜ BÑ'Ô'ð
ˆð
 ÔÐ)ØÔ(×@Ò@ÀÑIÔIˆGà�t”}ð
àð
ð ð
ð �wð	
ð 
ˆð �eŠOˆOØ˜.Ð(Ð(Ø˜~Ð-Ð-Ø" 9Ô-×1Ò1°.ÑAÔAð .ð 9KˆN˜9Ô% nÑ5åÔ)Ñ+Ô+ÝÔ*µ°D´J±´Ð@Ñ@Ô@ð
ˆð6
Øˆn˜"ð6
õ Ô1ÝÔ0ÝÔ*ðð6
ð 6
ˆ	ð 7L¸¸ÀbÐ6KÐ6Kˆ
ØˆÝÐ+Ñ,Ô,ð ^	ñ ^	ˆCð]ðBÝ!Ô-­o¸ÑOÔOð ð Ø#7 4¤<Ô#7Ø"Ý*¨4¬<¸ÑBÔBð$ð $ð $)ð$ð -ð	$ð $˜ðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð õ Ô7¸ÑAÔAÐAØ#�O�O�OøÝÔ*Ô6ð ð ð Ý—L’LÐ!:¸AÑ>Ô>Ð>Ø˜Q‘wÐ"4Ò4Ð4ØØ!" C¡­6¬=©?¬?¸SÑ+@Ñ!A�JÝ”J˜zÑ*Ô*Ð*Ø�H�H�H�HøøøøåÔ)ð ?ñ ?ð ?ØÑ+Ø*Ð6Ø" Q™wÐ);Ò;Ð;Ø2A°/À(ÈCÐRSÉGÑ2TÔ2T Ø#2ð !-Ø$, H H H¡HØ#Ô/°3Ò6Ð6Ý"*Ô"<ð!.°Ô1Eð !.ð !.Ð[að !.ð !.Ø$,ð!.ð !.å37¸±7´7ð!.ð $,ð!.ð !.ñ#ô #ð ð &Ô1°SÒ8Ð8Ý"*Ô"Bð!9È6ð !9Ø#+ð!9ð !9Ø.6ð!9ð !9ñ#ô #ð ð &Ô1°SÒ8Ð8Ý"*Ô"Bð!.¸8ð !.ð !.ÅtÈAÁwÄwð !.Ø#+ð!.ð !.ñ#ô #ð ð &Ô1°SÒ8Ð8Ý"*Ô"=ð!.¸Xð !.ð !.ÍÈaÉÌð !.Ø#+ð!.ð !.ñ#ô #ð ð &Ô1°SÒ8Ð8Ý"*Ô"Að!.¸(ð !.ð !.ÅdÈ1ÁgÄgð !.Ø#+ð!.ð !.ñ#ô #ð ð &Ô1°SÒ8Ð8Ý"*Ô"AØ O°Ð OÐ O½DÀ¹G¼GÐ OÀXÐ OÐ Oñ#ô #ð ð &Ô1°SÒ8Ð8ð
%Ø-5¯]ª]©_¬_ 
Ø-7¯^ª^¸GÀRÑ-HÔ-H 
Ø#-Ð1TÒ#TÐ#TÝ*2Ô*Eð)^ñ+&ô +&ð %&ð $Uøõ %/µÐ#9ð %ð %ð %Ø $ ð%øøøå"*Ô"9ð!3¨Vð !3ð !3°hð !3ð !3Ý)-¨a©¬ð!3ð !3ñ#ô #ð õ
 #+Ô"9ð!3¨Vð !3ð !3°hð !3ð !3Ý)-¨a©¬ð!3ð !3ñ#ô #ð õ 'Ô9ØX¨ÐXÐX°(ÐXÐXÍtÐTUÉwÌwÐXÐXñô ð øøøøõ  Ô/ð  ñ  ð  ð  œ<Ð+LÒLÐLð BÐAàGð #ð

.Ý),à œyð$�C ¤	Ô 1× 5Ò 5Ð6FÑ GÔ GÑHÔHÐHà!#ñ*ô *˜ð
 $(×#;Ò#;¸NÑ#KÔ#K˜Ø#ð 6Ø-5˜NøøÝ%ð .ð .ð .Ø)-˜˜˜ð.øøøð EFÄIÐU˜œ	Ô)×-Ò-¨kÑ:Ô:Ð@¸bøÐSUð ð &-¨R¨a¨R¤[°'¸"¸#¸#´,˜F�FØ ¥C¨­3¨w©<¬<¸!Ñ+;Ñ$<Ô$<Ñ=�FØ(.Ð%@°Ð%@¸Ð%@Ð%@�Nå"Ô;ð&¸fð &ð &Àxð &ð &Ø.<ð&ð &å  ™GœGð&ð &ð .<ð&ð &ð '5ð	&ð
 $ð&ð &ñô ð ðøøøøõ !ð ð ð Ý ¤™<œ<�DÝ%(¨¡Y¤Y°¢] ]˜$˜qœ'˜'¸�CØŸ+š+ iÐ1DÑEÔE�CØð #Ø#ŸyšyÝ   a¤™\œ\˜NØ"˜eñ$àWÐWÅÀDÁ	Ä	ÈAÂÀ°D¸¸¸´H°HÐSUÐWÑWÔWñXñ ô  ˜˜ð  #˜Ý"Ô1ð& Vð &ð &¨hð &ð &È4ð &Ø#ð&ð &ñô ð ðøøøøðøøøøð  ð $ð $ð $ØÐ'Ý—L’LÐ!:¸AÑ>Ô>Ð>Ø#�O�O�O�O�O�O�O�Oð (Ð'Ð'Ð'Ñ'øøøøõ Ô3ð (ð (ð (Ø˜‘7Ð0Ò0Ð0ØØÐ'ð)Ý&+¨HÔ,<×,@Ò,@ÀÐPTÑ,UÔ,UÑ&VÔ&V˜˜øÝ$ð )ð )ð )ÝŸšØ<Ý  ™GœGñô ð ð ')˜˜˜˜˜˜øøøøð)øøøð *¨A¨s©FÑ2µV´]±_´_ÑD�Ý”
˜;Ñ'Ô'Ð'Ð'Ñ'Øð ð ð à˜‘7Ð0Ò0Ð0ØØ ™V¥v¤}¡¤¸Ñ'<Ñ=�
Ý”
˜:Ñ&Ô&Ð&Ø‘ðøøøõ Ô%Ø>˜Ð>Ð> (Ð>Ð>Ð>ñ
ô 
ð 	
s  Ä5F(Å*FÅ9F(ÆF		Æ	F(ÆF		ÆF(Æ(Y/Æ<AHÈY2ÈY/È)Q*ÉY2ÉEQ*ÎAOÏQ*ÏO)Ï&Q*Ï(O)Ï)BQ*Ñ*Y/Ñ=VÒAS)Ó(VÓ)S8Ó5VÓ7S8Ó8B"VÖY/Ö'CY*Ù*Y/Ù/Y2Ù2^!Ù7Z#Ú^!Ú#^!Û([+Û*^!Û+
\)Û5*\$Ü^!Ü$\)Ü)3^!Ý>^!Þ ^!©Úparamsr_  r‡  rÿ  úIterator[dict]c             #  ól  K  — |r|                      ¦   «         ni }|                     dd¦  «        }|                     dd¦  «        |d<   	 ||d<   |                      d||¬¦  «        }|                     ¦   «         }|sdS |E d{V —† t	          |¦  «        |d         k     rdS |t	          |¦  «        z  }Œk)	zÍGet a paginated list of items.

        Args:
            path: The path of the request URL.
            params: The query parameters.

        Yields:
            The items in the paginated list.
        Úoffsetr   Úlimitrj  Tr-  r†  N)Úcopyr{   r/  rù  rp   )râ  r_  r‡  Úparams_rŠ  r2  r‹   s          re   Ú_get_paginated_listzClient._get_paginated_listˆ  sá   è è € ð $*Ð1�&—+’+‘-”-�-¨rˆØ—’˜X qÑ)Ô)ˆØ"Ÿ;š; w°Ñ4Ô4ˆ�Ñð	!Ø &ˆG�HÑØ×0Ò0ØØØð 1ñ ô ˆHð
 —M’M‘O”OˆEØð Ø�ØÐÐÐÐÐÐÐÝ�5‰zŒz˜G GÔ,Ò,Ð,ð �Ø•c˜%‘j”jÑ ˆFð	!ri   ÚPOSTrö  )rÅ  Úrequest_methodÚdata_keyr�  úLiteral['GET', 'POST']r‘  c             #  óx  K  — |r|                      ¦   «         ni }	 |                      ||dt          |¦  «        i¬¦  «        }|                     ¦   «         }|sdS |                     |¦  «        sdS ||         E d{V —† |                     d¦  «        }|sdS |                     d¦  «        sdS |d         |d<   Œ )aM  Get a cursor paginated list of items.

        Args:
            path: The path of the request URL.
            body: The query body.
            request_method: The HTTP request method.
            data_key: The key in the response body that contains the items.

        Yields:
            The items in the paginated list.
        TrL  ©r>  NÚcursorsrr  Úcursor)rŒ  r/  Ú_dumps_jsonrù  r{   )	râ  r_  rÅ  r�  r‘  r�  r2  Úresponse_bodyr•  s	            re   Ú_get_cursor_paginated_listz!Client._get_cursor_paginated_list¨  sõ   è è € ð& "&Ð-�$—)’)‘+”+�+¨2ˆð	0Ø×0Ò0ØØà�K¨Ñ0Ô0ð ð 1ñ ô ˆHð %ŸMšM™OœOˆMØ ð Ø�Ø ×$Ò$ XÑ.Ô.ð Ø�Ø$ XÔ.Ð.Ð.Ð.Ð.Ð.Ð.Ð.Ø#×'Ò'¨	Ñ2Ô2ˆGØð Ø�Ø—;’;˜vÑ&Ô&ð Ø�Ø '¨¤ˆG�HÑð'	0ri   )ÚdescriptionÚ	data_typeÚdfúpd.DataFramer†  Ú
input_keysúSequence[str]Úoutput_keysrš  r›  úOptional[ls_schemas.DataType]úls_schemas.Datasetc               óº   — t          j        ¦   «         }|                     |d¬¦  «         |                     d¦  «         |                      d|f|||||¬¦  «        S )aà  Upload a dataframe as individual examples to the LangSmith API.

        Args:
            df: The dataframe to upload.
            name: The name of the dataset.
            input_keys: The input keys.
            output_keys: The output keys.
            description: The description of the dataset.
            data_type: The data type of the dataset.

        Returns:
            The uploaded dataset.

        Raises:
            ValueError: If the `csv_file` is not a `str` or `tuple`.

        Example:
            ```python
            from langsmith import Client
            import os
            import pandas as pd

            client = Client()

            df = pd.read_parquet("path/to/your/myfile.parquet")
            input_keys = ["column1", "column2"]  # replace with your input column names
            output_keys = ["output1", "output2"]  # replace with your output column names

            dataset = client.upload_dataframe(
                df=df,
                input_keys=input_keys,
                output_keys=output_keys,
                name="My Parquet Dataset",
                description="Dataset created from a parquet file",
                data_type="kv",  # The default
            )
            ```
        F)r½  r   zdata.csv)rž  r   rš  r†  r›  )ÚioÚBytesIOÚto_csvÚseekÚ
upload_csv)râ  rœ  r†  rž  r   rš  r›  Úcsv_files           re   Úupload_dataframezClient.upload_dataframeÑ  sj   € õ` ”:‘<”<ˆØ
�	Š	�( %ˆ	Ñ(Ô(Ð(Ø�Š�aÑÔÐØ�ŠØ˜Ð"Ø!Ø#Ø#ØØð ñ 
ô 
ð 	
ri   )r†  rš  r›  r©  ú?Union[str, tuple[str, io.BytesIO], tuple[str, io.BytesIO, str]]c               ó¬  — ||dœ}|r||d<   |r||d<   |rt          j        |¦  «        |d<   t          t          j        ¦   «         ¦  «        |d<   t          |t          ¦  «        r[t          |d¦  «        5 }dt          |¦  «        j        |dfi}	|  	                    d	d
||	¬¦  «        }
ddd¦  «         n# 1 swxY w Y   nft          |t          ¦  «        rB|}t          |¦  «        dk    r|d         |d         df}|  	                    d	d
|d|i¬¦  «        }
nt          d¦  «        ‚t          j        |
¦  «         |
                     ¦   «         }d|v rWd|d         v rMt          |t          ¦  «        r|n|d         }|                     d¦  «        d         }t          d|› d�¦  «        ‚t!          j        di |¤| j        |                      ¦   «         dœ¤ŽS )aB  Upload a CSV file to the LangSmith API.

        Args:
            csv_file: The CSV file to upload.

                If a string, it should be the path.

                If a tuple, it should be a tuple containing the filename and a `BytesIO`
                object.
            input_keys: The input keys.
            output_keys: The output keys.
            name: The name of the dataset.
            description: The description of the dataset.
            data_type: The data type of the dataset.

        Returns:
            The uploaded dataset.

        Raises:
            ValueError: If the `csv_file` is not a string or tuple.

        Example:
            ```python
            from langsmith import Client
            import os

            client = Client()

            csv_file = "path/to/your/myfile.csv"
            input_keys = ["column1", "column2"]  # replace with your input column names
            output_keys = ["output1", "output2"]  # replace with your output column names

            dataset = client.upload_csv(
                csv_file=csv_file,
                input_keys=input_keys,
                output_keys=output_keys,
                name="My CSV Dataset",
                description="Dataset created from a CSV file",
                data_type="kv",  # The default
            )
            ```
        )rž  r   r†  rš  r›  rÿ   ÚrbÚfileztext/csvr�  z/datasets/upload)rL  rM  Nr6  r   r[   z"csv_file must be a string or tupleÚdetailzalready existsrm   éÿÿÿÿúDataset z already exists©r  r  rh   )r¤   Úget_enum_valuerW   r[  rð  r  Úopenr   r†  r/  r  rp   rï   r0  rù  r`  r{  ÚDatasetr  Ú_get_optional_tenant_id)râ  r©  rž  r   r†  rš  r›  rL  rì  Úfile_r2  Ú
file_tupleÚresultÚ	file_names                 re   r¨  zClient.upload_csv	  sn  € ðj %Ø&ð
ð 
ˆð ð 	 ØˆD�‰LØð 	.Ø"-ˆD�ÑØð 	CÝ (Ô 7¸	Ñ BÔ BˆD�ÑÝ�œ™œÑ&Ô&ˆˆT‰
Ý�h¥Ñ$Ô$ð 	CÝ�h Ñ%Ô%ð ¨Ø¥$ x¡.¤.Ô"5°q¸*Ð!EÐF�Ø×4Ò4ØØ&ØØð	 5ñ ô �ðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð øõ ˜¥%Ñ(Ô(ð 	CØ!ˆJÝ�8‰}Œ} Ò!Ð!Ø& qœk¨8°A¬;¸
ÐC�
Ø×0Ò0ØØ"ØØ˜zÐ*ð	 1ñ ô ˆHˆHõ ÐAÑBÔBÐBÝÔ+¨HÑ5Ô5Ð5Ø—’‘”ˆà�vÐÐÐ"2°f¸XÔ6FÐ"FÐ"FÝ$.¨x½Ñ$=Ô$=ÐN˜˜À8ÈAÄ;ˆIØ!Ÿš¨Ñ,Ô,¨RÔ0ˆIÝÐB¨	ÐBÐBÐBÑCÔCÐCÝÔ!ð 
ð 
Øð
à”nØ×3Ò3Ñ5Ô5ð
ð 
ð 
ð 
ð 	
s   Á53B4Â4B8Â;B8r»  ú3Union[ls_schemas.Run, dict, ls_schemas.RunLikeDict]rD  rŒ  c                ó\  — t          |d¦  «        r2t          t          |d¦  «        ¦  «        r|                     ¦   «         }nt	          t
          |¦  «        }d|vrt          j        ¦   «         |d<   n8t          |d         t          ¦  «        rt          j
        |d         ¦  «        |d<   d|v rE|d         �=|rt          j        |d         ¦  «        |d<   |                      |d         ¦  «        |d<   d|v rE|d         �=|rt          j        |d         ¦  «        |d<   |                      |d         ¦  «        |d<   d|v r&|d         �|                      |d         ¦  «        |d<   d|v r&|d         �|                      |d         ¦  «        |d<   d|v rlt          |d         t
          ¦  «        rQ|d         }d	|v rE|d	         �=|rt          j        |d	         ¦  «        |d	<   |                      |d	         ¦  «        |d	<   |sF|                     d
¦  «        s1t&          j                             t&          j        j        ¦  «        |d
<   d|v r_|                     d¦  «        dvr|                     dd¦  «         n1|                     d¦  «        r|d                              dd¦  «         |S )aL  Transform the given run object into a dictionary representation.

        Args:
            run: The run object to transform.
            update: Whether the payload is for an "update" event.
            copy: Whether to deepcopy run inputs/outputs.

        Returns:
            The transformed run object as a dictionary.
        Ú
model_dumprÿ   ÚinputsNÚoutputsÚeventsrý  ÚextrarC  r¿  Ú
serializedÚrun_type)rn  rL  Úgraph)r‡  ÚcallableÚgetattrr½  r   r  r[  rð  r  rW   r\  r¤   Údeepish_copyÚ_hide_run_inputsÚ_hide_run_outputsÚ_filter_new_token_eventsÚ_hide_run_errorÚ_hide_run_metadatar{   rÃ  rc   ÚtimezoneÚutcrç  )râ  r»  rD  rŒ  Ú
run_createrÁ  s         re   Ú_run_transformzClient._run_transformn	  sÖ  € õ  �3˜Ñ%Ô%ð 	)­(µ7¸3ÀÑ3MÔ3MÑ*NÔ*Nð 	)Ø"Ÿ~š~Ñ/Ô/ˆJˆJå�d C™œˆJØ�zÐ!Ð!Ý#œz™|œ|ˆJ�tÑÐÝ˜
 4Ô(­#Ñ.Ô.ð 	;Ý#œy¨°DÔ)9Ñ:Ô:ˆJ�tÑØ�zÐ!Ð! j°Ô&:Ð&FØð SÝ'/Ô'<¸ZÈÔ=QÑ'RÔ'R�
˜8Ñ$Ø#'×#8Ò#8¸ÀHÔ9MÑ#NÔ#NˆJ�xÑ Ø˜
Ð"Ð" z°)Ô'<Ð'HØð UÝ(0Ô(=¸jÈÔ>SÑ(TÔ(T�
˜9Ñ%Ø$(×$:Ò$:¸:ÀiÔ;PÑ$QÔ$QˆJ�yÑ!Ø�zÐ!Ð! j°Ô&:Ð&FØ#'×#@Ò#@ÀÈHÔAUÑ#VÔ#VˆJ�xÑ Ø�jÐ Ð  Z°Ô%8Ð%DØ"&×"6Ò"6°zÀ'Ô7JÑ"KÔ"KˆJ�wÑà�jÐ Ð ¥Z°
¸7Ô0CÅTÑ%JÔ%JÐ Ø˜wÔ'ˆEØ˜UÐ"Ð" u¨ZÔ'8Ð'DØð QÝ(0Ô(=¸eÀJÔ>OÑ(PÔ(P�E˜*Ñ%Ø$(×$;Ò$;¸EÀ*Ô<MÑ$NÔ$N��jÑ!Øð 	T˜jŸnšn¨\Ñ:Ô:ð 	TÝ'/Ô'8×'<Ò'<½XÔ=NÔ=RÑ'SÔ'SˆJ�|Ñ$ð ˜:Ð%Ð%Ø�~Š~˜jÑ)Ô)Ð1BÐBÐBà—’˜|¨TÑ2Ô2Ð2Ð2Ø—’ Ñ-Ô-ð <à˜<Ô(×,Ò,¨W°dÑ;Ô;Ð;àÐri   úSequence[dict]c                óÀ  ‡— | j         rd S t          j        ¦   «         }|D ]½}t          t          |                     di ¦  «        ¦  «        }|                     di ¦  «        }i |¥|¥|d<   |                     di ¦  «        Št          j        ¦   «         }ˆfd„|                     ¦   «         D ¦   «         }|r(‰                     |  	                    |¦  «        ¦  «         Œ¾d S )NrÁ  ÚruntimerC  c                ó$   •— i | ]\  }}|‰v¯	||“ŒS rh   rh   )r|   ÚkÚvrC  s      €re   r€   z.Client._insert_runtime_env.<locals>.<dictcomp>³	  s)   ø€ ÐVÐVÐV™d˜a ÀAÈXÐDUÐDU�Q˜ÐDUÐDUÐDUri   )
r  Úls_envÚget_runtime_environmentr   r  Ú
setdefaultÚget_langchain_env_var_metadatar‹   rD  rÌ  )	râ  rö  Úruntime_envrÏ  Ú	run_extrarÓ  Úlangchain_metadataÚaddedrC  s	           @re   Ú_insert_runtime_envzClient._insert_runtime_env§	  sú   ø€ ØÔ)ð 	ØˆFÝÔ4Ñ6Ô6ˆØð 
	@ð 
	@ˆJÝ�T :×#8Ò#8¸À"Ñ#EÔ#EÑFÔFˆIà%×0Ò0°¸BÑ?Ô?ˆGØ#= kÐ#=°WÐ#=ˆI�iÑ à&×1Ò1°*¸bÑAÔAˆHÝ!'Ô!FÑ!HÔ!HÐØVÐVÐVÐVÐ&8×&>Ò&>Ñ&@Ô&@ÐVÑVÔVˆEØð @Ø—’ × 7Ò 7¸Ñ >Ô >Ñ?Ô?Ð?øð
	@ð 
	@ri   c                óL   — | j         €dS t          j        ¦   «         | j         k     S )NT)r  rj  r´  s    re   Ú_should_samplezClient._should_sample·	  s$   € ØÔ#Ð+Ø�4ÝŒ}‰Œ Ô!9Ò9Ð9ri   ©Úpatchú=Iterable[Union[dict, ls_schemas.Run, ls_schemas.RunLikeDict]]rã  r  c               óJ  — | j         €t          |¦  «        S t          fd
d„}|rkg }|D ]d}t           ||d¦  «        ¦  «        }|| j        vr|                     |¦  «         Œ: ||d	¦  «        |k    r| j                             |¦  «         Œe|S g }|D ]�} ||dd ¦  «        p ||d	¦  «        }|| j        v rŒ% ||d	¦  «        |k    rE|                      ¦   «         r|                     |¦  «         Œ_| j                             |¦  «         Œz|                     |¦  «         Œ�|S )Nr»  r   r}   rW   ÚdefaultrX   c                óš   — 	 | |         S # t           t          f$ r/ |t          u rt          | |¦  «        cY S t          | ||¦  «        cY S w xY wry   )rr  rð   Ú_UNSETrÆ  )r»  r}   ræ  s      re   Ú_valz)Client._filter_for_sampling.<locals>._valÅ	  si   € ð2Ø˜3”x�øÝ�iÐ(ð 2ð 2ð 2Ø�fÐ$Ð$Ý" 3¨Ñ,Ô,Ð,Ð,Ð,Ý˜s C¨Ñ1Ô1Ð1Ð1Ð1ð2øøøs   ‚
 Š*A
¶A
Á	A
Útrace_idrÿ   )r»  r   r}   rW   ræ  r   rX   r   )	r  r  rè  ra  r  ÚappendÚremoverá  rô  )râ  rö  rã  ré  Úsampledr»  rê  s          re   Ú_filter_for_samplingzClient._filter_for_sampling¼	  s�  € ð Ô#Ð+Ý˜‘:”:Ðå4:ð 	2ð 	2ð 	2ð 	2ð 	2ð ð 	ØˆGØð ?ð ?�Ý# D D¨¨jÑ$9Ô$9Ñ:Ô:�Ø 4Ô#<Ð<Ð<Ø—N’N 3Ñ'Ô'Ð'Ð'Ø�T˜#˜t‘_”_¨Ò0Ð0ØÔ-×4Ò4°XÑ>Ô>Ð>øØˆNàˆGØð (ð (�Ø˜4  Z°Ñ6Ô6ÐI¸$¸$¸sÀD¹/¼/�ð ˜tÔ8Ð8Ð8Øð �4˜˜T‘?”? hÒ.Ð.Ø×*Ò*Ñ,Ô,ð @ØŸš sÑ+Ô+Ð+Ð+àÔ1×5Ò5°hÑ?Ô?Ð?Ð?ð —N’N 3Ñ'Ô'Ð'Ð'ØˆNri   rœ   c                ó   — | j         S )zPer-client tracing mode.)r0  r´  s    re   r™   zClient.tracing_modeê	  r(  ri   Úitemr*   c                óª   — | j         €J ‚	 | j                              |¦  «         dS # t          $ r! t          d| j         j        › d�¦  «         Y dS w xY w)z3Put an item on the tracing queue, dropping if full.Nztracing queue full (maxsize=r  )r  Ú
put_nowaitr   rf   rè   )râ  rð  s     re   Ú_put_tracing_queuezClient._put_tracing_queueï	  sƒ   € àÔ!Ð-Ð-Ð-ð	ØÔ×)Ò)¨$Ñ/Ô/Ð/Ð/Ð/øÝð 	ð 	ð 	ÝØL¨tÔ/AÔ/IÐLÐLÐLñô ð ð ð ð ð	øøøs   ‹' §'AÁA)Úproject_nameÚrevision_idr   r’  rk   r¾  ru   rÃ  Ú
RUN_TYPE_Trô  rõ  r   c               ób  — |	                      dd¦  «        }
|	                      dd¦  «        }|	                      dd¦  «        }|	                      dd¦  «        }|p&|	                      dt          j        ¦   «         ¦  «        }i |	¥||||dœ¥}|                      |g¦  «        sdS |�||d         d	         d
<   |                      |d¬¦  «        }|                      |g¦  «         t          |                     d¦  «        |¦  «         | j        r„|	                     d¦  «        so| j	        5  | j
                             d||||
|||dœf¦  «         |                      ¦   «         r|                      ¦   «          	 ddd¦  «         dS # 1 swxY w Y   dS |                      ||||
|||¬¦  «         dS )a0  Persist a run to the LangSmith API.

        Args:
            name (str): The name of the run.
            inputs (Dict[str, Any]): The input values for the run.
            run_type (str): The type of the run, such as tool, chain, llm, retriever,
                embedding, prompt, or parser.
            project_name (Optional[str]): The project name of the run.
            revision_id (Optional[Union[UUID, str]]): The revision ID of the run.
            api_key (Optional[str]): The API key to use for this specific run.
            api_url (Optional[str]): The API URL to use for this specific run.
            service_key (Optional[str]): The service JWT key for service-to-service auth.
            tenant_id (Optional[str]): The tenant ID for multi-tenant requests.
            authorization (Optional[str]): The Authorization header value.
            cookie (Optional[str]): The Cookie header value.
            **kwargs (Any): Additional keyword arguments.

        Returns:
            None

        Raises:
            LangSmithUserError: If the API key is not provided when using the hosted service.

        Example:
            ```python
            from langsmith import Client
            import datetime
            from uuid import uuid4

            client = Client()

            run_id = uuid4()
            client.create_run(
                id=run_id,
                project_name=project_name,
                name="test_run",
                run_type="llm",
                inputs={"prompt": "hello world"},
                outputs={"generation": "hi there"},
                start_time=datetime.datetime.now(datetime.timezone.utc),
                end_time=datetime.datetime.now(datetime.timezone.utc),
                hide_inputs=True,
                hide_outputs=True,
            )
            ```
        Úservice_keyNr»  ÚauthorizationÚcookieÚsession_name)rû  r†  r¾  rÃ  rÁ  rC  rõ  F©rŒ  rþ  Úis_run_ops_buffer_flushÚpost©rk   r’  rø  r»  rù  rú  ©r’  rk   rø  r»  rù  rú  )rç  r¤   Úget_tracer_projectrî  rÐ  rß  r  r{   r  r%  r$  rë  Ú_should_flush_run_ops_bufferÚ_flush_run_ops_bufferÚ_create_run)râ  r†  r¾  rÃ  rô  rõ  r   r’  rk   r�   rø  r»  rù  rú  rÏ  s                  re   Ú
create_runzClient.create_runù	  sh  € ðv #)§*¢*¨]¸DÑ"AÔ"AˆØ &§
¢
¨;¸Ñ =Ô =ˆ	Ø$*§J¢J¨ÀÑ$EÔ$EˆØ#ŸZšZ¨°$Ñ7Ô7ˆØ#ð 
 v§z¢zØåÔ'Ñ)Ô)ñ(
ô (
ˆð

Øð
à(ØØØ ð
ð 
ð 
ˆ
ð ×(Ò(¨*¨Ñ6Ô6ð 	ØˆFØÐ"Ø=HˆJ�wÔ 
Ô+¨MÑ:Ø×(Ò(¨¸%Ð(Ñ@Ô@ˆ
Ø× Ò  * Ñ.Ô.Ð.Ý&Ø�NŠN˜=Ñ)Ô)Ð+Gñ	
ô 	
ð 	
ð
 Ô)ð 	°&·*²*Ð=VÑ2WÔ2Wð 	ØÔ*ð ð ØÔ$×+Ò+àØ"à'.Ø'.Ø+6Ø)2Ø-:Ø&,ðð ðñô ð ð ×4Ò4Ñ6Ô6ð 1Ø×.Ò.Ñ0Ô0Ð0Øð%ð ð ñ ô ð ð ð ð ð ð ð øøøð ð ð ð ð ð ð( ×ÒØØØØ'Ø#Ø+Øð ñ ô ð ð ð s   Ä+AFÆF
ÆF
r   rÏ  rø  r»  rù  rú  c               óÜ  — |                      d¦  «        ��9|                      d¦  «        ��#| j        �| j                             |¦  «         d S | j        ��|�€|�€ |€þ|€ü|€ú|€ø| j        €t          d¦  «        ‚t          d|¦  «        }t          |¦  «        \  }	}
t           	                    dd|	j
        ¦  «         | j        j        5  t          |	| j        t          ¦  «        }|r.| j        xj        dz  c_        | j                             ¦   «          d d d ¦  «         n# 1 swxY w Y   t!          t#          |
                     ¦   «         ¦  «        ¦  «         d S | j        �Ít          d|¦  «        }t           	                    dd|j        |j        ¦  «         | j        �]|                      t1          |d         ||||||||                      | j                             ¦   «         ¦  «        ¬	¦	  «	        ¦  «         d S |                      t1          |d         |||||||¬
¦  «        ¦  «         d S |                      |||||||¬
¦  «         d S |                      |||||||¬
¦  «         d S )Nrê  Údotted_orderú@Run compression is enabled but threading event is not configuredrþ  rR  ú5Adding compressed multipart to queue with context: %sr[   ú/Adding to tracing queue: trace_id=%s, run_id=%s©r’  rk   rø  r»  rù  rú  Úotel_contextr   )r{   r   r  r!  r"  rï   rA   rC   ra   ÚlogÚcontextÚlockr?   r1   Útrace_countr  Ú_close_filesr  r  r  rê  rÿ   r&  ró  r*   r(  r'  Úget_current_spanÚ_create_run_non_batch)râ  rÏ  r’  rk   rø  r»  rù  rú  Úserialized_opÚmultipart_formÚopened_filesÚenqueueds               re   r  zClient._create_runn
  sW  € ð �NŠN˜:Ñ&Ô&Ñ2Ø—’˜~Ñ.Ô.Ñ:àÔ Ð,ØÔ!×,Ò,¨ZÑ8Ô8Ð8Ð8Ð8àÔ&Ñ2Ø‘OØ‘OØÐ'ØÐ%Ø!Ð)Ø�NàÔ-Ð5Ý$ØZñô ð õ !3°6¸:Ñ FÔ F�õ LØ!ñô ñØ"Ø õ —
’
ØØKØ"Ô*ñô ð ð
 Ô+Ô0ð 9ð 9ÝCØ&ØÔ.Ý!ñ ô  �Hð
  ð 9ØÔ.Ð:Ô:¸aÑ?Ð:Ô:ØÔ2×6Ò6Ñ8Ô8Ð8ð9ð 9ð 9ñ 9ô 9ð 9ð 9ð 9ð 9ð 9ð 9øøøð 9ð 9ð 9ð 9õ �T ,×"5Ò"5Ñ"7Ô"7Ñ8Ô8Ñ9Ô9Ð9Ð9Ð9ØÔ#Ð/Ý 2°6¸:Ñ FÔ F�Ý—
’
ØØEØ!Ô*Ø!Ô$ñ	ô ð ð Ô%Ð1Ø×+Ò+Ý(Ø& ~Ô6Ø)Ø$+Ø$+Ø(3Ø&/Ø*7Ø#)Ø)-×)BÒ)BØ $Ô 0× AÒ AÑ CÔ Cñ*ô *ðñ ô ñô ð ð ð ð  ×+Ò+Ý(Ø& ~Ô6Ø)Ø$+Ø$+Ø(3Ø&/Ø*7Ø#)ð	ñ 	ô 	ñô ð ð ð ð ×*Ò*ØØ#Ø#Ø +Ø'Ø"/Ø!ð +ñ ô ð ð ð ð ×&Ò&ØØØØ'Ø#Ø+Øð 'ñ ô ð ð ð s   ÃAD#Ä#D'Ä*D'c          
     óV  — g }t          |||||g¦  «        }	|	rŽ|p| j        }
t          | j        |||||| j        ¬¦  «        }	 |                      d|
› d�t          |¦  «        |dœt          j        f¬¦  «         nÊ# t          $ r}| 
                    |¦  «         Y d }~n¦d }~ww xY w| j                             ¦   «         D ]„\  }}	 t          | j        |d d d d d ¬¦  «        }|                      d|› d�t          |¦  «        |dœt          j        f¬¦  «         ŒY# t          $ r}| 
                    |¦  «         Y d }~Œ}d }~ww xY w|rbt          |¦  «        dk    r,t          j        |¬¦  «        }|                      |¦  «         |‚|                      |d         ¦  «         |d         ‚d S )	N©r’  rø  r»  rù  rú  Úfallback_api_keyr�  ú/runs©rL  r�   )r>  rA  r[   )rh  r   )r  rk   Ú_apply_auth_overridesr  r’  r/  r—  r¤   rq  r@  rë  r®  r‹   rp   ÚLangSmithExceptionGroupr  )râ  rÏ  r’  rk   rø  r»  rù  rú  ÚerrorsÚuse_overrideÚtarget_api_urlr�   rM  Úwrite_api_urlÚwrite_api_keyÚexception_groups                   re   r  zClient._create_run_non_batchà
  sY  € ð ˆå˜G W¨k¸=È&ÐQÑRÔRˆØð .	%Ø$Ð4¨¬ˆNÝ+Ø”ØØ'Ø#Ø+ØØ!%¤ðñ ô ˆGð!Ø×)Ò)ØØ%Ð,Ð,Ð,å +¨JÑ 7Ô 7Ø#*ð$ð $õ  (Ô>Ð@ð *ñ ô ð ð øõ ð !ð !ð !Ø—’˜aÑ Ô Ð Ð Ð Ð Ð Ð øøøøð!øøøð 15Ô0D×0JÒ0JÑ0LÔ0Lð %ð %Ñ,�˜}ð%Ý3ØœØ -Ø$(Ø"&Ø&*Ø#Ø)-ðñ ô �Gð ×-Ò-ØØ(Ð/Ð/Ð/å$/°
Ñ$;Ô$;Ø'.ð(ð (õ $,Ô#BÐ"Dð .ñ ô ð ð øõ !ð %ð %ð %Ø—M’M !Ñ$Ô$Ð$Ð$Ð$Ð$Ð$Ð$øøøøð%øøøàð 	 å�6‰{Œ{˜QŠˆÝ"*Ô"BÈfÐ"UÑ"UÔ"U�Ø×3Ò3°OÑDÔDÐDØ%Ð%à×3Ò3°F¸1´IÑ>Ô>Ð>Ø˜Q”i�ð	 ð 	 s1   Á7A; Á;
B$ÂBÂB$ÃADÄ
EÄ#D=Ä=Ec                óÒ   — | j         du ri S | j        r6t          j        t	          |¦  «        ¦  «        }|                      |¦  «        S | j         du r|S |                       |¦  «        S ©NTF)r  r  r&   Úloadsr—  )râ  r¾  Újson_inputss      re   rÈ  zClient._hide_run_inputs'  sr   € ØÔ Ð$Ð$ØˆIØÔð 	1Ý!œ-­°FÑ(;Ô(;Ñ<Ô<ˆKØ×#Ò# KÑ0Ô0Ð0ØÔ Ð%Ð%ØˆMØ× Ò  Ñ(Ô(Ð(ri   r¿  c                óÒ   — | j         du ri S | j        r6t          j        t	          |¦  «        ¦  «        }|                      |¦  «        S | j         du r|S |                       |¦  «        S r&  )r  r  r&   r'  r—  )râ  r¿  Újson_outputss      re   rÉ  zClient._hide_run_outputs1  sr   € ØÔ Ð%Ð%ØˆIØÔð 	2Ý"œ=­°WÑ)=Ô)=Ñ>Ô>ˆLØ×#Ò# LÑ1Ô1Ð1ØÔ Ð&Ð&ØˆNØ×!Ò! 'Ñ*Ô*Ð*ri   c                óŒ   — | j         r|€|S |                       d|i¦  «        }t          |t          ¦  «        rd|v r|d         S |S )a<  Apply the configured anonymizer to a run's error string.

        Unlike inputs/outputs, ``error`` is a plain string (``repr(exc)`` plus a
        formatted traceback, see ``run_helpers._format_error_with_exceptions_to_handle``)
        that can capture credentials the user never explicitly logged -- e.g. an
        HTTP client exception whose request-object repr includes an
        ``Authorization`` header. Route it through the same anonymizer as
        inputs/outputs so secrets are scrubbed client-side before upload.

        The value is wrapped as ``{"error": ...}`` so that both
        ``create_secret_anonymizer`` and a user-supplied anonymizer matching the
        documented ``Callable[[dict], dict]`` signature receive a dict (a bare
        string would break a dict-typed anonymizer), then unwrapped.
        Nrý  )r  r  r  )râ  rý  Úscrubbeds      re   rË  zClient._hide_run_error;  s\   € ð Ôð 	 5 =ØˆLØ×#Ò# W¨eÐ$4Ñ5Ô5ˆÝ�h¥Ñ%Ô%ð 	%¨'°XÐ*=Ð*=Ø˜GÔ$Ð$Øˆri   rC  c                óÒ   — | j         du ri S | j        r6t          j        t	          |¦  «        ¦  «        }|                      |¦  «        S | j         du r|S |                       |¦  «        S r&  )r  r  r&   r'  r—  )râ  rC  Újson_metadatas      re   rÌ  zClient._hide_run_metadataQ  sr   € ØÔ $Ð&Ð&ØˆIØÔð 	3Ý#œM­+°hÑ*?Ô*?Ñ@Ô@ˆMØ×#Ò# MÑ2Ô2Ð2ØÔ %Ð'Ð'ØˆOØ×"Ò" 8Ñ,Ô,Ð,ri   rÀ  úOptional[Sequence[dict]]úOptional[list[dict]]c                ó"   — | s| S d„ | D ¦   «         S )a  Filter content from new_token events.

        This prevents streaming LLM output from being uploaded via events.

        Args:
            events: The events to filter.

        Returns:
            The filtered events with kwargs removed from new_token events.
        c                ó€   — g | ];}|                      d ¦  «        dk    rd„ |                     ¦   «         D ¦   «         n|‘Œ<S )r†  Ú	new_tokenc                ó&   — i | ]\  }}|d k    ¯||“ŒS )r�   rh   ©r|   rÕ  rÖ  s      re   r€   z>Client._filter_new_token_events.<locals>.<listcomp>.<dictcomp>l  s#   € Ð=Ð=Ð=‘d�a˜¨q°Hª}¨}ˆQ�¨}¨}¨}ri   )r{   r‹   )r|   Úevents     re   rZ  z3Client._filter_new_token_events.<locals>.<listcomp>k  s_   € ð 
ð 
ð 
ð ð �yŠy˜Ñ Ô  KÒ/Ð/ð >Ð=˜eŸkšk™mœmÐ=Ñ=Ô=Ð=àð
ð 
ð 
ri   rh   )rÀ  s    re   rÊ  zClient._filter_new_token_events[  s4   € ð ð 	ØˆMð
ð 
ð  ð	
ñ 
ô 
ð 	
ri   c                óÈ   — | j         sdS | j        �t          | j         ¦  «        | j        k    rdS | j        �+t	          j        ¦   «         | j        z
  }|| j        dz  k    rdS dS )zDCheck if the run ops buffer should be flushed based on size or time.FNTrZ  )r$  r  rp   r  r^   r  )râ  Útime_since_last_flushs     re   r  z#Client._should_flush_run_ops_bufferr  sw   € àÔ#ð 	Ø�5ð Ô%Ð1Ý�DÔ(Ñ)Ô)¨TÔ-FÒFÐFà�4ð Ô*Ð6Ý$(¤I¡K¤K°$Ô2VÑ$VÐ!Ø$¨Ô)HÈ4Ñ)OÒPÐPØ�tàˆuri   c                ób  — | j         sdS t          | j         ¦  «        }| j                              ¦   «          t          j        ¦   «         | _        ddlm}m} 	 |                     || |¦  «        }| j	        �| j	         
                    |¦  «         dS dS # t          $ r  || |¦  «         Y dS w xY w)z8Process and flush run ops buffer in a background thread.Nr   )ÚLANGSMITH_CLIENT_THREAD_POOLÚ_process_buffered_run_ops_batch)r$  r  Úclearr^   r  Ú&langsmith._internal._background_threadr:  r;  Úsubmitr#  rô  ÚRuntimeError)râ  Úbatch_to_processr:  r;  Úfutures        re   r  zClient._flush_run_ops_buffer†  sý   € àÔ#ð 	ØˆFõ   Ô 4Ñ5Ô5ÐØÔ×"Ò"Ñ$Ô$Ð$Ý/3¬y©{¬{ˆÔ,ð	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð
		DØ1×8Ò8Ø/°Ð7Gñô ˆFð Œ}Ð(Ø”×!Ò! &Ñ)Ô)Ð)Ð)Ð)ð )Ð(øåð 	Dð 	Dð 	Dà+Ð+¨DÐ2BÑCÔCÐCÐCÐCÐCð	Døøøs   Á8B ÂB.Â-B.rÿ  Úopsúlist[SerializedRunOperation]c               óô  — g g dœ}|D �]Ä}	t          |	t          ¦  «        �rRt          j        |	j        ¦  «        }
|	j        rt          j        |	j        ¦  «        |
d<   |	j        rt          j        |	j        ¦  «        |
d<   |	j        rt          j        |	j        ¦  «        |
d<   |	j	        rt          j        |	j	        ¦  «        |
d<   |	j
        rt          j        |	j
        ¦  «        |
d<   |	j        rt          j        |	j        ¦  «        |
d<   |	j        rt                               d¦  «         ||	j                                      d	|	j        › d
|	j        › �t          j        |
¦  «        f¦  «         �Œkt          |	t(          ¦  «        rt                               d¦  «         �Œœt           
                    dt+          |	¦  «        ¦  «         �ŒÆ| j        }| j        p"|j        pi                      d¦  «        pt4          }t7          j        t:          ¦  «        }t7          j        t:          ¦  «        }d}t=          t:          t>          d                  ddg¦  «        D �]4}t7          j         ||         ¦  «        }|�r|dk    rš|tC          |d         d         ¦  «        z   |k    rx|  "                    t          j        |¦  «        d|› dd #                    ||         ¦  «        › �||||||¬¦  «         d}| $                    ¦   «          | $                    ¦   «          | %                    ¦   «         \  }}|tC          |¦  «        z  }||                              t          j        |¦  «        ¦  «         ||                              |¦  «         |�°�Œ6|red #                    d„ | &                    ¦   «         D ¦   «         ¦  «        }|  "                    t          j        |¦  «        d|z   ||||||¬¦  «         d S d S )N)rþ  rã  r¾  r¿  rÀ  rÁ  rý  rÂ  zBAttachments are not supported when use_multipart_endpoint is Falseztrace=z,id=z;Feedback operations are not supported in non-multipart modez&Unknown item type in tracing queue: %sr9  r   rþ  rã  r[   rV  r.  ú; )rC  rk   r’  rø  r»  rù  rú  c              3  óP   K  — | ]!\  }}|› d d                      |¦  «        › �V — Œ"dS )r.  rE  N)r¨   r5  s      re   r	  z/Client._batch_ingest_run_ops.<locals>.<genexpr>ö  s>   è è € ÐWÐW¹4¸1¸a 1Ð 6Ð 6¨¯	ª	°!©¬Ð 6Ð 6ÐWÐWÐWÐWÐWÐWri   )'r  r=   r&   r'  Ú_noner¾  ÚFragmentr¿  rÀ  rÁ  rý  rÂ  rþ  ra   rb   Ú	operationrë  rê  rÿ   rú  r<   r  rž  r)  r:  r{   r2   ÚcollectionsÚdefaultdictr  r   r   Údequerp   Ú_post_batch_ingest_runsr¨   r<  Úpopleftr‹   )râ  rB  rk   r’  rø  r»  rù  rú  Úids_and_partial_bodyÚopÚ	curr_dictrž  r9  Úbody_chunksÚcontext_idsÚ	body_sizer}   Ú
body_dequeÚcurr_idÚ	curr_bodyr  s                        re   Ú_batch_ingest_run_opszClient._batch_ingest_run_ops¡  s>  € ð Øð
ð 
ð 	ð ð 	Qñ 	QˆBÝ˜"Õ4Ñ5Ô5ñ QÝ#œM¨"¬(Ñ3Ô3�	Ø”9ð FÝ*1Ô*:¸2¼9Ñ*EÔ*E�I˜hÑ'Ø”:ð HÝ+2Ô+;¸B¼JÑ+GÔ+G�I˜iÑ(Ø”9ð FÝ*1Ô*:¸2¼9Ñ*EÔ*E�I˜hÑ'Ø”8ð DÝ)0Ô)9¸"¼(Ñ)CÔ)C�I˜gÑ&Ø”8ð DÝ)0Ô)9¸"¼(Ñ)CÔ)C�I˜gÑ&Ø”=ð NÝ.5Ô.>¸r¼}Ñ.MÔ.M�I˜lÑ+Ø”>ð Ý—N’Nð#ñô ð ð % R¤\Ô2×9Ò9Ø6˜bœkÐ6Ð6¨r¬uÐ6Ð6½¼ÀiÑ8PÔ8PÐQñô ð ñ õ ˜BÕ ;Ñ<Ô<ð QÝ—’ØQñô ð ñ õ —’ÐEÅtÈBÁxÄxÑPÔPÐPÑPð ŒyˆàÔ&ð !ØÔ(Ð.¨B×3Ò3Ð4FÑGÔGð!å ð 	õ ;FÔ:QÕRVÑ:WÔ:WˆÝ:EÔ:QÕRVÑ:WÔ:WˆØˆ	Ý��W _Ô5Ô6¸ÀÐ8IÑJÔJð 	1ñ 	1ˆCÝ$Ô*Ð+?ÀÔ+DÑEÔEˆJØñ 1à ’M�MØ!¥C¨
°1¬°aÔ(8Ñ$9Ô$9Ñ9Ð<LÒLÐLà×0Ò0Ýœ kÑ2Ô2Ø!J cÐ!JÐ!J¨T¯YªY°{À3Ô7GÑ-HÔ-HÐ!JÐ!JØ 'Ø 'Ø$/Ø"+Ø&3Ø%ð 1ñ 	ô 	ð 	ð !"�IØ×%Ò%Ñ'Ô'Ð'Ø×%Ò%Ñ'Ô'Ð'Ø%/×%7Ò%7Ñ%9Ô%9Ñ"�˜Ø�S ™^œ^Ñ+�	Ø˜CÔ ×'Ò'­Ô(8¸Ñ(CÔ(CÑDÔDÐDØ˜CÔ ×'Ò'¨Ñ0Ô0Ð0ð+ ñ 1ùð, ð 	Ø—i’iÐWÐWÀ;×CTÒCTÑCVÔCVÐWÑWÔWÑWÔWˆGØ×(Ò(Ý”˜kÑ*Ô*Ø ™ØØØ'Ø#Ø+Øð )ñ 	ô 	ð 	ð 	ð 	ð	ð 	ri   ÚcreateúGOptional[Sequence[Union[ls_schemas.Run, ls_schemas.RunLikeDict, dict]]]c                ó’  ‡ — |s|sdS ‰                       |pt          ¦  «        }‰                       |pt          d¬¦  «        }|s|sdS ˆ fd„|D ¦   «         }ˆ fd„|D ¦   «         }|D ]@}|                     d¦  «        r|                     d¦  «        st          j        d¦  «        ‚ŒA|D ]@}|                     d¦  «        r|                     d¦  «        st          j        d¦  «        ‚ŒA‰ j        rH|r"t          ‰                      |¦  «        ¦  «        }|r"t          ‰                      |¦  «        ¦  «        }‰                      ||z   ¦  «         t          t          t                   t          t          t          j        d	„ |D ¦   «         d
„ |D ¦   «         ¦  «        ¦  «        ¦  «        ¦  «        }‰                      |¦  «         dS )aÈ  Batch ingest/upsert multiple runs in the Langsmith system.

        Args:
            create (Optional[Sequence[Union[Run, RunLikeDict]]]):
                A sequence of `Run` objects or equivalent dictionaries representing
                runs to be created / posted.
            update (Optional[Sequence[Union[Run, RunLikeDict]]]):
                A sequence of `Run` objects or equivalent dictionaries representing
                runs that have already been created and should be updated / patched.

        Raises:
            LangsmithAPIError: If there is an error in the API request.

        Returns:
            None

        !!! note

            The run objects MUST contain the `dotted_order` and `trace_id` fields
            to be accepted by the API.

        Example:
            ```python
            from langsmith import Client
            import datetime
            from uuid import uuid4

            client = Client()
            _session = "__test_batch_ingest_runs"
            trace_id = uuid4()
            trace_id_2 = uuid4()
            run_id_2 = uuid4()
            current_time = datetime.datetime.now(datetime.timezone.utc).strftime(
                "%Y%m%dT%H%M%S%fZ"
            )
            later_time = (
                datetime.datetime.now(datetime.timezone.utc) + timedelta(seconds=1)
            ).strftime("%Y%m%dT%H%M%S%fZ")

            runs_to_create = [
                {
                    "id": str(trace_id),
                    "session_name": _session,
                    "name": "run 1",
                    "run_type": "chain",
                    "dotted_order": f"{current_time}{str(trace_id)}",
                    "trace_id": str(trace_id),
                    "inputs": {"input1": 1, "input2": 2},
                    "outputs": {"output1": 3, "output2": 4},
                },
                {
                    "id": str(trace_id_2),
                    "session_name": _session,
                    "name": "run 3",
                    "run_type": "chain",
                    "dotted_order": f"{current_time}{str(trace_id_2)}",
                    "trace_id": str(trace_id_2),
                    "inputs": {"input1": 1, "input2": 2},
                    "error": "error",
                },
                {
                    "id": str(run_id_2),
                    "session_name": _session,
                    "name": "run 2",
                    "run_type": "chain",
                    "dotted_order": f"{current_time}{str(trace_id)}."
                    f"{later_time}{str(run_id_2)}",
                    "trace_id": str(trace_id),
                    "parent_run_id": str(trace_id),
                    "inputs": {"input1": 5, "input2": 6},
                },
            ]
            runs_to_update = [
                {
                    "id": str(run_id_2),
                    "dotted_order": f"{current_time}{str(trace_id)}."
                    f"{later_time}{str(run_id_2)}",
                    "trace_id": str(trace_id),
                    "parent_run_id": str(trace_id),
                    "outputs": {"output1": 4, "output2": 5},
                },
            ]

            client.batch_ingest_runs(create=runs_to_create, update=runs_to_update)
            ```
        NTrâ  c                ó>   •— g | ]}‰                      |d ¬¦  «        ‘ŒS )Frü  ©rÐ  ©r|   r»  râ  s     €re   rZ  z,Client.batch_ingest_runs.<locals>.<listcomp>i  s,   ø€ ÐOÐOÐOÀ˜×+Ò+¨C°eÐ+Ñ<Ô<ÐOÐOÐOri   c                ó@   •— g | ]}‰                      |d d¬¦  «        ‘ŒS )TF)rD  rŒ  r]  r^  s     €re   rZ  z,Client.batch_ingest_runs.<locals>.<listcomp>j  s;   ø€ ð 
ð 
ð 
ØBEˆD×Ò ¨D°uÐÑ=Ô=ð
ð 
ð 
ri   rê  r  z:Batch ingest requires trace_id and dotted_order to be set.c              3  ó6   K  — | ]}t          d |¦  «        V — ŒdS ©rþ  N©rA   ©r|   r»  s     re   r	  z+Client.batch_ingest_runs.<locals>.<genexpr>‡  s-   è è € ÐQÐQ¸SÕ+¨F°CÑ8Ô8ÐQÐQÐQÐQÐQÐQri   c              3  ó6   K  — | ]}t          d |¦  «        V — ŒdS ©rã  Nrb  rc  s     re   r	  z+Client.batch_ingest_runs.<locals>.<genexpr>ˆ  s-   è è € ÐRÐR¸cÕ+¨G°SÑ9Ô9ÐRÐRÐRÐRÐRÐRri   )rî  rä   r{   r¤   r§   r  r  rß  r   r=   r>   r  rm  rX  )râ  rY  rD  Úcreate_dictsÚupdate_dictsr»  Úserialized_opss   `      re   Úbatch_ingest_runszClient.batch_ingest_runs  s>  ø€ ð~ ð 	˜fð 	ØˆFà×*Ò*¨6Ð+>µYÑ?Ô?ˆØ×*Ò*¨6Ð+>µYÀdÐ*ÑKÔKˆØð 	˜fð 	ØˆFàOÐOÐOÐOÈÐOÑOÔOˆð
ð 
ð 
ð 
ØIOð
ñ 
ô 
ˆð  ð 	ð 	ˆCØ—7’7˜:Ñ&Ô&ð ¨c¯gªg°nÑ.EÔ.Eð ÝÔ1ØPñô ð ðð  ð 	ð 	ˆCØ—7’7˜:Ñ&Ô&ð ¨c¯gªg°nÑ.EÔ.Eð ÝÔ1ØPñô ð ðð Ô)ð 	RØð RÝ# D×$BÒ$BÀ<Ñ$PÔ$PÑQÔQ�Øð RÝ# D×$BÒ$BÀ<Ñ$PÔ$PÑQÔQ�à× Ò  °Ñ!<Ñ=Ô=Ð=õ ÝÕ'Ô(Ý/ÝÝ”OØQÐQÀLÐQÑQÔQØRÐRÀ\ÐRÑRÔRñô ñô ñô ñ

ô 

ˆð 	×"Ò" >Ñ2Ô2Ð2Ð2Ð2ri   c          
     óä  ‡ — t          |||||g¦  «        }	|	r/|p‰ j        }
|
t          i ‰ j        ¥|||||‰ j        ¬¦  «        fg}n%ˆ fd„‰ j                             ¦   «         D ¦   «         }|D �] \  }
}	 ‰                      d|
› d�||dœt          j	        fd|¬¦  «         Œ4# t          $ rÁ}	 t          j        t          |¦  «        |¦  «        }d                     |¦  «                             ¦   «         }t                                d	|› �¦  «         n:# t          $ r- t                                d	t%          |¦  «        › �¦  «         Y nw xY w‰                      |¦  «         Y d }~Œúd }~ww xY wd S )
Nr  c                óT   •— g | ]$\  }}|t          i ‰j        ¥|d d d d d ¬¦  «        f‘Œ%S ©Nr  ©r  r  ©r|   r!  Útarget_api_keyrâ  s      €re   rZ  z2Client._post_batch_ingest_runs.<locals>.<listcomp>°  ób   ø€ ð ð ð ñ 3�N Nð #Ý)Ø)˜4œ=Ð)Ø .Ø$(Ø"&Ø&*Ø#Ø)-ðñ ô ððð ð ri   r�  z/runs/batchr  r“   )r>  rA  r?  rC  r‹  zFailed to batch ingest runs: )r  rk   r  r  r’  r®  r‹   r/  r¤   rq  r@  Ú	tracebackÚformat_exception_onlyr  r¨   rn   ra   rb   r’  r  )râ  rÅ  rC  rk   r’  rø  r»  rù  rú  r   r!  Ú	endpointsr�   rM  Úexc_desc_linesÚexc_descs   `               re   rM  zClient._post_batch_ingest_runs�  s  ø€ õ ˜G W¨k¸=È&ÐQÑRÔRˆØð 	Ø$Ð4¨¬ˆNð #Ý)Ø)˜4œ=Ð)Ø 'Ø$/Ø"+Ø&3Ø%Ø)-¬ðñ ô ððˆIˆIðð ð ð ð 7;Ô6J×6PÒ6PÑ6RÔ6Rðñ ô ˆIð  (1ð 	7ñ 	7Ñ#ˆN˜Gð7Ø×)Ò)ØØ%Ð2Ð2Ð2à $Ø#*ð$ð $õ  (Ô>Ð@Ø'(Ø%ð *ñ 
ô 
ð 
ð 
øõ ð 7ð 7ð 7ðNÝ%.Ô%DÅTÈ!ÁWÄWÈaÑ%PÔ%P�NØ!Ÿwšw ~Ñ6Ô6×=Ò=Ñ?Ô?�HÝ—N’NÐ#MÀ8Ð#MÐ#MÑNÔNÐNÐNøÝ ð Nð Nð NÝ—N’NÐ#LÅ4ÈÁ7Ä7Ð#LÐ#LÑMÔMÐMÐMÐMðNøøøà×3Ò3°AÑ6Ô6Ð6Ð6Ð6Ð6Ð6Ð6øøøøð7øøøð	7ð 	7s7   Á5,B"Â"
E-Â-A&DÄE(Ä4EÅE(Å
EÅE(Å(E-ú@list[Union[SerializedRunOperation, SerializedFeedbackOperation]]c          
     ó,  — g }i }	|D ]´}
t          |
t          ¦  «        r=t          |
¦  «        \  }}|                     |¦  «         |	                     |¦  «         ŒTt          |
t
          ¦  «        r#|                     t          |
¦  «        ¦  «         ŒŒt                               dt          |
¦  «        ¦  «         Œµt          |¦  «        }|rÇ	 |                      |||||||¬¦  «         nF# t          j        $ r4 d| _        d„ |D ¦   «         }|r|                      |||||||¬¦  «         Y nw xY wt!          t#          |	                     ¦   «         ¦  «        ¦  «         d S # t!          t#          |	                     ¦   «         ¦  «        ¦  «         w xY wd S )Nz+Unknown operation type in tracing queue: %srÿ  Tc                ó<   — g | ]}t          |t          ¦  «        ¯|‘ŒS rh   )r  r=   )r|   rP  s     re   rZ  z0Client._multipart_ingest_ops.<locals>.<listcomp>  s(   € ÐVÐVÐV "­z¸"Õ>TÑ/UÔ/UÐV˜2ÐVÐVÐVri   )r  r=   rC   rë  rD  r<   rB   ra   rý  r  r;   Ú_send_multipart_reqr¤   rp  r,  rX  r  r  r  )râ  rB  rk   r’  rø  r»  rù  rú  ÚpartsÚopened_files_dictrP  Úpartr  Úacc_multipartÚrun_opss                  re   Ú_multipart_ingest_opszClient._multipart_ingest_opsÖ  sú  € ð 13ˆØ:<ÐØð 	Vð 	VˆBÝ˜"Õ4Ñ5Ô5ð Võ LÈBÑOÔOñØØ à—’˜TÑ"Ô"Ð"Ø!×(Ò(¨Ñ6Ô6Ð6Ð6Ý˜BÕ ;Ñ<Ô<ð VØ—’ÝPÐQSÑTÔTñô ð ð õ —’ÐJÍDÐQSÉHÌHÑUÔUÐUÐUÝ8¸Ñ?Ô?ˆØð 	?ð?Ø×(Ò(Ø!Ø#Ø#Ø +Ø'Ø"/Ø!ð )ñ ô ð ð øõ Ô2ð ð ð ð ,0�Ô(àVÐV¨ÐVÑVÔV�Øð 	Ø×.Ò.ØØ 'Ø 'Ø$/Ø"+Ø&3Ø%ð /ñ ô ð øøðøøøõ" �TÐ"3×":Ò":Ñ"<Ô"<Ñ=Ô=Ñ>Ô>Ð>Ð>Ð>ø•�TÐ"3×":Ò":Ñ"<Ô"<Ñ=Ô=Ñ>Ô>Ð>Ð>øøøð9	?ð 	?s+   ÃC+ Ã*E! Ã+A D.Ä+E! Ä-D.Ä.E! Å!0F)r   c          	     ó   ‡ — |s|sdS ‰                       |pt          ¦  «        }‰                       |pt          d¬¦  «        }|s|sdS ˆ fd„|D ¦   «         }ˆ fd„|D ¦   «         }|rD|D ]@}|                     d¦  «        r|                     d¦  «        st          j        d¦  «        ‚ŒA~|rD|D ]@}|                     d¦  «        r|                     d¦  «        st          j        d	¦  «        ‚ŒA~|re|rcd
„ |D ¦   «         }g }|D ]O}|d         |v r.|                     ¦   «         D ]\  }	}
|
�|
||d                  |	<   ŒŒ:|                     |¦  «         ŒP~|}|s|sdS ‰                      |¦  «         ‰                      |¦  «         t          t          t          j        d„ |D ¦   «         d„ |D ¦   «         ¦  «        ¦  «        ¦  «        }|D ],}t          |t          ¦  «        rt          |j        |¦  «         Œ-‰                      |¦  «         dS )aº  Batch ingest/upsert multiple runs in the Langsmith system.

        Args:
            create (Optional[Sequence[Union[ls_schemas.Run, RunLikeDict]]]):
                A sequence of `Run` objects or equivalent dictionaries representing
                runs to be created / posted.
            update (Optional[Sequence[Union[ls_schemas.Run, RunLikeDict]]]):
                A sequence of `Run` objects or equivalent dictionaries representing
                runs that have already been created and should be updated / patched.

        Raises:
            LangsmithAPIError: If there is an error in the API request.

        !!! note

            The run objects MUST contain the `dotted_order` and `trace_id` fields
            to be accepted by the API.

        Example:
            ```python
            from langsmith import Client
            import datetime
            from uuid import uuid4

            client = Client()
            _session = "__test_batch_ingest_runs"
            trace_id = uuid4()
            trace_id_2 = uuid4()
            run_id_2 = uuid4()
            current_time = datetime.datetime.now(datetime.timezone.utc).strftime(
                "%Y%m%dT%H%M%S%fZ"
            )
            later_time = (
                datetime.datetime.now(datetime.timezone.utc) + timedelta(seconds=1)
            ).strftime("%Y%m%dT%H%M%S%fZ")

            runs_to_create = [
                {
                    "id": str(trace_id),
                    "session_name": _session,
                    "name": "run 1",
                    "run_type": "chain",
                    "dotted_order": f"{current_time}{str(trace_id)}",
                    "trace_id": str(trace_id),
                    "inputs": {"input1": 1, "input2": 2},
                    "outputs": {"output1": 3, "output2": 4},
                },
                {
                    "id": str(trace_id_2),
                    "session_name": _session,
                    "name": "run 3",
                    "run_type": "chain",
                    "dotted_order": f"{current_time}{str(trace_id_2)}",
                    "trace_id": str(trace_id_2),
                    "inputs": {"input1": 1, "input2": 2},
                    "error": "error",
                },
                {
                    "id": str(run_id_2),
                    "session_name": _session,
                    "name": "run 2",
                    "run_type": "chain",
                    "dotted_order": f"{current_time}{str(trace_id)}."
                    f"{later_time}{str(run_id_2)}",
                    "trace_id": str(trace_id),
                    "parent_run_id": str(trace_id),
                    "inputs": {"input1": 5, "input2": 6},
                },
            ]
            runs_to_update = [
                {
                    "id": str(run_id_2),
                    "dotted_order": f"{current_time}{str(trace_id)}."
                    f"{later_time}{str(run_id_2)}",
                    "trace_id": str(trace_id),
                    "parent_run_id": str(trace_id),
                    "outputs": {"output1": 4, "output2": 5},
                },
            ]

            client.multipart_ingest(create=runs_to_create, update=runs_to_update)
            ```
        NTrâ  c                ó:   •— g | ]}‰                      |¦  «        ‘ŒS rh   r]  r^  s     €re   rZ  z+Client.multipart_ingest.<locals>.<listcomp>v  s'   ø€ ÐCÐCÐC°S˜×+Ò+¨CÑ0Ô0ÐCÐCÐCri   c                ó>   •— g | ]}‰                      |d ¬¦  «        ‘ŒS )T)rD  r]  r^  s     €re   rZ  z+Client.multipart_ingest.<locals>.<listcomp>w  s,   ø€ ÐPÐPÐPÀ#˜×+Ò+¨C¸Ð+Ñ=Ô=ÐPÐPÐPri   rê  r  zNMultipart ingest requires trace_id and dotted_order to be set in create dicts.zNMultipart ingest requires trace_id and dotted_order to be set in update dicts.c                ó    — i | ]}|d          |“ŒS ©rÿ   rh   rc  s     re   r€   z+Client.multipart_ingest.<locals>.<dictcomp>�  s   € ÐCÐCÐC¨s˜C œI sÐCÐCÐCri   rÿ   c              3  ó6   K  — | ]}t          d |¦  «        V — ŒdS ra  rb  rc  s     re   r	  z*Client.multipart_ingest.<locals>.<genexpr>£  s-   è è € ÐMÐM¸Õ'¨°Ñ4Ô4ÐMÐMÐMÐMÐMÐMri   c              3  ó6   K  — | ]}t          d |¦  «        V — ŒdS re  rb  rc  s     re   r	  z*Client.multipart_ingest.<locals>.<genexpr>¤  s-   è è € ÐNÐN¸#Õ'¨°Ñ5Ô5ÐNÐNÐNÐNÐNÐNri   )rî  rä   r{   r¤   r§   r‹   rë  rß  r>   r  r  rm  r  r=   r  rþ  r  )râ  rY  rD  r   rf  rg  r»  Úcreate_by_idÚstandalone_updatesrÕ  rÖ  rh  rP  s   `            re   Úmultipart_ingestzClient.multipart_ingest  sß  ø€ ð| ð 	˜&ð 	ØˆFà×*Ò*¨6Ð+>µYÑ?Ô?ˆØ×*Ò*¨6Ð+>µYÀdÐ*ÑKÔKˆØð 	˜fð 	ØˆFàCÐCÐCÐC¸FÐCÑCÔCˆØPÐPÐPÐPÈÐPÑPÔPˆàð 	Ø#ð ð �Ø—w’w˜zÑ*Ô*ð °#·'²'¸.Ñ2IÔ2Ið Ý"Ô5ð6ñô ð ðð Øð 	Ø#ð ð �Ø—w’w˜zÑ*Ô*ð °#·'²'¸.Ñ2IÔ2Ið Ý"Ô5ð6ñô ð ðð àð 	.˜Lð 	.ØCÐC°lÐCÑCÔCˆLØ-/ÐØ#ð ð �Ø�t”9 Ð,Ð,Ø #§	¢	¡¤ð ;ð ;™˜˜1Ø˜=Ø9:˜L¨¨T¬Ô3°AÑ6øð;ð '×-Ò-¨cÑ2Ô2Ð2Ð2àØ-ˆLØð 	 Lð 	ØˆFà× Ò  Ñ.Ô.Ð.Ø× Ò  Ñ.Ô.Ð.õ =ÝÝ”ØMÐMÀÐMÑMÔMØNÐNÀÐNÑNÔNñô ñô ñ
ô 
ˆð !ð 	ð 	ˆBÝ˜"Õ4Ñ5Ô5ð Ý.Ø”NÐ$@ñô ð øð
 	×"Ò" >Ñ2Ô2Ð2Ð2Ð2ri   r“   )Úattemptsrk   r’  rø  r»  rù  rú  Úaccr:   rŠ  c          
     óà  ‡ ‡‡— |j         Š|j        }	t          |||||g¦  «        }
|
r/|p‰ j        }|t	          i ‰ j        ¥|||||‰ j        ¬¦  «        fg}n%ˆ fd„‰ j                             ¦   «         D ¦   «         }|D �]î\  }}t          d|dz   ¦  «        D �]Ó}	 t          j        ‰t          ¬¦  «        }|j        dk    r|                     ¦   «         Šn|Š‰                      d|› d�‰i |¥d|j        i¥t"          d	œd|	¬
¦  «          �n`# t$          j        $ r Y  �nMt$          j        t$          j        t$          j        f$ r5}||k    r t.                               d|› �¦  «         |}nY d }~ŒØY d }~n¾d }~wt2          $ r®}	 t5          j        t9          |¦  «        |¦  «        }d                     |¦  «                             ¦   «         }t.                               d|› �¦  «         n:# t2          $ r- t.                               dt?          |¦  «        › �¦  «         Y nw xY w|}Y d }~nd }~ww xY w‰                       ˆˆfd„ddt          › �i¦  «         ‰  !                    |¦  «          �Œðd S )Nr  c                óT   •— g | ]$\  }}|t          i ‰j        ¥|d d d d d ¬¦  «        f‘Œ%S rl  rm  rn  s      €re   rZ  z.Client._send_multipart_req.<locals>.<listcomp>Õ  rp  ri   r[   ©Úboundaryé -1r�  ú/runs/multipartrN  ©rL  r�   rº  ©r>  r?  rC  z!Failed to multipart ingest runs: r‹  c                 óŒ   •— t          ‰ t          ¦  «        r‰ n,t          j        ‰t          ¬¦  «                             ¦   «         S )NrŽ  )r  rü  Úrqtb_multipartÚMultipartEncoderr1   Ú	to_string)rL  rz  s   €€re   ú<lambda>z,Client._send_multipart_req.<locals>.<lambda>  sA   ø€ å% d­EÑ2Ô2ð&˜˜å+Ô<Ø!­Iðñ ô ç#š)™+œ+ð ri   úmultipart/form-data; boundary=)"rz  r  r  rk   r  r  r’  r®  r‹   rc  r•  r–  r1   rp   r—  r/  Úcontent_typeÚ_TRACING_SEND_TIMEOUTr¤   rq  r`  ra  rb  ra   rb   r@  rq  rr  r  r¨   rn   r’  rà  r  )râ  r‹  rŠ  rk   r’  rø  r»  rù  rú  rC  r   r!  rs  Úheaders_for_endpointry  Úencoderrô   Ú	_fail_excrM  rt  ru  rL  rz  s   `                    @@re   ry  zClient._send_multipart_req²  se  øøø€ ð ”	ˆØ”;ˆõ ˜G W¨k¸=È&ÐQÑRÔRˆØð 	Ø$Ð4¨¬ˆNð #Ý)Ø)˜4œ=Ð)Ø 'Ø$/Ø"+Ø&3Ø%Ø)-¬ðñ ô ððˆIˆIðð ð ð ð 7;Ô6J×6PÒ6PÑ6RÔ6Rðñ ô ˆIð  5>ð 7	ñ 7	Ñ0ˆNÐ0Ý˜Q ¨1¡Ñ-Ô-ð 6ñ 6�ð("Ý,Ô=¸eÍiÐXÑXÔX�GØ”{ jÒ0Ð0Ø&×0Ò0Ñ2Ô2˜˜à&˜Ø×-Ò-ØØ)Ð:Ð:Ð:à$(ð(Ø"6ð(à .°Ô0Dð(ð (õ (=ð(ð (ð ,-Ø!)ð .ñ ô ð ð ‘EøÝÔ6ð ð ð Ø�E‘EåÔ5ÝÔ4ÝÔ.ðð 	!ð 	!ð 	!ð
 ˜h’�ÝŸšÐ'PÈ3Ð'PÐ'PÑQÔQÐQØ/2˜	˜	à ˜˜˜˜ð "˜	˜	˜	˜	øøøøõ !ð "ð "ð "ðVÝ)2Ô)HÍÈaÉÌÐRSÑ)TÔ)T˜Ø#%§7¢7¨>Ñ#:Ô#:×#AÒ#AÑ#CÔ#C˜ÝŸšÐ'UÈ8Ð'UÐ'UÑVÔVÐVÐVøÝ$ð Vð Vð VÝŸšÐ'TÍ4ÐPQÉ7Ì7Ð'TÐ'TÑUÔUÐUÐUÐUðVøøøà !�I�I�I�I�I�Iøøøøð"øøøð ×'Ò'ðð ð ð ð ð $Ð%QÅiÐ%QÐ%QÐRñ	ô 	ð 	ð ×3Ò3°IÑ>Ô>Ð>Øùðo7	ð 7	sJ   ÂA.DÄH/Ä%H/Å&E4Å4H/ÆA&G)Ç(H*Ç)4H 	ÈH*ÈH 	È H*È*H/©rŠ  Údata_streamú
io.BytesIOÚcompressed_traces_infoúOptional[tuple[int, int]]c               óX  — d                      t          |dg ¦  «        ¦  «        }| j                             ¦   «         D �]j\  }}|                     d¦  «         t          d|dz   ¦  «        D �]:}	 t          | j        |ddddd¬¦  «        }dt          › �|d<   d	|d
<   |rt          |d         ¦  «        nd|d<   |rt          |d         ¦  «        nd|d<   t                               d|› �¦  «         |                      d|› d�||t          dœd|¬¦  «          �n�# t          j        $ r Y  �nzt          j        t          j        t          j        f$ rK}	||k    r t                               d|	› �¦  «         |	}
n|                     d¦  «         Y d}	~	�Œ(Y d}	~	n¾d}	~	wt(          $ r®}	 t+          j        t/          |¦  «        |¦  «        }d                      |¦  «                             ¦   «         }t                               d|› �¦  «         n:# t(          $ r- t                               dt3          |¦  «        › �¦  «         Y nw xY w|}
Y d}~nd}~ww xY w|                     d¦  «         |                      |j        dt          › �d	dœ¦  «         |                      |
¦  «          �ŒldS )zASend a zstd-compressed multipart form data stream to the backend.rE  r  r   r[   Nr  r™  rN  ÚzstdúContent-Encodingr‹  zX-Pre-Compressed-SizezX-Post-Compressed-Sizez3Sending compressed multipart request with context: r�  r‘  r’  r“  z,Failed to send compressed multipart ingest: )rN  r¦  )r¨   rÆ  r®  r‹   r§  rc  r  r  r1   rW   ra   rñ   r/  r›  r¤   rq  r`  ra  rb  rb   r@  rq  rr  r  rn   r’  rà  r°  r  )râ  r   r¢  rŠ  rC  rk   r’  ry  r�   rô   rž  rM  rt  ru  s                 re   Ú_send_compressed_multipart_reqz%Client._send_compressed_multipart_req  sŽ  € ð Ÿ	š	¥'¨+°yÀ"Ñ"EÔ"EÑFÔFˆà $Ô 4× :Ò :Ñ <Ô <ð L	ñ L	ÑˆG�WØ×Ò˜QÑÔÐå˜Q ¨1¡Ñ-Ô-ð Iñ I�ð="Ý3ØœØ 'Ø$(Ø"&Ø&*Ø#Ø)-ðñ ô �Gð E½ÐDÐDð ˜NÑ+ð 39�GÐ.Ñ/à:PÐX�Ð2°1Ô5Ñ6Ô6Ð6ÐVXð Ð3Ñ4ð ;QÐX�Ð2°1Ô5Ñ6Ô6Ð6ÐVXð Ð4Ñ5õ —L’LØXÈhÐXÐXñô ð ð ×-Ò-ØØ"Ð3Ð3Ð3à$/Ø'.Ý'<ð(ð (ð
 ,-Ø!)ð .ñ 
ô 
ð 
ð ‘EøÝÔ6ð ð ð Ø�E‘EåÔ5ÝÔ4ÝÔ.ðð !ð !ð !ð
 ˜h’�ÝŸšØPÈ3ÐPÐPñô ð ð 03˜	˜	à#×(Ò(¨Ñ+Ô+Ð+Ø ˜˜˜™ð "˜	˜	˜	˜	øøøøõ !ð "ð "ð "ð	Ý)2Ô)HÍÈaÉÌÐRSÑ)TÔ)T˜Ø#%§7¢7¨>Ñ#:Ô#:×#AÒ#AÑ#CÔ#C˜ÝŸšØUÈ8ÐUÐUñô ð ð øõ %ð ð ð ÝŸšØTÍ4ÐPQÉ7Ì7ÐTÐTñô ð ð ð ðøøøð !"�I�I�I�I�I�Iøøøøð"øøøð × Ò  Ñ#Ô#Ð#Ø×'Ò'ØÔ$à(TÍÐ(TÐ(TØ,2ðð ñô ð ð ×3Ò3°IÑ>Ô>Ð>ØùðYL	ð L	sJ   Á0B(DÄIÄ.%IÅ;FÆIÆ'A&HÈIÈ4I	ÉIÉI	ÉIÉI)r†  rÃ  r¿  Úend_timerý  r¾  r¿  rÀ  rÁ  Útagsrþ  r   Úreference_example_idr’  rk   rø  r»  rù  rú  rÀ  r¸  úOptional[RUN_TYPE_T]r¿  úOptional[datetime.datetime]r¨  rÁ  r©  úOptional[list[str]]rþ  ú Optional[ls_schemas.Attachments]rª  ústr | uuid.UUID | Nonec               ó¨  — t          |d¦  «        |||                     dd¦  «        |                     dd¦  «        |                     dd¦  «        ||
|                     dd¦  «        |                     dd¦  «        dœ
}|�|                     ¦   «         |d	<   |rt          ||¦  «         ||d
<   | j        dus	| j        duo|d         duo	|d         du}|                      |gd¬¦  «        sdS |�|                     ¦   «         |d<   nCt          j                             t          j	        j
        ¦  «                             ¦   «         |d<   |�|                      |¦  «        |d<   |�|                      |¦  «        |d<   |�.|st          j        |¦  «        }|                      |¦  «        |d<   |	�|                      |	¦  «        |d<   |d         rQ|d                              d¦  «        x}r|                      |¦  «        |d         d<   |                      |g¦  «         |�||d<   | j        r„|                     d¦  «        so| j        5  | j                             d|||||||dœf¦  «         |                      ¦   «         r|                      ¦   «          	 ddd¦  «         dS # 1 swxY w Y   dS |                      |||||||¬¦  «         dS )aÿ
  Update a run in the LangSmith API.

        Args:
            run_id (Union[UUID, str]): The ID of the run to update.
            name (Optional[str]): The name of the run.
            run_type (Optional[str]): The type of the run (e.g., llm, chain, tool).
            start_time (Optional[datetime.datetime]): The start time of the run.
            end_time (Optional[datetime.datetime]): The end time of the run.
            error (Optional[str]): The error message of the run.
            inputs (Optional[Dict]): The input values for the run.
            outputs (Optional[Dict]): The output values for the run.
            events (Optional[Sequence[dict]]): The events for the run.
            extra (Optional[Dict]): The extra information for the run.
            tags (Optional[List[str]]): The tags for the run.
            attachments (Optional[Dict[str, Attachment]]): A dictionary of attachments to add to the run. The keys are the attachment names,
                and the values are Attachment objects containing the data and mime type.
            reference_example_id (Optional[Union[str, uuid.UUID]]): ID of the example
                that was the source of the run inputs. Used for runs that were part of
                an experiment.
            api_key (Optional[str]): The API key to use for this specific run.
            api_url (Optional[str]): The API URL to use for this specific run.
            service_key (Optional[str]): The service JWT key for service-to-service auth.
            tenant_id (Optional[str]): The tenant ID for multi-tenant requests.
            authorization (Optional[str]): The Authorization header value.
            cookie (Optional[str]): The Cookie header value.
            **kwargs (Any): Kwargs are ignored.

        Returns:
            None

        Examples:
            ```python
            from langsmith import Client
            import datetime
            from uuid import uuid4

            client = Client()
            project_name = "__test_update_run"

            start_time = datetime.datetime.now()
            revision_id = uuid4()
            run: dict = dict(
                id=uuid4(),
                name="test_run",
                run_type="llm",
                inputs={"text": "hello world"},
                project_name=project_name,
                api_url=os.getenv("LANGCHAIN_ENDPOINT"),
                start_time=start_time,
                extra={"extra": "extra"},
                revision_id=revision_id,
            )
            # Create the run
            client.create_run(**run)
            run["outputs"] = {"output": ["Hi"]}
            run["extra"]["foo"] = "bar"
            run["name"] = "test_run_updated"
            # Update the run
            client.update_run(run["id"], **run)
            ```
        rÀ  rê  NÚparent_run_idr  rÁ  rû  )
rÿ   r†  rÃ  rê  r±  r  r©  rÁ  rÁ  rû  r¿  rþ  Trâ  r¨  rý  r¾  r¿  rÀ  rÁ  rC  rª  rý  rã  rÿ  r   )ra  rç  rÄ  r  r  r!  rî  rÃ  rc   rÍ  rÎ  rË  rÈ  r¤   rÇ  rÉ  rÊ  r{   rÌ  rß  r  r%  r$  rë  r  r  Ú_update_run)râ  rÀ  r†  rÃ  r¿  r¨  rý  r¾  r¿  rÀ  rÁ  r©  rþ  r   rª  r’  rk   rø  r»  rù  rú  r�   rL  Úuse_multipartrC  s                            re   Ú
update_runzClient.update_runv  s§  € õn ˜6 8Ñ,Ô,ØØ ØŸ
š
 :¨tÑ4Ô4Ø#ŸZšZ¨¸Ñ>Ô>Ø"ŸJšJ ~°tÑ<Ô<ØØØ Ÿ*š* \°4Ñ8Ô8Ø"ŸJšJ ~°tÑ<Ô<ð 
ð  
ˆð Ð!Ø!+×!5Ò!5Ñ!7Ô!7ˆD�ÑØð 	.Ý*¨;Ð8TÑUÔUÐUØ"-ˆD�ÑàÔ tÐ+ÐQ¨tÔ/EÈTÐ/Qð 1à�ZÔ ¨Ð,ð1ð �^Ô$¨DÐ0ð	 	ð ×(Ò(¨$¨°tÐ(Ñ<Ô<ð 	ØˆFØÐØ'×1Ò1Ñ3Ô3ˆD�ÑÐå'Ô0×4Ò4µXÔ5FÔ5JÑKÔK×UÒUÑWÔWˆD�ÑØÐØ ×0Ò0°Ñ7Ô7ˆD�‰MØÐØ!×2Ò2°6Ñ:Ô:ˆD�‰NØÐØ ð 9Ý"Ô/°Ñ8Ô8�Ø"×4Ò4°WÑ=Ô=ˆD�‰OØÐØ!×:Ò:¸6ÑBÔBˆD�‰NØ�Œ=ð 	-Ø œ=×,Ò,¨ZÑ8Ô8Ð8ˆxð NØ,0×,CÒ,CÀHÑ,MÔ,M��W”˜jÑ)Ø×$Ò$ d VÑ,Ô,Ð,ØÐ+Ø+?ˆDÐ'Ñ(ð Ô)ð 	°&·*²*Ð=VÑ2WÔ2Wð 	ØÔ*ð ð ØÔ$×+Ò+àØà'.Ø'.Ø+6Ø)2Ø-:Ø&,ðð ðñô ð ð ×4Ò4Ñ6Ô6ð 1Ø×.Ò.Ñ0Ô0Ð0Øð%ð ð ñ ô ð ð ð ð ð ð ð øøøð ð ð ð ð ð ð( ×ÒØØØØ'Ø#Ø+Øð ñ ô ð ð ð s   ÉAJ)Ê)J-Ê0J-Ú
run_updatec               óz  — | j         d us	| j        d uo|d         d uo	|d         d u}| j        �| j                             |¦  «         d S |�rÒt	          d|¬¦  «        }	| j        �ô|€ò|€ð|€î|€ì|€ê|€èt          |	¦  «        \  }
}t                               dd|
j        ¦  «         | j        j	        5  | j
        €t          d¦  «        ‚t          |
| j        t          ¦  «        }|r.| j        xj        dz  c_        | j
                             ¦   «          d d d ¦  «         n# 1 swxY w Y   t!          t#          |                     ¦   «         ¦  «        ¦  «         d S | j         �½t                               dd	|	j        |	j        ¦  «         | j        �]|                      t/          |d         |	|||||||                      | j                             ¦   «         ¦  «        ¬
¦	  «	        ¦  «         d S |                      t/          |d         |	||||||¬¦  «        ¦  «         d S d S |                      |||||||¬¦  «         d S )Nrê  r  rã  )rI  ÚpayloadrR  r	  r  r[   r
  r  r   )r  r!  r   r´  rA   rC   ra   r  r  r  r"  rï   r?   r1   r  r  r  r  r  rê  rÿ   r&  ró  r*   r(  r'  r  Ú_update_run_non_batch)râ  rµ  r’  rk   rø  r»  rù  rú  r³  r  r  r  r  s                re   r²  zClient._update_run  sA  € ð Ô tÐ+ÐQ¨tÔ/EÈTÐ/Qð 7à˜:Ô&¨dÐ2ð7ð ˜>Ô*°$Ð6ð	 	ð ÔÐ(ØÔ×(Ò(¨Ñ4Ô4Ð4Ð4Ð4Øñ Q	Ý.¸È*ÐUÑUÔUˆMàÔ&Ð2Ø�OØ�OØÐ'ØÐ%Ø!Ð)Ø�Nõ
 LØ!ñô ñØ"Ø õ —
’
ØØKØ"Ô*ñô ð ð
 Ô+Ô0ð 9ð 9ØÔ1Ð9Ý(Ø^ñô ð õ  DØ&ØÔ.Ý!ñ ô  �Hð
  ð 9ØÔ.Ð:Ô:¸aÑ?Ð:Ô:ØÔ2×6Ò6Ñ8Ô8Ð8ð9ð 9ð 9ñ 9ô 9ð 9ð 9ð 9ð 9ð 9ð 9øøøð 9ð 9ð 9ð 9õ �T ,×"5Ò"5Ñ"7Ô"7Ñ8Ô8Ñ9Ô9Ð9Ð9Ð9ØÔ#Ð/Ý—
’
ØØEØ!Ô*Ø!Ô$ñ	ô ð ð Ô%Ð1Ø×+Ò+Ý(Ø& ~Ô6Ø)Ø$+Ø$+Ø(3Ø&/Ø*7Ø#)Ø)-×)BÒ)BØ $Ô 0× AÒ AÑ CÔ Cñ*ô *ðñ ô ñô ð ð ð ð  ×+Ò+Ý(Ø& ~Ô6Ø)Ø$+Ø$+Ø(3Ø&/Ø*7Ø#)ð	ñ 	ô 	ñô ð ð ð ð1 0Ð/ðJ ×&Ò&ØØØØ'Ø#Ø+Øð 'ñ ô ð ð ð s   Â0A"DÄD"Ä%D"c          
     óÈ  — t          |||||g¦  «        }|r^|p| j        }	t          | j        |||||| j        ¬¦  «        }
|                      d|	› d|d         › �t          |¦  «        |
dœ¬¦  «         d S | j                             ¦   «         D ]S\  }}t          | j        |d d d d d ¬¦  «        }
|                      d|› d|d         › �t          |¦  «        |
dœ¬¦  «         ŒTd S )Nr  ÚPATCHú/runs/rÿ   r  r”  )	r  rk   r  r  r’  r/  r—  r®  r‹   )râ  rµ  r’  rk   rø  r»  rù  rú  r   r!  r�   r"  r#  s                re   r¸  zClient._update_run_non_batch€  sf  € õ ˜G W¨k¸=È&ÐQÑRÔRˆØð (	Ø$Ð4¨¬ˆNÝ+Ø”ØØ'Ø#Ø+ØØ!%¤ðñ ô ˆGð ×%Ò%ØØ!Ð;Ð;¨°DÔ)9Ð;Ð;å'¨
Ñ3Ô3Ø&ð ð  ð &ñ ô ð ð ð ð 15Ô0D×0JÒ0JÑ0LÔ0Lð ð Ñ,�˜}Ý/Ø”MØ)Ø $Ø"Ø"&ØØ%)ðñ ô �ð ×)Ò)ØØ$Ð>Ð>¨J°tÔ,<Ð>Ð>å +¨JÑ 7Ô 7Ø#*ð$ð $ð *ñ ô ð ð ðð ri   rº  c                óâ  — | j         €dS | j        €t          d¦  «        ‚ddlm}m}  || dd¬¦  «        \  }}|�dd}	 |                     | j        |||¬¦  «        }| j                             |¦  «         n(# t          $ r |                      |||¬¦  «         Y nw xY w| j        rIt          | j        ¦  «        }t          j        ||¬¦  «        \  }	}
| j                             |	¦  «         dS dS )	a¦  Force flush the currently buffered compressed runs.

        Args:
            attempts: Retry attempts for the send request.
            timeout: Maximum seconds to wait for in-flight sends to complete.
                None (default) waits indefinitely. Bounds only the wait on
                already-submitted sends; the synchronous drain and submit
                steps above are not bounded by this timeout.
        Nz>Run compression is enabled but request pool futures is not setr   )r:  Ú'_tracing_thread_drain_compressed_bufferr[   )r<  r9  rŸ  ©rº  )r!  r#  rï   r=  r:  r½  r>  r§  rô  r?  r  ÚcfÚwaitÚdifference_update)râ  rŠ  rº  r:  r½  Úfinal_data_streamr¢  rA  ÚfuturesÚdoner  s              re   Úflush_compressed_traceszClient.flush_compressed_traces·  sy  € ð Ô!Ð)ØˆFàŒ=Ð ÝØPñô ð ð
	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 4Ð3Ø˜Q°ð
ñ 
ô 
ñ	
ØØ"ð
 Ð(àˆFðØ5×<Ò<ØÔ7Ø%Ø*Ø%ð	 =ñ ô �ð ”×!Ò! &Ñ)Ô)Ð)Ð)øÝð ð ð à×3Ò3Ø%Ð'=Èð 4ñ ô ð ð ð ðøøøð Œ=ð 	2Ý˜4œ=Ñ)Ô)ˆGÝ”g˜g¨wÐ7Ñ7Ô7‰GˆD�!àŒM×+Ò+¨DÑ1Ô1Ð1Ð1Ð1ð		2ð 	2s   ¾8A7 Á7"BÂBc                ó€  — |�t          j        ¦   «         |z   nd}| j        r:| j        5  | j        r|                      ¦   «          ddd¦  «         n# 1 swxY w Y   | j        �”|€| j                             ¦   «          nx| j        j        5  | j        j	        rH|t          j        ¦   «         z
  }|dk    rn+| j        j         
                    |¦  «         | j        j	        °Hddd¦  «         n# 1 swxY w Y   | j        �@|�$t          d|t          j        ¦   «         z
  ¦  «        nd}|                      |¬¦  «         dS dS )a  Flush the tracing queue and compressed buffer.

        Args:
            timeout: Maximum seconds to wait for pending traces to drain.
                None (default) waits indefinitely. A timeout of 0 returns
                immediately without waiting.
        Nr   rQ   r¾  )r^   Ú	monotonicr  r%  r$  r  r  r¨   Úall_tasks_doneÚunfinished_tasksrÀ  r!  rt  rÅ  )râ  rº  ÚdeadlineÚwait_forÚ	remainings        re   ÚflushzClient.flushð  s÷  € ð 29Ð1D•4”>Ñ#Ô# gÑ-Ð-È$ˆàÔ)ð 	1ØÔ*ð 1ð 1ØÔ'ð 1Ø×.Ò.Ñ0Ô0Ð0ð1ð 1ð 1ñ 1ô 1ð 1ð 1ð 1ð 1ð 1ð 1øøøð 1ð 1ð 1ð 1ð ÔÐ)ØÐØÔ"×'Ò'Ñ)Ô)Ð)Ð)ð Ô'Ô6ð Ið IØÔ,Ô=ð IØ#+­d¬nÑ.>Ô.>Ñ#>˜Ø# qš=˜=Ø!ØÔ*Ô9×>Ò>¸xÑHÔHÐHð	 Ô,Ô=ð IðIð Ið Iñ Iô Ið Ið Ið Ið Ið Ið Iøøøð Ið Ið Ið Ið Ô!Ð-à9AÐ9M•�C˜¥D¤NÑ$4Ô$4Ñ4Ñ5Ô5Ð5ÐSWð ð ×(Ò(°Ð(Ñ;Ô;Ð;Ð;Ð;ð	 .Ð-s$   ©AÁAÁAÂAC,Ã,C0Ã3C0úls_schemas.Runc                óF  — t          j        | j        j        ¦  «        }|t           j        j        k    rt          j        d¦  «        ‚t          ¦   «         5  |  	                    d|j
        |j        ¬¦  «        }ddd¦  «         n# 1 swxY w Y   t          j        t          ¦  «        }i }t          |j        ¦  «        }t#          |d„ ¬¦  «        D ]ˆ}|j        €t          j        d|j        › d�¦  «        ‚d	„ |j                             d
¦  «        D ¦   «         }||v r:|j        |j        k    r*||j                                      |¦  «         |||j        <   Œ‰|                     |j        g ¦  «        |_        |                     ¦   «         D ]\  }	}
|
||	         _        Œ|S )a‚  Load child runs for a given run.

        Args:
            run (Run): The run to load child runs for.

        Returns:
            Run: The run with loaded child runs.

        Raises:
            LangSmithError: If a child run has no parent, or on SmithDB-only
                backends (no ClickHouse query support), where loading child
                runs isn't supported.
        u´   Loading child runs is not supported on SmithDB-only backends (no ClickHouse query support). See https://docs.langchain.com/langsmith/smithdb-sdk-migration#load-a-runâ€™s-child-runsF)Úis_rootrÁ  rê  Nc                ó   — | j         S ry   )r  ©Úrs    re   r˜  z)Client._load_child_runs.<locals>.<lambda>5  s   € ˜!œ.€ ri   ©r}   z
Child run z has no parentc                óN   — h | ]"}d |v ¯|                      d d¦  «        d         ’Œ#S )ÚZr[   )r`  )r|   Úsegs     re   ú	<setcomp>z*Client._load_child_runs.<locals>.<setcomp>;  s<   € ð ð ð àØ˜#�:�:ð —	’	˜#˜qÑ!Ô! !Ô$à�:�:ri   ú.)r(   rG   rž  r¡  rF   r¢  r¤   rB  Ú_suppress_deprecation_warningÚ	list_runsrÁ  rê  rJ  rK  r  rW   rÿ   r©   r±  r  r`  rë  rç  Ú
child_runsr‹   )râ  r»  ÚbackendrÜ  Útreemaprö  Ú
run_id_strÚ	child_runÚancestor_idsrÀ  Úchildrens              re   Ú_load_child_runszClient._load_child_runs  sÿ  € õ &Ô7¸¼	Ô8PÑQÔQˆØÕ)Ô6ÔCÒCÐCÝÔ)ð-ñô ð õ +Ñ,Ô,ð 	ð 	ØŸšØ¨#¬.À3Ä<ð (ñ ô ˆJð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	õ
 Ô#¥DÑ)Ô)ð 	ð 13ˆÝ˜œ‘[”[ˆ
åØØ(Ð(ð
ñ 
ô 
ð 	/ð 	/ˆIð Ô&Ð.ÝÔ-Ð.W¸9¼<Ð.WÐ.WÐ.WÑXÔXÐXðð à$Ô1×7Ò7¸Ñ<Ô<ðñ ô ˆLð
 ˜\Ð)Ð)¨i¬l¸c¼fÒ.DÐ.DØ˜	Ô/Ô0×7Ò7¸	ÑBÔBÐBØ%.��Y”\Ñ"øØ Ÿš S¤V¨RÑ0Ô0ˆŒØ '§¢¡¤ð 	/ð 	/ÑˆF�HØ&.ˆD�ŒLÔ#Ð#Øˆ
s   Á#BÂB	ÂB	zÊread_run() is deprecated and will be removed after Jan 31, 2027. Use client.runs.retrieve() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#runs-retrieve for the migration guide.©Ú
project_idr¿  Úload_child_runsrå  úOptional[ID_TYPE]c               ój  — t          |d¦  «        }t          j        | j        j        ¦  «        }|t          j        j        k    r‰|                      dd|› �¦  «        }t          | 	                    ¦   «         d| j
        ¬¦  «        }t          j        dd|i| 	                    ¦   «         ¤d| j        i¤Ž}	|r|                      |	¦  «        }	|	S |€t          j        d	¦  «        ‚|€t          j        d
¦  «        ‚|rt          j        d¦  «        ‚t          j        || t          |d¦  «        |¬¦  «        S )ao  Read a run from the LangSmith API.

        .. admonition:: Deprecated

            Use :meth:`langsmith.Client.runs.retrieve` instead.
            See https://docs.langchain.com/langsmith/smithdb-sdk-migration#runs-retrieve for the migration guide.
            Will be removed after Jan 31, 2027.

        Args:
            run_id (Union[UUID, str]):
                The ID of the run to read.
            load_child_runs (bool, default=False):
                Whether to load nested child runs. **Deprecated**: this will
                be removed in a future release, and raises on SmithDB-only
                backends (no ClickHouse query support), where child runs are
                never loaded.
            project_id (Optional[Union[UUID, str]]):
                The ID of the project (session) that owns the run. Required on
                SmithDB-only backends (no ClickHouse query support).
            start_time (Optional[datetime]):
                The run's start time. Required on SmithDB-only backends (no
                ClickHouse query support).

        Returns:
            Run: The run read from the LangSmith API.

        Examples:
            ```python
            from langsmith import Client

            # Existing run
            run_id = "your-run-id"

            client = Client()
            stored_run = client.read_run(run_id)
            ```
        rÀ  r-  r»  Ús3_urls©Úattachments_keyrk   rþ  r  NzTread_run requires project_id on SmithDB-only backends (no ClickHouse query support).zTread_run requires start_time on SmithDB-only backends (no ClickHouse query support).u±   load_child_runs is not supported on SmithDB-only backends (no ClickHouse query support). See https://docs.langchain.com/langsmith/smithdb-sdk-migration#load-a-runâ€™s-child-runsrå  rä  rh   )ra  r(   rG   rž  r¡  rF   r¢  r/  Ú/_convert_stored_attachments_to_attachments_dictrù  rk   r{  rÕ   r  rã  r¤   rB  Ú_read_run_v2)
râ  rÀ  ræ  rå  r¿  Úrun_id_rÝ  r2  rþ  r»  s
             re   Úread_runzClient.read_runH  s|  € õf ˜6 8Ñ,Ô,ˆÝ%Ô7¸¼	Ô8PÑQÔQˆØÕ)Ô6ÔCÒCÐCØ×0Ò0°Ð8JÀÐ8JÐ8JÑKÔKˆHÝIØ—’‘”°ÀDÄLðñ ô ˆKõ ”.ð ð Ø'ðØ+3¯=ª=©?¬?ðð ØFJÄnðð ð ˆCð ð 1Ø×+Ò+¨CÑ0Ô0�ØˆJàÐÝÔ)ð2ñô ð ð ÐÝÔ)ð2ñô ð ð ð 	ÝÔ)ð-ñô ð õ #Ô/ØØÝ 
¨LÑ9Ô9Ø!ð	
ñ 
ô 
ð 	
ri   zÙread_thread() is deprecated and will be removed after Jan 31, 2027. Use client.threads.list_traces() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#threads-list-traces for the migration guide.Úasc©rå  rô  rÐ  r‹  ÚselectÚfilterÚorderrõ  ú+Optional[Union[ID_TYPE, Sequence[ID_TYPE]]]ú#Optional[Union[str, Sequence[str]]]rÐ  r‹  rò  úOptional[Sequence[str]]ró  rô  úLiteral['asc', 'desc']úIterator[ls_schemas.Run]c               ó
  — |s|st          d¦  «        ‚t          j        t          |¦  «        ¦  «        }
d|
› d�}|r	d|› d|› d�n|}t	          ¦   «         5   | j        d|||||||dœ|	¤Žcddd¦  «         S # 1 swxY w Y   dS )	a±  Read runs for a single thread.

        .. admonition:: Deprecated

            Use :meth:`langsmith.Client.threads.list_traces` instead.
            See https://docs.langchain.com/langsmith/smithdb-sdk-migration#threads-list-traces for the migration guide.
            Will be removed after Jan 31, 2027.

        Args:
            thread_id: Thread id (required).
            project_id: Project id(s) (required when not using project_name).
            project_name: Project name(s) (required when not using project_id).
            is_root: If True, return only root runs. Default True.
            limit: Maximum number of runs to return.
            select: Fields to select.
            filter: Additional filter expression.
            order: Sort order for runs (e.g. "asc" for chronological). Default "asc".
            **kwargs: Additional arguments passed to the runs query.

        Yields:
            Runs in the thread.

        Examples:
            ```python
            for run in client.read_thread(
                thread_id="thread_abc123",
                project_name="My Project",
                limit=50,
            ):
                print(run.id)
            ```
        z-thread_id requires project_id or project_namezeq(thread_id, r  zand(r¡   rñ  Nrh   )rï   rù  rú  rW   rÚ  rÛ  )râ  rõ  rå  rô  rÐ  r‹  rò  ró  rô  r�   Úthread_id_escapedÚthread_filterÚcombined_filters                re   Úread_threadzClient.read_thread¡  s  € ðf ð 	N˜lð 	NÝÐLÑMÔMÐMå œJ¥s¨9¡~¤~Ñ6Ô6ÐØ=Ð):Ð=Ð=Ð=ˆØ?EÐXÐ; Ð;Ð;°&Ð;Ð;Ð;Ð;È=ˆõ +Ñ,Ô,ð 
	ð 
	Ø!�4”>ð 	Ø%Ø)ØØØØ&Øð	ð 	ð ð	ð 	ð
	ð 
	ð 
	ð 
	ñ 
	ô 
	ð 
	ð 
	ð 
	ð 
	ð 
	ð 
	øøøð 
	ð 
	ð 
	ð 
	ð 
	ð 
	s   ÁA8Á8A<Á?A<zÅlist_runs() is deprecated and will be removed after Jan 31, 2027. Use client.runs.query() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#runs-query for the migration guide.)rå  rô  rÃ  rê  rª  Úqueryró  Útrace_filterÚtree_filterrÐ  r±  r¿  rý  Úrun_idsrò  r‹  rê  rÿ  r   r  r±  r  úOptional[Sequence[ID_TYPE]]c             +  ó  ‡ K  — g }t          |t          j        t          f¦  «        r|                     |¦  «         n*t          |t
          ¦  «        r|                     |¦  «         |�9t          |t          ¦  «        r|g}|                     ˆ fd„|D ¦   «         ¦  «         g d¢}|p|}d|v rt          j        dt          ¦  «         |r|nd||r|gnd||||	|
||r| 
                    ¦   «         nd|||||dœ|¥}d„ |                     ¦   «         D ¦   «         }t          ‰                      d|¬	¦  «        ¦  «        D ]H\  }}t          |d
‰ j        ¬¦  «        }t!          j        dd|i|¤d‰ j        i¤ŽV — |�|dz   |k    r dS ŒIdS )a  List runs from the LangSmith API.

        .. admonition:: Deprecated

            Use :meth:`langsmith.Client.runs.query` instead.
            See https://docs.langchain.com/langsmith/smithdb-sdk-migration#runs-query for the migration guide.
            Will be removed after Jan 31, 2027.

        Args:
            project_id: The ID(s) of the project to filter by.
            project_name: The name(s) of the project to filter by.
            run_type: The type of the runs to filter by.
            trace_id: The ID of the trace to filter by.
            reference_example_id: The ID of the reference example to filter by.
            query: The query string to filter by.
            filter: The filter string to filter by.
            trace_filter: Filter to apply to the ROOT run in the trace tree.

                This is meant to be used in conjunction with the regular `filter`
                parameter to let you filter runs by attributes of the root run within a
                trace.
            tree_filter: Filter to apply to OTHER runs in the trace tree, including
                sibling and child runs.

                This is meant to be used in conjunction with the regular `filter`
                parameter to let you filter runs by attributes of any run within a
                trace.
            is_root: Whether to filter by root runs.
            parent_run_id: The ID of the parent run to filter by.
            start_time: The start time to filter by.
            error: Whether to filter by error status.
            run_ids: The IDs of the runs to filter by.
            select: The fields to select.
            limit: The maximum number of runs to return.
            **kwargs: Additional keyword arguments.

        Yields:
            The runs.

        Examples:
            ```python
            # List all runs in a project
            project_runs = client.list_runs(project_name="<your_project>")

            # List LLM and Chat runs in the last 24 hours
            todays_llm_runs = client.list_runs(
                project_name="<your_project>",
                start_time=datetime.now() - timedelta(days=1),
                run_type="llm",
            )

            # List root traces in a project
            root_runs = client.list_runs(project_name="<your_project>", is_root=1)

            # List runs without errors
            correct_runs = client.list_runs(project_name="<your_project>", error=False)

            # List runs and only return their inputs/outputs (to speed up the query)
            input_output_runs = client.list_runs(
                project_name="<your_project>", select=["inputs", "outputs"]
            )

            # List runs by run ID
            run_ids = [
                "a36092d2-4ad5-4fb4-9c0d-0dba9a2ed836",
                "9398e6be-964f-4aa4-8ae9-ad78cd4b7074",
            ]
            selected_runs = client.list_runs(id=run_ids)

            # List all "chain" type runs that took more than 10 seconds and had
            # `total_tokens` greater than 5000
            chain_runs = client.list_runs(
                project_name="<your_project>",
                filter='and(eq(run_type, "chain"), gt(latency, 10), gt(total_tokens, 5000))',
            )

            # List all runs called "extractor" whose root of the trace was assigned feedback "user_score" score of 1
            good_extractor_runs = client.list_runs(
                project_name="<your_project>",
                filter='eq(name, "extractor")',
                trace_filter='and(eq(feedback_key, "user_score"), eq(feedback_score, 1))',
            )

            # List all runs that started after a specific timestamp and either have "error" not equal to null or a "Correctness" feedback score equal to 0
            complex_runs = client.list_runs(
                project_name="<your_project>",
                filter='and(gt(start_time, "2023-07-15T12:34:56Z"), or(neq(error, null), and(eq(feedback_key, "Correctness"), eq(feedback_score, 0.0))))',
            )

            # List all runs where `tags` include "experimental" or "beta" and `latency` is greater than 2 seconds
            tagged_runs = client.list_runs(
                project_name="<your_project>",
                filter='and(or(has(tags, "experimental"), has(tags, "beta")), gt(latency, 2))',
            )
            ```
        Nc                óF   •— g | ]}‰                      |¬ ¦  «        j        ‘ŒS ©©rô  )Úread_projectrÿ   )r|   r†  râ  s     €re   rZ  z$Client.list_runs.<locals>.<listcomp>l  s-   ø€ ÐRÐRÐR¸T�×"Ò"°Ð"Ñ5Ô5Ô8ÐRÐRÐRri   )Úapp_pathÚcompletion_costÚcompletion_tokensr  r¨  rý  rÀ  rÁ  Úfeedback_statsÚfirst_token_timerÿ   r¾  r†  r¿  r±  Úparent_run_idsÚprompt_costÚprompt_tokensrª  rÃ  rÁ  r¿  Ústatusr©  Ú
total_costÚtotal_tokensrê  Úchild_run_idszOThe child_run_ids field is deprecated and will be removed in following versions)rs   rÃ  Úreference_examplerÿ  ró  r   r  rÐ  Ú
parent_runr¿  rý  rÿ   r·   rò  r‹  c                ó   — i | ]
\  }}|®||“ŒS ry   rh   r5  s      re   r€   z$Client.list_runs.<locals>.<dictcomp>¨  ó   € ÐKÐKÐK™t˜q !¸Q¸]�a˜¸]¸]¸]ri   ú/runs/query©rÅ  ré  rê  rþ  r  r[   rh   )r  r[  r\  rW   rë  r  Úextendrª   r«   r”  rÄ  r‹   Ú	enumerater™  rì  rk   r{  rÕ   r  )râ  rå  rô  rÃ  rê  rª  rÿ  ró  r   r  rÐ  r±  r¿  rý  r  rò  r‹  r�   Úproject_idsÚdefault_selectÚ
body_queryÚir»  rþ  s   `                       re   rÛ  zClient.list_runsè  sK  øè è € ðv ˆÝ�j¥4¤9­cÐ"2Ñ3Ô3ð 	+Ø×Ò˜zÑ*Ô*Ð*Ð*Ý˜
¥DÑ)Ô)ð 	+Ø×Ò˜zÑ*Ô*Ð*ØÐ#Ý˜,­Ñ,Ô,ð .Ø ,˜~�Ø×ÒØRÐRÐRÐRÀ\ÐRÑRÔRñô ð ð
ð 
ð 
ˆð< Ð)˜>ˆà˜fÐ$Ð$ÝŒMØaÝ"ñô ð ð '2Ð;�{�{°tØ à*>ÐHÐ%Ð&Ð&ÀDàØØ(Ø&ØØ'Ø4>ÐH˜*×.Ò.Ñ0Ô0Ð0ÀDØØØØØð#&
ð &
ð$ ð%&
ˆ
ð( LÐK z×'7Ò'7Ñ'9Ô'9ÐKÑKÔKˆ
ÝØ×+Ò+¨MÀ
Ð+ÑKÔKñ
ô 
ð 	ð 	‰FˆAˆsõ JØ Y¸¼ðñ ô ˆKõ ”.ð ð Ø'ðØ+.ðð Ø:>¼.ðð ð ð ð ð ð Ð  Q¨¡U¨e¢^ ^Ø��øð	ð 	ri   zÎlist_threads() is deprecated and will be removed after Jan 31, 2027. Use client.threads.query() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#threads-query for the migration guide.r   )rå  rô  r‹  rŠ  ró  r¿  rŠ  úlist[ListThreadsItem]c          
     ó  — |€|€t          d¦  «        ‚|�|�t          d¦  «        ‚|�|                      |¬¦  «        j        }|€J ‚t          t	          |d¦  «        ¦  «        }|€Dt
          j                             t
          j        j        ¦  «        t          j	        d¬¦  «        z
  }|j
        €%|                     t
          j        j        ¬¦  «        }g d	¢}|gd
dd||                     ¦   «         dœ}	|�||	d<   d„ |	                     ¦   «         D ¦   «         }	t          j        t           ¦  «        }
|                      d|	¬¦  «        D ]4}|                     d¦  «        }|r|
|                              |¦  «         Œ5g }|
                     ¦   «         D ]¿\  }}|                     d„ ¬¦  «         g }|D ]H}t+          |d| j        ¬¦  «        }|                     t/          j        dd|i|¤d| j        i¤Ž¦  «         ŒId„ |D ¦   «         }|                     ||t5          |¦  «        |rt7          |¦  «        nd|rt9          |¦  «        nddœ¦  «         ŒÀ|                     d„ d
¬¦  «         |dk    r
||d…         }|�
|d|…         }|S )ap  List threads and fetch the runs for each thread.

        .. admonition:: Deprecated

            Use :meth:`langsmith.Client.threads.query` instead.
            See https://docs.langchain.com/langsmith/smithdb-sdk-migration#threads-query for the migration guide.
            Will be removed after Jan 31, 2027.

        Args:
            project_id: The project (session) id.
            project_name: The project name (alternative to project_id).
            limit: Maximum number of threads to return. Default None (no limit).
            offset: Pagination offset for threads. Default 0.
            filter: Optional filter for threads and runs.
            start_time: Only include runs from this time. Default: 1 day ago.

        Returns:
            List of thread items, each with "thread_id", "runs", "count",
            "min_start_time", and "max_start_time".
        Nz2Either project_id or project_name must be providedz1Provide exactly one of project_id or project_namer  rå  r[   )Údays©Útzinfo)rÿ   r†  r  r¿  r¨  rõ  rê  rÃ  rý  r©  rÁ  r±  r  r  r  rª  r  r	  Trj  Údesc)rs   rÐ  r‹  rô  rò  r¿  ró  c                ó   — i | ]
\  }}|®||“ŒS ry   rh   r5  s      re   r€   z'Client.list_threads.<locals>.<dictcomp>	  r  ri   r  r  rõ  c                ó^   — |                       d¦  «        pd|                       d¦  «        pdfS )Nr¿  r‹  r  rz   rÒ  s    re   r˜  z%Client.list_threads.<locals>.<lambda>  s1   € Ø—E’E˜,Ñ'Ô'Ð-¨2Ø—E’E˜.Ñ)Ô)Ð/¨Rð€ ri   rÔ  ré  rê  rþ  r  c                ób   — g | ],}|                      d ¦  «        ®t          |d          ¦  «        ‘Œ-S )r¿  )r{   rW   ©r|   rÓ  s     re   rZ  z'Client.list_threads.<locals>.<listcomp>%  s@   € ð &ð &ð &àØ—5’5˜Ñ&Ô&Ð2õ �A�l”OÑ$Ô$à2Ð2Ð2ri   )rõ  rö  rd   r÷  rø  c                ó0   — |                       d¦  «        pdS )Nrø  r‹  rz   )Úts    re   r˜  z%Client.list_threads.<locals>.<lambda>5  s   € ˜!Ÿ%š%Ð 0Ñ1Ô1Ð7°R€ ri   )r}   Úreverser   rh   )rï   r  rÿ   rW   ra  rÃ  rc   rÍ  rÎ  Ú	timedeltar%  ru  rÄ  r‹   rJ  rK  r  r™  r{   rë  Úsortrì  rk   r{  rÕ   r  rp   Úminrt  )râ  rå  rô  r‹  rŠ  ró  r¿  rÁ  Ú
run_selectr  Úthreads_mapÚrun_dictÚtidr¹  rõ  Ú	run_dictsrö  rþ  Ústart_timess                      re   Úlist_threadszClient.list_threads¶  s\  € ðH Ð ,Ð"6ÝÐQÑRÔRÐRØÐ! lÐ&>ÝÐPÑQÔQÐQàÐ#Ø×*Ò*¸Ð*ÑEÔEÔHˆJØÐ%Ð%Ð%Ý� *¨lÑ;Ô;Ñ<Ô<ˆ
àÐÝ!Ô*×.Ò.ÝÔ!Ô%ñô åÔ"¨Ð*Ñ*Ô*ñ+ˆJð ÔÐ$Ø#×+Ò+µ8Ô3DÔ3HÐ+ÑIÔIˆJð
ð 
ð 
ˆ
ð* #�|ØØØØ Ø$×.Ò.Ñ0Ô0ð&
ð &
ˆ
ð ÐØ#)ˆJ�xÑ ØKÐK z×'7Ò'7Ñ'9Ô'9ÐKÑKÔKˆ
å-8Ô-DÅTÑ-JÔ-JˆØ×7Ò7¸ÈJÐ7ÑWÔWð 	2ð 	2ˆHØ—,’,˜{Ñ+Ô+ˆCØð 2Ø˜CÔ ×'Ò'¨Ñ1Ô1Ð1øà(*ˆØ$/×$5Ò$5Ñ$7Ô$7ð  	ð  	Ñ ˆI�yØ�NŠNðð ð ñ ô ð ð ˆDØ%ð 
ð 
�ÝMØ¨iÀÄðñ ô �ð —’Ý”Nð ð Ø$/ðà"ðð ð #'¤.ðð ð ñô ð ð ð&ð &à"ð&ñ &ô &ˆKð
 �MŠMà!*Ø Ý  ™YœYØ:EÐ&O¥c¨+Ñ&6Ô&6Ð&6È4Ø:EÐ&O¥c¨+Ñ&6Ô&6Ð&6È4ðð ñô ð ð ð 	�ŠØ7Ð7Øð 	ñ 	
ô 	
ð 	
ð �AŠ:ˆ:Ø˜F˜G˜G”_ˆFØÐØ˜F˜U˜F”^ˆFØˆri   )rÿ   r·   r  rÃ  Úproject_namesr  Úreference_example_idsr¿  r¨  rý  rÿ  ró  r   r  rÐ  Údata_source_typerÿ   úOptional[list[ID_TYPE]]r·   r  r8  r  r9  r:  c               ó  ‡ ‡— ddl m}m} |pg }|rl |¦   «         5 Šˆˆ fd„|D ¦   «         } ||¦  «        D ].}|                     |                     ¦   «         j        ¦  «         Œ/	 ddd¦  «         n# 1 swxY w Y   |st          d¦  «        ‚||||||||	|
||||||dœ}d„ |                     ¦   «         D ¦   «         }‰                      dd	d
t          |¦  «        i¬¦  «        }t          j        |¦  «         |                     ¦   «         S )a¹  Get aggregate statistics over queried runs.

        Takes in similar query parameters to `list_runs` and returns statistics
        based on the runs that match the query.

        Args:
            id (Optional[List[Union[UUID, str]]]): List of run IDs to filter by.
            trace (Optional[Union[UUID, str]]): Trace ID to filter by.
            parent_run (Optional[Union[UUID, str]]): Parent run ID to filter by.
            run_type (Optional[str]): Run type to filter by.
            project_names (Optional[List[str]]): List of project names to filter by.
            project_ids (Optional[List[Union[UUID, str]]]): List of project IDs to filter by.
            reference_example_ids (Optional[List[Union[UUID, str]]]): List of reference example IDs to filter by.
            start_time (Optional[str]): Start time to filter by.
            end_time (Optional[str]): End time to filter by.
            error (Optional[bool]): Filter by error status.
            query (Optional[str]): Query string to filter by.
            filter (Optional[str]): Filter string to apply.
            trace_filter (Optional[str]): Trace filter string to apply.
            tree_filter (Optional[str]): Tree filter string to apply.
            is_root (Optional[bool]): Filter by root run status.
            data_source_type (Optional[str]): Data source type to filter by.

        Returns:
            Dict[str, Any]: A dictionary containing the run statistics.
        r   ©ÚThreadPoolExecutorÚas_completedc                óH   •— g | ]}‰                      ‰j        |¬ ¦  «        ‘ŒS r  )r>  r  )r|   r†  Úexecutorrâ  s     €€re   rZ  z(Client.get_run_stats.<locals>.<listcomp>q  s<   ø€ ð ð ð àð —O’O DÔ$5ÀD�OÑIÔIðð ð ri   Nz>At least one of project_names or project_ids must be provided.)rÿ   r·   r  rÃ  rs   r  r¿  r¨  rý  rÿ  ró  r   r  rÐ  r:  c                ó   — i | ]
\  }}|®||“ŒS ry   rh   r5  s      re   r€   z(Client.get_run_stats.<locals>.<dictcomp>Ž  s   € ÐEÐEÐE™D˜A˜q°q°}�1�a°}°}°}ri   r�  z/runs/statsrL  r”  )Úconcurrent.futuresr>  r?  rë  r¹  rÿ   rï   r‹   r/  r—  r¤   r0  rù  )râ  rÿ   r·   r  rÃ  r8  r  r9  r¿  r¨  rý  rÿ  ró  r   r  rÐ  r:  r>  r?  rÃ  rA  r·  r2  rA  s   `                      @re   Úget_run_statszClient.get_run_stats>  sÍ  øø€ ð\ 	HÐGÐGÐGÐGÐGÐGÐGà!Ð' RˆØð 	;Ø#Ð#Ñ%Ô%ð ;¨ðð ð ð ð à -ðñ ô �ð +˜l¨7Ñ3Ô3ð ;ð ;�FØ×&Ò& v§}¢}¡¤Ô'9Ñ:Ô:Ð:Ð:ð;ð;ð ;ð ;ñ ;ô ;ð ;ð ;ð ;ð ;ð ;ð ;øøøð ;ð ;ð ;ð ;ð ð 	ÝØPñô ð ð ØØ$Ø Ø"Ø!6Ø$Ø ØØØØ(Ø&ØØ 0ð
ð 
ˆð& FÐE G§M¢M¡O¤OÐEÑEÔEˆà×,Ò,ØØà� GÑ,Ô,ðð -ñ 
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5Ø�}Š}‰ŒÐs   ›A
A2Á2A6Á9A6zËget_run_url() is deprecated and will be removed after Jan 31, 2027. Use client.runs.get_url() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#runs-get-url for the migration guide.)rô  rå  úls_schemas.RunBasec               ó2   — |                       |||¬¦  «        S )aÀ  Get the URL for a run.

        Not recommended for use within your agent runtime.
        More for use interacting with runs after the fact
        for data analysis or ETL workloads.

        .. admonition:: Deprecated

            Use :meth:`langsmith.Client.runs.get_url` instead.
            See https://docs.langchain.com/langsmith/smithdb-sdk-migration#runs-get-url for the migration guide.
            Will be removed after Jan 31, 2027.

        Args:
            run (RunBase): The run.
            project_name (Optional[str]): The name of the project.
            project_id (Optional[Union[UUID, str]]): The ID of the project.

        Returns:
            str: The URL for the run.
        )r»  rô  rå  )Ú_construct_run_url)râ  r»  rô  rå  s       re   Úget_run_urlzClient.get_run_urlš  s)   € ðB ×&Ò&Ø ,¸:ð 'ñ 
ô 
ð 	
ri   c               óž  — t          |dd¦  «        x}rn€t          |dd¦  «        x}r|                      |¬¦  «        j        }nQ|�|}nL|�|                      |¬¦  «        j        }n.t          j        ¦   «         }|                      |¬¦  «        j        }t          |d¦  «        }| j        › d|                      ¦   «         › d|› d|j        › d�S )	z“Build a run's UI URL locally, without calling the backend.

        Kept for backends that predate the ``/runs/{run_id}/url`` v2 endpoint.
        rÁ  Nrû  r  z/o/z/projects/p/z/r/z
?poll=true)rÆ  r  rÿ   r¤   r  ra  r  Ú_get_tenant_id)râ  r»  rô  rå  rÁ  rû  Úsession_id_s          re   rG  zClient._construct_run_url¿  s  € õ !  l°DÑ9Ô9Ð9ˆ:ð 
	IØÝ$ S¨.¸$Ñ?Ô?Ð?ˆ\ð 	IØ×*Ò*¸Ð*ÑEÔEÔHˆJˆJØÐ#Ø#ˆJˆJØÐ%Ø×*Ò*¸Ð*ÑEÔEÔHˆJˆJå#Ô6Ñ8Ô8ˆLØ×*Ò*¸Ð*ÑEÔEÔHˆJÝ˜z¨<Ñ8Ô8ˆàŒ~ð $ð $ $×"5Ò"5Ñ"7Ô"7ð $ð $À[ð $ð $Ø”ð$ð $ð $ð	
ri   zÜshare_run() is deprecated and will be removed after Jan 31, 2027. Use client.runs.share.create() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide.)Úshare_idrL  c               ó@  — t          |d¦  «        }t          |¦  «        |pt          t          j        ¦   «         ¦  «        dœ}|                      dd|› d�| j        |¬¦  «        }t          j        |¦  «         |                     ¦   «         d         }| j	        › d|› d	�S )
aR  Get a share link for a run.

        .. admonition:: Deprecated

            Use :meth:`langsmith.Client.runs.share.create` instead.
            See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide.
            Will be removed after Jan 31, 2027.

        Args:
            run_id (Union[UUID, str]): The ID of the run to share.
            share_id (Optional[Union[UUID, str]]): Custom share ID.
                If not provided, a random UUID will be generated.

        Returns:
            str: The URL of the shared run.
        rÀ  )rÀ  Úshare_tokenÚPUTr»  ú/share©r�   rù  rN  ú/public/ú/r)
ra  rW   r[  rð  r/  r  r¤   r0  rù  r  )râ  rÀ  rL  rî  rL  r2  rN  s          re   Ú	share_runzClient.share_runÛ  s±   € õ. ˜6 8Ñ,Ô,ˆå˜'‘l”lØ#Ð8¥s­4¬:©<¬<Ñ'8Ô'8ð
ð 
ˆð ×,Ò,ØØ$�WÐ$Ð$Ð$Ø”MØð	 -ñ 
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5Ø—m’m‘o”o mÔ4ˆØ”.Ð9Ð9¨+Ð9Ð9Ð9Ð9ri   zÞunshare_run() is deprecated and will be removed after Jan 31, 2027. Use client.runs.share.delete() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide.c                óŒ   — |                       ddt          |d¦  «        › d�| j        ¬¦  «        }t          j        |¦  «         dS )a´  Delete share link for a run.

        .. admonition:: Deprecated

            Use :meth:`langsmith.Client.runs.share.delete` instead.
            See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide.
            Will be removed after Jan 31, 2027.

        Args:
            run_id (Union[UUID, str]): The ID of the run to unshare.

        Returns:
            None
        ÚDELETEr»  rÀ  rP  ©r�   N©r/  ra  r  r¤   r0  )râ  rÀ  r2  s      re   Úunshare_runzClient.unshare_run  sW   € ð* ×,Ò,ØØ7•X˜f hÑ/Ô/Ð7Ð7Ð7Ø”Mð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   zøread_run_shared_link() is deprecated and will be removed after Jan 31, 2027. Use client.runs.retrieve(selects=["SHARE_URL"]) instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide.c                óæ   — |                       ddt          |d¦  «        › d�| j        ¬¦  «        }t          j        |¦  «         |                     ¦   «         }|�d|vrdS | j        › d|d         › d	�S )
a-  Retrieve the shared link for a specific run.

        .. admonition:: Deprecated

            Use :meth:`langsmith.Client.runs.retrieve` with ``selects=["SHARE_URL"]`` instead.
            See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide.
            Will be removed after Jan 31, 2027.

        Args:
            run_id (Union[UUID, str]): The ID of the run.

        Returns:
            Optional[str]: The shared link for the run, or None if the link is not
            available.
        r-  r»  rÀ  rP  rW  NrN  rR  rS  )r/  ra  r  r¤   r0  rù  r  )râ  rÀ  r2  r¹  s       re   Úread_run_shared_linkzClient.read_run_shared_link  s�   € ð, ×,Ò,ØØ7•X˜f hÑ/Ô/Ð7Ð7Ð7Ø”Mð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ø—’‘”ˆØˆ>˜]°&Ð8Ð8Ø�4Ø”.ÐCÐC¨&°Ô*?ÐCÐCÐCÐCri   c                óœ   — t          ¦   «         5  |                      t          |d¦  «        ¦  «        }ddd¦  «         n# 1 swxY w Y   |duS )z¼Get share state for a run.

        Args:
            run_id (Union[UUID, str]): The ID of the run.

        Returns:
            bool: True if the run is shared, False otherwise.
        rÀ  N)rÚ  r[  ra  )râ  rÀ  r  s      re   Úrun_is_sharedzClient.run_is_shared>  sž   € õ +Ñ,Ô,ð 	Ið 	IØ×,Ò,­X°f¸hÑ-GÔ-GÑHÔHˆDð	Ið 	Ið 	Iñ 	Iô 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Iøøøð 	Ið 	Ið 	Ið 	Ià˜4ÐÐs   �$?¿AÁAzåread_shared_run() is deprecated and will be removed after Jan 31, 2027. Use client.public.runs.retrieve() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide.rN  úUnion[ID_TYPE, str]c                ó"  — t          |dd¬¦  «        \  }}d|› d�}|�|dt          |d¦  «        › �z  }|                      d	|| j        ¬
¦  «        }t	          j        |¦  «         t          j        di |                     ¦   «         ¤d| j	        i¤ŽS )al  Get shared runs.

        .. admonition:: Deprecated

            Use :meth:`langsmith.Client.public.runs.retrieve` instead.
            See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide.
            Will be removed after Jan 31, 2027.

        Args:
            share_token (Union[UUID, str]): The share token or URL of the shared run.
            run_id (Optional[Union[UUID, str]]): The ID of the specific run to retrieve.
                If not provided, the full shared run will be returned.

        Returns:
            Run: The shared run.
        r‹  r»  ©rV  rR  ú/runNrm   rÀ  r-  rW  r  rh   )
rf  ra  r/  r  r¤   r0  r{  rÕ   rù  r  )râ  rN  rÀ  r  re  r_  r2  s          re   Úread_shared_runzClient.read_shared_runK  s²   € õ2 ,¨K¸À%ÐHÑHÔH‰ˆˆ:Ø*˜*Ð*Ð*Ð*ˆØÐØÐ4� ¨Ñ2Ô2Ð4Ð4Ñ4ˆDØ×,Ò,ØØØ”Mð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5ÝŒ~ÐJÐJ §¢¡¤ÐJÐJ¸4¼>ÐJÐJÐJÐJri   zãlist_shared_runs() is deprecated and will be removed after Jan 31, 2027. Use client.public.runs.query() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide.c              #  ó¸   K  — |rd|ini }t          |dd¬¦  «        \  }}|                      d|› d�|¬¦  «        D ]}t          j        d
i |¤d| j        i¤ŽV — Œd	S )a  Get shared runs.

        .. admonition:: Deprecated

            Use :meth:`langsmith.Client.public.runs.query` instead.
            See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide.
            Will be removed after Jan 31, 2027.

        Args:
            share_token (Union[UUID, str]): The share token or URL of the shared run.
            run_ids (Optional[List[str]]): A list of run IDs to filter the results by.

        Yields:
            A shared run.
        rÿ   r‹  r»  r`  rR  r  r  r  Nrh   )rf  r™  r{  rÕ   r  )râ  rN  r  rÅ  r  re  r»  s          re   Úlist_shared_runszClient.list_shared_runsp  s¢   è è € ð0 #*Ð1��gˆˆ¨rˆÝ+¨K¸À%ÐHÑHÔH‰ˆˆ:Ø×2Ò2Ø.�zÐ.Ð.Ð.°Tð 3ñ 
ô 
ð 	Bð 	BˆCõ ”.ÐAÐA 3ÐAÐA°$´.ÐAÐAÐAÐAÐAÐAÐAð	Bð 	Bri   ©Údataset_nameÚ
dataset_idrf  úls_schemas.DatasetShareSchemac               óŽ  — |€|€t          d¦  «        ‚|€|                      |¬¦  «        j        }|                      ddt	          |d¦  «        › d�| j        ¬¦  «        }t          j        |¦  «         |                     ¦   «         }t          t          j        i |¥d	| j        › d
t	          |d         d¦  «        › d�i¥¦  «        S )a  Retrieve the shared schema of a dataset.

        Args:
            dataset_id (Optional[Union[UUID, str]]): The ID of the dataset.
                Either `dataset_id` or `dataset_name` must be given.
            dataset_name (Optional[str]): The name of the dataset.
                Either `dataset_id` or `dataset_name` must be given.

        Returns:
            ls_schemas.DatasetShareSchema: The shared schema of the dataset.

        Raises:
            ValueError: If neither `dataset_id` nor `dataset_name` is given.
        Nú/Either dataset_id or dataset_name must be givenre  r-  ú
/datasets/rg  rP  rW  rg  rR  rN  zresponse.share_tokenú/d)rï   Úread_datasetrÿ   r/  ra  r  r¤   r0  rù  r   r{  ÚDatasetShareSchemar  )râ  rg  rf  r2  Úds        re   Úread_dataset_shared_schemaz!Client.read_dataset_shared_schema�  sþ   € ð( Ð ,Ð"6ÝÐNÑOÔOÐOØÐØ×*Ò*¸Ð*ÑEÔEÔHˆJØ×,Ò,ØØC� *¨lÑ;Ô;ÐCÐCÐCØ”Mð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ø�MŠM‰OŒOˆÝÝÔ)ðØðà˜$œ.ð Jð JÝ˜A˜mÔ,Ð.DÑEÔEðJð Jð Jðð ñ
ô 
ð 	
ri   c          	     ó–  — |€|€t          d¦  «        ‚|€|                      |¬¦  «        j        }dt          |¦  «        i}|                      ddt          |d¦  «        › d�| j        |¬¦  «        }t          j        |¦  «         | 	                    ¦   «         }t          t          j        i |¥d	| j        › d
|d         › d�i¥¦  «        S )a  Get a share link for a dataset.

        Args:
            dataset_id (Optional[Union[UUID, str]]): The ID of the dataset.
                Either `dataset_id` or `dataset_name` must be given.
            dataset_name (Optional[str]): The name of the dataset.
                Either `dataset_id` or `dataset_name` must be given.

        Returns:
            ls_schemas.DatasetShareSchema: The shared schema of the dataset.

        Raises:
            ValueError: If neither `dataset_id` nor `dataset_name` is given.
        Nrj  re  rg  rO  rk  rP  rQ  rg  rR  rN  rl  )rï   rm  rÿ   rW   r/  ra  r  r¤   r0  rù  r   r{  rn  r  )râ  rg  rf  rL  r2  ro  s         re   Úshare_datasetzClient.share_dataset·  sð   € ð( Ð ,Ð"6ÝÐNÑOÔOÐOØÐØ×*Ò*¸Ð*ÑEÔEÔHˆJà�#˜j™/œ/ð
ˆð ×,Ò,ØØC� *¨lÑ;Ô;ÐCÐCÐCØ”MØð	 -ñ 
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5Ø—-’-‘/”/ˆÝÝÔ)ØIˆqÐI�%˜DœNÐHÐH°A°mÔ4DÐHÐHÐHÐIÐIñ
ô 
ð 	
ri   c                óŒ   — |                       ddt          |d¦  «        › d�| j        ¬¦  «        }t          j        |¦  «         dS )z¨Delete share link for a dataset.

        Args:
            dataset_id (Union[UUID, str]): The ID of the dataset to unshare.

        Returns:
            None
        rV  rk  rg  rP  rW  NrX  )râ  rg  r2  s      re   Úunshare_datasetzClient.unshare_datasetß  sW   € ð ×,Ò,ØØC� *¨lÑ;Ô;ÐCÐCÐCØ”Mð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   c                óþ   — t          || j        ¦  «        \  }}|                      dd|› d�| j        ¬¦  «        }t	          j        |¦  «         t          j        di |                     ¦   «         ¤| j	        d|› d�dœ¤ŽS )zÁGet shared datasets.

        Args:
            share_token (Union[UUID, str]): The share token or URL of the shared dataset.

        Returns:
            Dataset: The shared dataset.
        r-  rR  ú	/datasetsrW  rl  )r  Ú_public_pathrh   )
rf  rk   r/  r  r¤   r0  r{  rµ  rù  r  )râ  rN  r  re  r2  s        re   Úread_shared_datasetzClient.read_shared_datasetï  s¨   € õ ,¨K¸¼ÑFÔF‰ˆˆ:Ø×,Ò,ØØ,�zÐ,Ð,Ð,Ø”Mð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5ÝÔ!ð 
ð 
Ø�mŠm‰oŒoð
à”nØ3 KÐ3Ð3Ð3ð
ð 
ð 
ð 
ð 	
ri   )Úexample_idsr‹  ry  úIterator[ls_schemas.Example]c          	   #  óü   K  — i }|�d„ |D ¦   «         |d<   t          |                      dt          |d¦  «        › d�|¬¦  «        ¦  «        D ]/\  }}t          j        d
i |¤d| j        i¤ŽV — |�|d	z   |k    r dS Œ0dS )aš  Get shared examples.

        Args:
            share_token (Union[UUID, str]): The share token or URL of the shared dataset.
            example_ids (Optional[List[UUID, str]], optional): The IDs of the examples to filter by.
            limit (Optional[int]): Maximum number of examples to return, by default None.

        Returns:
            List[ls_schemas.Example]: The list of shared examples.
        Nc                ó,   — g | ]}t          |¦  «        ‘ŒS rh   rX  )r|   rÿ   s     re   rZ  z/Client.list_shared_examples.<locals>.<listcomp>  s   € Ð:Ð:Ð:¨�C ™GœGÐ:Ð:Ð:ri   rÿ   rR  rN  ú	/examplesr†  r  r[   rh   )r  rŽ  ra  r{  ÚExampler  )râ  rN  ry  r‹  r‡  r   Úexamples          re   Úlist_shared_exampleszClient.list_shared_examples  sÊ   è è € ð" ˆØÐ"Ø:Ð:¨kÐ:Ñ:Ô:ˆF�4‰LÝ#Ø×$Ò$ØJ�8 K°Ñ?Ô?ÐJÐJÐJØð %ñ ô ñ
ô 
ð 	ð 	‰JˆAˆwõ Ô$ÐIÐI wÐIÐI¸$¼.ÐIÐIÐIÐIÐIÐIØÐ  Q¨¡U¨e¢^ ^Ø��øð	ð 	ri   )r  r†  Úname_containsr‹  Údataset_share_tokenr�  ú(Iterator[ls_schemas.TracerSessionResult]c             #  óæ   K  — |||dœ}t          |d¦  «        }t          |                      d|› d�|¬¦  «        ¦  «        D ]/\  }}	t          j        d	i |	¤d| j        i¤ŽV — |�|dz   |k    r dS Œ0dS )
a<  List shared projects.

        Args:
            dataset_share_token (str): The share token of the dataset.
            project_ids (Optional[List[Union[UUID, str]]]): List of project IDs to filter the results, by default None.
            name (Optional[str]): Name of the project to filter the results, by default None.
            name_contains (Optional[str]): Substring to search for in project names, by default None.
            limit (Optional[int]): Maximum number of projects to return, by default None.

        Yields:
            The shared projects.
        )rÿ   r†  r�  r‚  rR  z/datasets/sessionsr†  r  Nr[   rh   )ra  r  rŽ  r{  ÚTracerSessionResultr  )
râ  r‚  r  r†  r�  r‹  r‡  rN  r   Úprojects
             re   Úlist_shared_projectszClient.list_shared_projects&  s¾   è è € ð* $¨TÀMÐRÐRˆÝÐ2Ð4IÑJÔJˆÝ#Ø×$Ò$Ø:˜;Ð:Ð:Ð:Øð %ñ ô ñ
ô 
ð 	ð 	‰JˆAˆwõ Ô0ÐUÐU°7ÐUÐUÀdÄnÐUÐUÐUÐUÐUÐUØÐ  Q¨¡U¨e¢^ ^Ø��øð	ð 	ri   )rš  rC  ÚupsertÚproject_extraÚreference_dataset_idÚnum_examplesÚnum_repetitionsÚevaluator_keysrˆ  r‰  rŠ  r‹  rŒ  r�  úls_schemas.TracerSessionc               óª  — | j         › d�}
|}|r
i |pi ¥d|i¥}|||t          t          j        ¦   «         ¦  «        dœ}i }|rd|d<   |�||d<   |�||d<   |�||d	<   |	r|	|d
<   |                      d|
i | j        ¥ddi¥t          |¦  «        |¬¦  «        }t          j        |¦  «         t          j
        di |                     ¦   «         ¤d| j        i¤ŽS )a‡  Create a project on the LangSmith API.

        Args:
            project_name (str): The name of the project.
            project_extra (Optional[dict]): Additional project information.
            metadata (Optional[dict]): Additional metadata to associate with the project.
            description (Optional[str]): The description of the project.
            upsert (bool, default=False): Whether to update the project if it already exists.
            reference_dataset_id (Optional[Union[UUID, str]): The ID of the reference dataset to associate with the project.
            num_examples (Optional[int]): The expected number of examples that will be
                run against this project. Used by the backend to populate experiment
                progress; sent as a transport-only field and not round-tripped as a
                response field.
            num_repetitions (Optional[int]): The number of repetitions per example.
                Combined with ``num_examples`` to compute expected run count for
                progress tracking. Transport-only.
            evaluator_keys (Optional[list[str]]): Feedback keys produced by the
                row-level evaluators that will run against this project. Used by
                the backend to populate per-evaluator experiment progress.
                Transport-only.

        Returns:
            TracerSession: The created project.
        ú	/sessionsrC  )r†  rÁ  rš  rÿ   Trˆ  NrŠ  r‹  rŒ  r�  r�  rN  r  )r�   rL  r‡  r  rh   )rk   rW   r[  rð  r/  r  r—  r¤   r0  r{  ÚTracerSessionrù  r  )râ  rô  rš  rC  rˆ  r‰  rŠ  r‹  rŒ  r�  rÜ  rÁ  rÅ  r‡  r2  s                  re   Úcreate_projectzClient.create_projectG  s@  € ðJ ”lÐ-Ð-Ð-ˆØˆØð 	<Ø;˜˜ Ð; j°(Ð;Ð;ˆEà ØØ&Ý•d”j‘l”lÑ#Ô#ð	 
ð  
ˆð ˆØð 	$Ø#ˆF�8ÑØÐ+Ø+?ˆDÐ'Ñ(ØÐ#Ø#/ˆD�Ñ ØÐ&Ø&5ˆDÐ"Ñ#Øð 	4Ø%3ˆDÐ!Ñ"Ø×,Ò,ØØØI�t”}ÐI nÐ6HÐIÐIÝ˜TÑ"Ô"Øð -ñ 
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5ÝÔ'ÐTÐT¨(¯-ª-©/¬/ÐTÐTÀTÄ^ÐTÐTÐTÐTri   )r†  rš  rC  r‰  r¨  c               ón  — | j         › dt          |d¦  «        › �}|}|r
i |pi ¥d|i¥}||||r|                     ¦   «         nddœ}	|                      d|i | j        ¥ddi¥t          |	¦  «        ¬	¦  «        }
t          j        |
¦  «         t          j	        di |
 
                    ¦   «         ¤d
| j        i¤ŽS )a,  Update a LangSmith project.

        Args:
            project_id (Union[UUID, str]):
                The ID of the project to update.
            name (Optional[str]):
                The new name to give the project. This is only valid if the project
                has been assigned an end_time, meaning it has been completed/closed.
            description (Optional[str]):
                The new description to give the project.
            metadata (Optional[dict]):
                Additional metadata to associate with the project.
            project_extra (Optional[dict]):
                Additional project information.
            end_time (Optional[datetime.datetime]):
                The time the project was completed.

        Returns:
            TracerSession: The updated project.
        ú
/sessions/rå  rC  N)r†  rÁ  rš  r¨  rº  rN  r  ©r�   rL  r  rh   )rk   ra  rÄ  r/  r  r—  r¤   r0  r{  r‘  rù  r  )râ  rå  r†  rš  rC  r‰  r¨  rÜ  rÁ  rÅ  r2  s              re   Úupdate_projectzClient.update_project‹  s÷   € ð< ”lÐRÐR­h°zÀ<Ñ.PÔ.PÐRÐRˆØˆØð 	<Ø;˜˜ Ð; j°(Ð;Ð;ˆEàØØ&Ø08ÐB˜×*Ò*Ñ,Ô,Ð,¸dð	 
ð  
ˆð ×,Ò,ØØØI�t”}ÐI nÐ6HÐIÐIÝ˜TÑ"Ô"ð	 -ñ 
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5ÝÔ'ÐTÐT¨(¯-ª-©/¬/ÐTÐTÀTÄ^ÐTÐTÐTÐTri   rÌ  c                óº  — | j         �| j         S 	 |                      ddddi¬¦  «        }|                     ¦   «         }t          |t          ¦  «        rFt          |¦  «        dk    r3t          j        di |d         ¤d| j        i¤Ž}|j	        | _         | j         S nA# t          $ r4}t                               dt          |¦  «        d	¬
¦  «         Y d }~nd }~ww xY wd S )Nr-  r�  r‹  r[   r†  r   r  z*Failed to get tenant ID from LangSmith: %sTr	  rh   )r  r/  rù  r  r  rp   r{  r…  r  r»  r@  ra   rñ   r’  )râ  r2  r¹  Útracer_sessionrM  s        re   r¶  zClient._get_optional_tenant_id¼  s  € ØŒ?Ð&Ø”?Ð"ð	Ø×0Ò0Ø�{¨G°Q¨<ð 1ñ ô ˆHð —]’]‘_”_ˆFÝ˜&¥$Ñ'Ô'ð '­C°©K¬K¸!ªO¨OÝ!+Ô!?ð "ð "Ø˜Q”ið"ð "Ø+/¬>ð"ð "ð "�ð #1Ô":�”Ø”Ð&øøÝð 	ð 	ð 	Ý�LŠLØ<½dÀ1¹g¼gÐPTð ñ ô ð ð ð ð ð ð øøøøð	øøøð ˆts   �BB Â
CÂ$*CÃCr¹  c                óZ   — |                       ¦   «         }|€t          j        d¦  «        ‚|S )NzNo tenant ID found)r¶  r¤   rB  )râ  r»  s     re   rJ  zClient._get_tenant_idÐ  s1   € Ø×0Ò0Ñ2Ô2ˆ	ØÐÝÔ)Ð*>Ñ?Ô?Ð?ØÐri   )rå  rô  ©rå  rô  Úinclude_statsr›  úls_schemas.TracerSessionResultc               óè  — d}ddi}|�|dt          |d¦  «        › �z  }n|�||d<   nt          d¦  «        ‚||d	<   |                      d
||¬¦  «        }|                     ¦   «         }t	          |t
          ¦  «        rKt          |¦  «        dk    rt          j        d|› d�¦  «        ‚t          j
        di |d         ¤d| j        i¤ŽS t          j
        di |                     ¦   «         ¤d| j        i¤ŽS )aë  Read a project from the LangSmith API.

        Args:
            project_id (Optional[str]):
                The ID of the project to read.
            project_name (Optional[str]): The name of the project to read.
                Only one of project_id or project_name may be given.
            include_stats (bool, default=False):
                Whether to include a project's aggregate statistics in the response.

        Returns:
            TracerSessionResult: The project.
        r�  r‹  r[   Nrm   rå  r†  ú'Must provide project_name or project_idr›  r-  r†  r   zProject ú
 not foundr  rh   )ra  rï   r/  rù  r  r  rp   r¤   rp  r{  r…  r  )râ  rå  rô  r›  r_  r‡  r2  r¹  s           re   r  zClient.read_projectÖ  s7  € ð* ˆØ")¨1 ˆØÐ!ØÐ<� ¨\Ñ:Ô:Ð<Ð<Ñ<ˆDˆDØÐ%Ø)ˆF�6‰NˆNåÐFÑGÔGÐGØ"/ˆˆÑØ×,Ò,¨U°DÀÐ,ÑHÔHˆØ—’‘”ˆÝ�f�dÑ#Ô#ð 	YÝ�6‰{Œ{˜aÒÐÝÔ5Ø7˜|Ð7Ð7Ð7ñô ð õ Ô1ÐXÐX°F¸1´IÐXÐXÈÌÐXÐXÐXÐXÝÔ-ð 
ð 
Ø�mŠm‰oŒoð
ð 
Ø)-¬ð
ð 
ð 
ð 	
ri   c             ƒ  óp   K  — t          j        t          j        ¦   «         | j        |||¬¦  «        ƒ d{V —†S )aú  Asynchronously read a project from the LangSmith API.

        Args:
            project_id (Optional[str]):
                The ID of the project to read.
            project_name (Optional[str]): The name of the project to read.
                Only one of project_id or project_name may be given.
            include_stats (bool, default=False):
                Whether to include a project's aggregate statistics in the response.

        Returns:
            TracerSessionResult: The project.
        rš  N)Ú
aitertoolsÚaio_to_threadÚcontextvarsÚcopy_contextr  )râ  rå  rô  r›  s       re   Úaread_projectzClient.aread_project   s[   è è € õ(  Ô-ÝÔ$Ñ&Ô&ØÔØ!Ø%Ø'ð
ñ 
ô 
ð 
ð 
ð 
ð 
ð 
ð 
ð 	
ri   ©rå  c               ób   — 	 |                       |¬¦  «         n# t          j        $ r Y dS w xY wdS )a$  Check if a project exists.

        Args:
            project_name (str):
                The name of the project to check for.
            project_id (Optional[str]):
                The ID of the project to check for.

        Returns:
            bool: Whether the project exists.
        r  FT)r  r¤   rp  )râ  rô  rå  s      re   Úhas_projectzClient.has_project  sK   € ð	Ø×Ò¨<ÐÑ8Ô8Ð8Ð8øÝÔ.ð 	ð 	ð 	Ø�5�5ð	øøøàˆts   ‚ ™,«,c               ó`  ‡ — t          j        dt          d¬¦  «         ddlm}m} ddl}t          j        ‰ j	        j
        ¦  «        }|t          j        j        k    rBt          ¦   «         5  ‰                      ||dg d¢¬	¦  «        }ddd¦  «         n# 1 swxY w Y   n¡|€|�‰                      |¬
¦  «        j        }|€t#          d¦  «        ‚‰                      ¦   «         j                             t+          |¦  «        gdg d¢t-          j        dddt,          j        j        ¬¦  «        ¬¦  «        }d„ |D ¦   «         }g }	g }
ˆ fd„}d}d} |¦   «         5 }g }|D �]·}d|j        id„ |j        pi                      ¦   «         D ¦   «         ¥d„ |j        pi                      ¦   «         D ¦   «         ¥|j        r(|j        r!|j        |j        z
                       ¦   «         nd|j         |j        dœ¥}|j!        rn| "                    d„ |j!                             ¦   «         D ¦   «         ¦  «         |j!         #                    d¦  «        x}r| #                    d¦  «        x}r||d<   |j        r|
 $                    |j        ¦  «         n#tJ           &                    d|j        › d�¦  «         tO          |
¦  «        |z  dk    r=|
|||z   …         x}r.| $                    | (                    ||¦  «        ¦  «         ||z  }|	 $                    |¦  «         �Œ¹|
|d…         r1| $                    | (                    ||
|d…         ¦  «        ¦  «         ddd¦  «         n# 1 swxY w Y    |j)        |	¦  «         *                    d¦  «        }d„  ||¦  «        D ¦   «         }|r; |j)        |¦  «         *                    d¦  «        }| +                    |dd¬¦  «        } |j,        t[          t\          t^          t*          t`          f                  | 1                    d ¬!¦  «        ¦  «        ¦  «        S )"a„  Read the record-level information from an experiment into a Pandas DF.

        !!! note

            This will fetch whatever data exists in the DB. Results are not
            immediately available in the DB upon evaluation run completion.

        Feedback score values will be returned as an average across all runs for
        the experiment. Non-numeric feedback scores will be omitted.

        Args:
            project_id (Optional[Union[UUID, str]]): The ID of the project.
            project_name (Optional[str]): The name of the project.

        Returns:
            pd.DataFrame: A dataframe containing the test results.
        z%Function get_test_results is in beta.r6  r¢   r   r=  NT)rÿ   rª  r¾  r¿  rý  r  r¿  r¨  )rå  rô  rÐ  rò  r  z3Either project_id or project_name must be provided.)
ÚIDÚNAMEÚRUN_TYPEÚREFERENCE_EXAMPLE_IDÚINPUTSÚOUTPUTSÚERRORÚFEEDBACK_STATSÚ
START_TIMEÚEND_TIMEiÐ  r[   r$  )r  rÐ  Úselectsr÷  c              3  ó>   K  — | ]}t          j        |¦  «        V — Œd S ry   )r(   Ú_v2_run_to_schemar*  s     re   r	  z*Client.get_test_results.<locals>.<genexpr>  s.   è è € ÐLÐLÀÕ'Ô9¸!Ñ<Ô<ÐLÐLÐLÐLÐLÐLri   c                óH   •— ‰                      | ¬¦  «        }d„ |D ¦   «         S )N)ry  c                ój   — g | ]0}d |j         id„ |j        pi                      ¦   «         D ¦   «         ¥‘Œ1S )Ú
example_idc                ó    — i | ]\  }}d |› �|“ŒS )z
reference.rh   r5  s      re   r€   zNClient.get_test_results.<locals>.fetch_examples.<locals>.<listcomp>.<dictcomp>ˆ  s'   € ÐWÐWÐW©t¨q°!Ð' AÐ'Ð'¨ÐWÐWÐWri   )rÿ   r¿  r‹   ©r|   r  s     re   rZ  zCClient.get_test_results.<locals>.fetch_examples.<locals>.<listcomp>…  s\   € ð ð ð ð
 ð ! '¤*ðàWÐW¸¼Ð8MÈ2×7TÒ7TÑ7VÔ7VÐWÑWÔWððð ð ri   )Úlist_examples)ÚbatchÚexamplesrâ  s     €re   Úfetch_examplesz/Client.get_test_results.<locals>.fetch_examplesƒ  s<   ø€ Ø×)Ò)°eÐ)Ñ<Ô<ˆHðð ð
  (ðñ ô ð ri   rö   r¹  c                ó    — i | ]\  }}d |› �|“ŒS )zinput.rh   r5  s      re   r€   z+Client.get_test_results.<locals>.<dictcomp>”  s$   € ÐLÐLÐL©4¨1¨a�| �|�| QÐLÐLÐLri   c                ó    — i | ]\  }}d |› �|“ŒS )zoutputs.rh   r5  s      re   r€   z+Client.get_test_results.<locals>.<dictcomp>•  s$   € ÐOÐOÐO©T¨Q°�~ !�~�~ qÐOÐOÐOri   )Úexecution_timerý  rÿ   c                ó|   — i | ]9\  }}|d k    r|                      d¦  «        ° d|› �|                      d¦  «        “Œ:S )ÚnoteÚcommentsz	feedback.Úavgrz   r5  s      re   r€   z+Client.get_test_results.<locals>.<dictcomp>   sO   € ð ð ð á $  1Ø$%¨¢K K°A·E²E¸*Ñ4EÔ4E Kð ,¨˜O˜O¨Q¯UªU°5©\¬\à$/ K Kri   rÄ  rÅ  ÚnoteszRun z has no reference example ID.c                ó@   — g | ]}|                      ¦   «         D ]}|‘ŒŒS rh   )r¹  )r|   rA  Úoutputs      re   rZ  z+Client.get_test_results.<locals>.<listcomp>¸  sA   € ð 
ð 
ð 
ØÀVÇ]Â]Á_Ä_ð
ð 
Ø;AˆFð
ð 
ð 
ð 
ri   )Ú
left_indexÚright_indexÚrecords)Úorient)2rª   r«   ÚUserWarningrC  r>  r?  Úpandasr(   rG   rž  r¡  rF   r¢  rÚ  rÛ  r  rÿ   rï   rÃ  rö  rÿ  rW   rÃ  rÍ  rÎ  rª  r¾  r‹   r¿  r¨  r¿  Útotal_secondsrý  r  rD  r{   rë  ra   rb   rp   r>  Ú	DataFrameÚ	set_indexÚmergeÚjson_normalizer   r  r  r   Úto_dict)râ  rå  rô  r>  r?  ÚpdrÝ  rö  ÚpagerÚresultsry  r¿  r¨  r–  rA  rÃ  rÓ  ÚrowÚ
note_statsrÅ  r½  Ú	result_dfÚexample_outputsÚ
example_dfs   `                       re   Úget_test_resultszClient.get_test_results0  s‚  ø€ õ. 	ŒØ3µ[ÈQð	
ñ 	
ô 	
ð 	
ð 	HÐGÐGÐGÐGÐGÐGÐGàÐÐÐå%Ô7¸¼	Ô8PÑQÔQˆØÕ)Ô6ÔCÒCÐCõ /Ñ0Ô0ð ð Ø15·²Ø)Ø!-Ø ð	ð 	ð 	ð	 2@ñ 2ô 2�ðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð øð" Ð! lÐ&>Ø!×.Ò.¸LÐ.ÑIÔIÔL�
ØÐ!Ý Ð!VÑWÔWÐWØ×0Ò0Ñ2Ô2Ô7×=Ò=Ý  ™_œ_Ð-Øðð ð õ  (Ô0Ø˜!˜Q¥xÔ'8Ô'<ð ñ  ô  ð# >ñ ô ˆEð0 MÐLÀeÐLÑLÔLˆDØ ˆØˆð	ð 	ð 	ð 	ð 	ð ˆ
ØˆØÐÑ!Ô!ð '	V XØˆGØð !$ñ !$�à  !Ô"8ðàLÐL°A´H°NÀ×3IÒ3IÑ3KÔ3KÐLÑLÔLðð PÐO°a´i°oÀ2×5LÒ5LÑ5NÔ5NÐOÑOÔOðð œ:ð"Ø*+¬,ð"˜œ a¤lÑ2×AÒAÑCÔCÐCà!àœWØœ$ðð ð �ð Ô#ð 
4Ø—J’Jðð à()Ô(8×(>Ò(>Ñ(@Ô(@ðñ ô ñô ð ð &'Ô%5×%9Ò%9¸&Ñ%AÔ%AÐA�zð 4Ø'1§~¢~°jÑ'AÔ'AÐA˜8ð 4Ø+3˜C ™LØÔ)ð OØ×&Ò& qÔ'=Ñ>Ô>Ð>Ð>å—N’NÐ#M¨!¬$Ð#MÐ#MÐ#MÑNÔNÐNÝ�{Ñ#Ô# jÑ0°AÒ5Ð5à +¨F°V¸jÑ5HÐ,HÔ IÐI�uð -ØŸš x§¢°~ÀuÑ'MÔ'MÑNÔNÐNØ *Ñ,˜Ø—’˜sÑ#Ô#Ð#Ñ#ð ˜6˜7˜7Ô#ð VØ—’˜xŸš¨~¸{È6È7È7Ô?SÑTÔTÑUÔUÐUðO'	Vð '	Vð '	Vñ '	Vô '	Vð '	Vð '	Vð '	Vð '	Vð '	Vð '	Vøøøð '	Vð '	Vð '	Vð '	VðP !�B”L Ñ)Ô)×3Ò3°LÑAÔAˆ	ð
ð 
Ø!- ¨gÑ!6Ô!6ð
ñ 
ô 
ˆð ð 	WØ%˜œ oÑ6Ô6×@Ò@ÀÑNÔNˆJØ"×(Ò(¨¸tÐQUÐ(ÑVÔVˆIð !ˆrÔ Ý••d�3¥˜8”nÔ% y×'8Ò'8À	Ð'8Ñ'JÔ'JÑKÔKñ
ô 
ð 	
s%   Á+BÂBÂBÅG9MÍM Í#M Úreference_dataset_nameÚreference_freeÚdataset_versionúOptional[dict[str, Any]]c              #  óÚ  K  — d|	�t          |	d¦  «        ndi}|�||d<   |�||d<   |�||d<   |�|�t          d¦  «        ‚||d<   n"|� |                      |¬	¦  «        j        }||d<   |�||d
<   |�||d<   |�||d<   |
�t	          j        |
¦  «        |d<   t          |                      d|¬¦  «        ¦  «        D ]/\  }}t          j	        di |¤d| j
        i¤ŽV — |	�|dz   |	k    r dS Œ0dS )a|  List projects from the LangSmith API.

        Args:
            project_ids (Optional[List[Union[UUID, str]]]):
                A list of project IDs to filter by, by default None
            name (Optional[str]):
                The name of the project to filter by, by default None
            name_contains (Optional[str]):
                A string to search for in the project name, by default None
            reference_dataset_id (Optional[List[Union[UUID, str]]]):
                A dataset ID to filter by, by default None
            reference_dataset_name (Optional[str]):
                The name of the reference dataset to filter by, by default None
            reference_free (Optional[bool]):
                Whether to filter for only projects not associated with a dataset.
            limit (Optional[int]):
                The maximum number of projects to return, by default None
            metadata (Optional[Dict[str, Any]]):
                Metadata to filter by.

        Yields:
            The projects.

        Raises:
            ValueError: If both reference_dataset_id and reference_dataset_name are given.
        r‹  Nrj  rÿ   r†  r�  zGOnly one of reference_dataset_id or reference_dataset_name may be givenÚreference_datasetre  rà  r›  rá  rC  r�  r†  r  r[   rh   )r0  rï   rm  rÿ   rù  rú  r  rŽ  r{  r…  r  )râ  r  r†  r�  rŠ  rß  rà  r›  rá  r‹  rC  r‡  r   r†  s                 re   Úlist_projectszClient.list_projectsÄ  sŽ  è è € ðP ¨Ð(9•S˜ ‘_”_�_¸sð"
ˆð Ð"Ø&ˆF�4‰LØÐØ!ˆF�6‰NØÐ$Ø&3ˆF�?Ñ#ØÐ+Ø%Ð1Ý ð;ñô ð ð +?ˆFÐ&Ñ'Ð'Ø#Ð/Ø#'×#4Ò#4Ø3ð $5ñ $ô $äð !ð +?ˆFÐ&Ñ'ØÐ%Ø'5ˆFÐ#Ñ$ØÐ$Ø&3ˆF�?Ñ#ØÐ&Ø(7ˆFÐ$Ñ%ØÐÝ!%¤¨HÑ!5Ô!5ˆF�:ÑÝ#Ø×$Ò$ [¸Ð$Ñ@Ô@ñ
ô 
ð 	ð 	‰JˆAˆwõ Ô0ÐUÐU°7ÐUÐUÀdÄnÐUÐUÐUÐUÐUÐUØÐ  Q¨¡U¨e¢^ ^Ø��øð	ð 	ri   c               ó  — |�)t          |                      |¬¦  «        j        ¦  «        }n|€t          d¦  «        ‚|                      ddt          |d¦  «        › �| j        ¬¦  «        }t          j        |¦  «         dS )am  Delete a project from LangSmith.

        Args:
            project_name (Optional[str]):
                The name of the project to delete.
            project_id (Optional[str]):
                The ID of the project to delete.

        Returns:
            None

        Raises:
            ValueError: If neither project_name or project_id is provided.
        Nr  rž  rV  r”  rå  rW  )	rW   r  rÿ   rï   r/  ra  r  r¤   r0  )râ  rô  rå  r2  s       re   Údelete_projectzClient.delete_project  s’   € ð$ Ð#Ý˜T×.Ò.¸LÐ.ÑIÔIÔLÑMÔMˆJˆJØÐÝÐFÑGÔGÐGØ×,Ò,ØØ=� *¨lÑ;Ô;Ð=Ð=Ø”Mð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   )rš  r›  Úinputs_schemaÚoutputs_schemaÚtransformationsrC  úls_schemas.DataTyperè  ré  rê  ú0Optional[list[ls_schemas.DatasetTransformation]]c               óô  — dt          j        ¦   «         i|pi ¥}||j        |dt          j        ¦   «         i|pi ¥ddœdœ}|�||d<   |�||d<   |�||d<   |                      d	d
i | j        ¥ddi¥t          j        |¦  «        ¬¦  «        }	t          j        |	¦  «         |	 	                    ¦   «         }
|
 
                    d¦  «        p||
d<   t          j        di |
¤| j        |                      ¦   «         dœ¤ŽS )aÈ  Create a dataset in the LangSmith API.

        Args:
            dataset_name (str):
                The name of the dataset.
            description (Optional[str]):
                The description of the dataset.
            data_type (DataType, default=DataType.kv):
                The data type of the dataset.
            inputs_schema (Optional[Dict[str, Any]]):
                The schema definition for the inputs of the dataset.
            outputs_schema (Optional[Dict[str, Any]]):
                The schema definition for the outputs of the dataset.
            transformations (Optional[List[DatasetTransformation]]):
                A list of transformations to apply to the dataset.
            metadata (Optional[dict]):
                Additional metadata to associate with the dataset.

        Returns:
            Dataset: The created dataset.

        Raises:
            requests.HTTPError: If the request to create the dataset fails.
        rÓ  Úsdk)rC  Úsource)r†  r›  rê  rÁ  Nrš  Úinputs_schema_definitionÚoutputs_schema_definitionr�  rv  rN  r  r•  rC  r²  rh   )r×  rØ  r~   r/  r  r&   rú  r¤   r0  rù  r{   r{  rµ  r  r¶  )râ  rf  rš  r›  rè  ré  rê  rC  rR  r2  Újson_responses              re   Úcreate_datasetzClient.create_dataset,  sa  € ðF �vÔ=Ñ?Ô?ÐTÀHÀNÐPRÐTˆà Ø"œØ.ð �vÔ=Ñ?Ô?ðà�~ 2ðð  ðð ð	#
ð #
ˆð Ð"Ø%0ˆG�MÑ"àÐ$Ø2?ˆGÐ.Ñ/àÐ%Ø3AˆGÐ/Ñ0à×,Ò,ØØØI�t”}ÐI nÐ6HÐIÐIÝ”˜wÑ'Ô'ð	 -ñ 
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5à Ÿš™œˆØ$1×$5Ò$5°jÑ$AÔ$AÐ$MÀXˆ�jÑ!ÝÔ!ð 
ð 
Øð
à”nØ×3Ò3Ñ5Ô5ð
ð 
ð 
ð 
ð 	
ri   ©rf  rg  c               ób   — 	 |                       ||¬¦  «         dS # t          j        $ r Y dS w xY w)aG  Check whether a dataset exists in your tenant.

        Args:
            dataset_name (Optional[str]):
                The name of the dataset to check.
            dataset_id (Optional[Union[UUID, str]]):
                The ID of the dataset to check.

        Returns:
            bool: Whether the dataset exists.
        rô  TF)rm  r¤   rp  )râ  rf  rg  s      re   Úhas_datasetzClient.has_datasetu  sJ   € ð"	Ø×Ò¨<ÀJÐÑOÔOÐOØ�4øÝÔ.ð 	ð 	ð 	Ø�5�5ð	øøøs   ‚ ›.­.c               ó  — d}ddi}|�|dt          |d¦  «        › �z  }n|�||d<   nt          d¦  «        ‚|                      d	||¬
¦  «        }|                     ¦   «         }t	          |t
          ¦  «        r^t          |¦  «        dk    rt          j        d|› d�¦  «        ‚t          j
        di |d         ¤| j        |                      ¦   «         dœ¤ŽS t          j
        di |¤| j        |                      ¦   «         dœ¤ŽS )a1  Read a dataset from the LangSmith API.

        Args:
            dataset_name (Optional[str]):
                The name of the dataset to read.
            dataset_id (Optional[Union[UUID, str]]):
                The ID of the dataset to read.

        Returns:
            Dataset: The dataset.
        rv  r‹  r[   Nrm   rg  r†  ú'Must provide dataset_name or dataset_idr-  r†  r   r±  rŸ  r²  rh   )ra  rï   r/  rù  r  r  rp   r¤   rp  r{  rµ  r  r¶  )râ  rf  rg  r_  r‡  r2  r¹  s          re   rm  zClient.read_datasetŒ  sa  € ð$ ˆØ")¨1 ˆØÐ!ØÐ<� ¨\Ñ:Ô:Ð<Ð<Ñ<ˆDˆDØÐ%Ø)ˆF�6‰NˆNåÐFÑGÔGÐGØ×,Ò,ØØØð -ñ 
ô 
ˆð
 —’‘”ˆÝ�f�dÑ#Ô#ð 		Ý�6‰{Œ{˜aÒÐÝÔ5Ø7˜|Ð7Ð7Ð7ñô ð õ Ô%ð ð Ø˜”)ðàœ.Ø×7Ò7Ñ9Ô9ðð ð ð ð õ
 Ô!ð 
ð 
Øð
à”nØ×3Ò3Ñ5Ô5ð
ð 
ð 
ð 
ð 	
ri   Úfrom_versionúUnion[str, datetime.datetime]Ú
to_versionúls_schemas.DatasetDiffInfoc          
     óî  — |€,|€t          d¦  «        ‚|                      |¬¦  «        j        }t          |d¦  «        }|                      dd|› d�| j        t          |t          j        ¦  «        r|                     ¦   «         n|t          |t          j        ¦  «        r|                     ¦   «         n|dœ¬	¦  «        }t          j
        |¦  «         t          j        d
i |                     ¦   «         ¤ŽS )a5  Get the difference between two versions of a dataset.

        Args:
            dataset_id (Optional[Union[UUID, str]]):
                The ID of the dataset.
            dataset_name (Optional[str]):
                The name of the dataset.
            from_version (Union[str, datetime.datetime]):
                The starting version for the diff.
            to_version (Union[str, datetime.datetime]):
                The ending version for the diff.

        Returns:
            DatasetDiffInfo: The difference between the two versions of the dataset.

        Examples:
            ```python
            # Get the difference between two tagged versions of a dataset
            from_version = "prod"
            to_version = "dev"
            diff = client.diff_dataset_versions(
                dataset_name="my-dataset",
                from_version=from_version,
                to_version=to_version,
            )

            # Get the difference between two timestamped versions of a dataset
            from_version = datetime.datetime(2024, 1, 1)
            to_version = datetime.datetime(2024, 2, 1)
            diff = client.diff_dataset_versions(
                dataset_name="my-dataset",
                from_version=from_version,
                to_version=to_version,
            )
            ```
        Nú&Must provide either dataset name or IDre  rg  r-  rk  z/versions/diff)rù  rû  ©r�   r‡  rh   )rï   rm  rÿ   ra  r/  r  r  rÃ  rÄ  r¤   r0  r{  ÚDatasetDiffInforù  )râ  rg  rf  rù  rû  Údsidr2  s          re   Údiff_dataset_versionszClient.diff_dataset_versions¼  s
  € ðX ÐØÐ#Ý Ð!IÑJÔJÐJØ×*Ò*¸Ð*ÑEÔEÔHˆJÝ˜
 LÑ1Ô1ˆØ×,Ò,ØØ-˜Ð-Ð-Ð-Ø”Mõ " ,µÔ0AÑBÔBð&�L×*Ò*Ñ,Ô,Ð,à%õ " *­hÔ.?Ñ@Ô@ð$�J×(Ò(Ñ*Ô*Ð*à#ðð ð	 -ñ 
ô 
ˆõ" 	Ô+¨HÑ5Ô5Ð5ÝÔ)Ð<Ð<¨H¯MªM©O¬OÐ<Ð<Ð<ri   c          	     ó*  — d}|�n-|�|                       |¬¦  «        j        }nt          d¦  «        ‚|                      d|› dt	          |d¦  «        › d�¦  «        }d	„ |j                             ¦   «                              d
¦  «        D ¦   «         }|S )aÖ  Download a dataset in OpenAI Jsonl format and load it as a list of dicts.

        Args:
            dataset_id (Optional[Union[UUID, str]]):
                The ID of the dataset to download.
            dataset_name (Optional[str]):
                The name of the dataset to download.

        Returns:
            list[dict]: The dataset loaded as a list of dicts.

        Raises:
            ValueError: If neither dataset_id nor dataset_name is provided.
        rv  Nre  rø  r-  rm   rg  z
/openai_ftc                ó6   — g | ]}t          j        |¦  «        ‘ŒS rh   )rù  r'  )r|   Úlines     re   rZ  z9Client.read_dataset_openai_finetuning.<locals>.<listcomp>   s"   € ÐRÐRÐR¨•4”:˜dÑ#Ô#ÐRÐRÐRri   rV  )rm  rÿ   rï   r/  ra  ÚtextrŽ  r`  )râ  rg  rf  r_  r2  rR  s         re   Úread_dataset_openai_finetuningz%Client.read_dataset_openai_finetuning  s¯   € ð( ˆØÐ!ØØÐ%Ø×*Ò*¸Ð*ÑEÔEÔHˆJˆJåÐFÑGÔGÐGØ×,Ò,ØØÐDÐD•h˜z¨<Ñ8Ô8ÐDÐDÐDñ
ô 
ˆð SÐR°´×0CÒ0CÑ0EÔ0E×0KÒ0KÈDÑ0QÔ0QÐRÑRÔRˆØˆri   )Údataset_idsr›  rf  Údataset_name_containsrC  r‹  r  r	  úIterator[ls_schemas.Dataset]c             #  ón  K  — d|�t          |d¦  «        ndi}|�||d<   |�||d<   |�||d<   |�||d<   |�t          j        |¦  «        |d<   t          |                      d	|¬
¦  «        ¦  «        D ]B\  }}	t          j        di |	¤| j        |                      ¦   «         dœ¤ŽV — |�|dz   |k    r dS ŒCdS )a  List the datasets on the LangSmith API.

        Args:
            dataset_ids (Optional[List[Union[UUID, str]]]):
                A list of dataset IDs to filter the results by.
            data_type (Optional[str]):
                The data type of the datasets to filter the results by.
            dataset_name (Optional[str]):
                The name of the dataset to filter the results by.
            dataset_name_contains (Optional[str]):
                A substring to search for in the dataset names.
            metadata (Optional[Dict[str, Any]]):
                A dictionary of metadata to filter the results by.
            limit (Optional[int]):
                The maximum number of datasets to return.

        Yields:
            The datasets.
        r‹  Nrj  rÿ   r›  r†  r�  rC  rv  r†  r²  r[   rh   )	r0  rù  rú  r  rŽ  r{  rµ  r  r¶  )
râ  r  r›  rf  r	  rC  r‹  r‡  r   rR  s
             re   Úlist_datasetszClient.list_datasets#  s)  è è € ð< ¨Ð(9•S˜ ‘_”_�_¸sð"
ˆð Ð"Ø&ˆF�4‰LØÐ Ø"+ˆF�;ÑØÐ#Ø)ˆF�6‰NØ Ð,Ø&;ˆF�?Ñ#ØÐÝ!%¤¨HÑ!5Ô!5ˆF�:ÑÝ#Ø×$Ò$ [¸Ð$Ñ@Ô@ñ
ô 
ð 		ð 		‰JˆAˆwõ Ô$ð ð Øðàœ.Ø×7Ò7Ñ9Ô9ðð ð ð ð ð ð ð
 Ð  Q¨¡U¨e¢^ ^Ø��øð		ð 		ri   )rg  rf  c               óæ   — |�|                       |¬¦  «        j        }|€t          d¦  «        ‚|                      ddt	          |d¦  «        › �| j        ¬¦  «        }t          j        |¦  «         dS )a&  Delete a dataset from the LangSmith API.

        Args:
            dataset_id (Optional[Union[UUID, str]]):
                The ID of the dataset to delete.
            dataset_name (Optional[str]):
                The name of the dataset to delete.

        Returns:
            None
        Nre  rþ  rV  rk  rg  rW  )rm  rÿ   rï   r/  ra  r  r¤   r0  )râ  rg  rf  r2  s       re   Údelete_datasetzClient.delete_datasetX  sˆ   € ð$ Ð#Ø×*Ò*¸Ð*ÑEÔEÔHˆJØÐÝÐEÑFÔFÐFØ×,Ò,ØØ=� *¨lÑ;Ô;Ð=Ð=Ø”Mð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   Úas_ofúdatetime.datetimeÚtagc               ó  — |�|                       |¬¦  «        j        }|€t          d¦  «        ‚|                      ddt	          |d¦  «        › d�| j        |                     ¦   «         |dœ¬	¦  «        }t          j        |¦  «         dS )
ay  Update the tags of a dataset.

        If the tag is already assigned to a different version of this dataset,
        the tag will be moved to the new version. The as_of parameter is used to
        determine which version of the dataset to apply the new tags to.
        It must be an exact version of the dataset to succeed. You can
        use the read_dataset_version method to find the exact version
        to apply the tags to.

        Args:
            dataset_id (Optional[Union[UUID, str]]):
                The ID of the dataset to update.
            dataset_name (Optional[str]):
                The name of the dataset to update.
            as_of (datetime.datetime):
                The timestamp of the dataset to apply the new tags to.
            tag (str):
                The new tag to apply to the dataset.

        Returns:
            None

        Examples:
            ```python
            dataset_name = "my-dataset"
            # Get the version of a dataset <= a given timestamp
            dataset_version = client.read_dataset_version(
                dataset_name=dataset_name, as_of=datetime.datetime(2024, 1, 1)
            )
            # Assign that version a new tag
            client.update_dataset_tags(
                dataset_name="my-dataset",
                as_of=dataset_version.as_of,
                tag="prod",
            )
            ```
        Nre  rþ  rO  rk  rg  ú/tags©r  r  rQ  )	rm  rÿ   rï   r/  ra  r  rÄ  r¤   r0  ©râ  rg  rf  r  r  r2  s         re   Úupdate_dataset_tagzClient.update_dataset_tagu  s¦   € ðZ Ð#Ø×*Ò*¸Ð*ÑEÔEÔHˆJØÐÝÐEÑFÔFÐFØ×,Ò,ØØB� *¨lÑ;Ô;ÐBÐBÐBØ”MàŸšÑ*Ô*Øðð ð	 -ñ 
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   )rg  rf  Úsearchr‹  r  ú#Iterator[ls_schemas.DatasetVersion]c          	   #  ó,  K  — |€|                       |¬¦  «        j        }||�t          |d¦  «        nddœ}t          |                      dt          |d¦  «        › d�|¬¦  «        ¦  «        D ]&\  }}t          j        d
i |¤ŽV — |�|d	z   |k    r dS Œ'dS )as  List dataset versions.

        Args:
            dataset_id (Optional[Union[UUID, str]]): The ID of the dataset.
            dataset_name (Optional[str]): The name of the dataset.
            search (Optional[str]): The search query.
            limit (Optional[int]): The maximum number of versions to return.

        Yields:
            The dataset versions.
        Nre  rj  )r  r‹  rk  rg  z	/versionsr†  r[   rh   )rm  rÿ   r0  r  rŽ  ra  r{  ÚDatasetVersion)râ  rg  rf  r  r‹  r‡  r   rî   s           re   Úlist_dataset_versionszClient.list_dataset_versions±  sß   è è € ð& ÐØ×*Ò*¸Ð*ÑEÔEÔHˆJàØ(-Ð(9•S˜ ‘_”_�_¸sð
ð 
ˆõ $Ø×$Ò$ØJ�X j°,Ñ?Ô?ÐJÐJÐJØð %ñ ô ñ
ô 
ð 	ð 	‰JˆAˆwõ Ô+Ð6Ð6¨gÐ6Ð6Ð6Ð6Ð6ØÐ  Q¨¡U¨e¢^ ^Ø��øð	ð 	ri   )rg  rf  r  r  úls_schemas.DatasetVersionc               ó
  — |€|                       |¬¦  «        j        }|r|s|€|€t          d¦  «        ‚|                      ddt	          |d¦  «        › d�||dœ¬	¦  «        }t          j        d
i |                     ¦   «         ¤ŽS )a6  Get dataset version by `as_of` or exact tag.

        Use this to retrieve the dataset version to a timestamp or for a given tag.

        Args:
            dataset_id (Optional[ID_TYPE]): The ID of the dataset.
            dataset_name (Optional[str]): The name of the dataset.
            as_of (Optional[datetime.datetime]): The timestamp of the dataset
                to retrieve.
            tag (Optional[str]): The tag of the dataset to retrieve.

        Returns:
            DatasetVersion: The dataset version.

        Examples:
            ```python
            # Get the latest version of a dataset
            client.read_dataset_version(dataset_name="my-dataset", tag="latest")

            # Get the version of a dataset <= a given timestamp
            client.read_dataset_version(
                dataset_name="my-dataset",
                as_of=datetime.datetime(2024, 1, 1),
            )


            # Get the version of a dataset with a specific tag
            client.read_dataset_version(dataset_name="my-dataset", tag="prod")
            ```
        Nre  z/Exactly one of as_of and tag must be specified.r-  rk  rg  z/versionr  r†  rh   )rm  rÿ   rï   r/  ra  r{  r  rù  r  s         re   Úread_dataset_versionzClient.read_dataset_versionÔ  s­   € ðL ÐØ×*Ò*¸Ð*ÑEÔEÔHˆJØð 	P�cð 	P˜u˜}°°ÝÐNÑOÔOÐOØ×,Ò,ØØE� *¨lÑ;Ô;ÐEÐEÐEØ"¨3Ð/Ð/ð -ñ 
ô 
ˆõ
 Ô(Ð;Ð;¨8¯=ª=©?¬?Ð;Ð;Ð;ri   )Úsource_api_urlrf  Útoken_or_urlr  c               óà  — |p| j         }t          ||¦  «        \  }}t          |d¬¦  «        }|                     |¦  «        }|p|j        }	 |                      |¬¦  «        }t                               d|› d�¦  «         |S # t          j	        $ r Y nw xY w	 t          |                     |¦  «        ¦  «        }|                      ||j        |j        pt          j        j        |j        |j        |j        ¬¦  «        }	 |                      d„ |D ¦   «         d„ |D ¦   «         |j        ¬	¦  «         n2# t.          $ r%}	t                               d
|› d�¦  «         |	‚d}	~	ww xY w	 ~n# ~w xY w|S )a�  Clone a public dataset to your own langsmith tenant.

        This operation is idempotent. If you already have a dataset with the given name,
        this function will do nothing.

        Args:
            token_or_url (str): The token of the public dataset to clone.
            source_api_url (Optional[str]): The URL of the langsmith server where the data is hosted.
                Defaults to the API URL of your current client.
            dataset_name (Optional[str]): The name of the dataset to create in your tenant.
                Defaults to the name of the public dataset.

        Returns:
            Dataset: The cloned dataset.
        Úplaceholder)rk   r’  re  r±  z) already exists in your tenant. Skipping.)rf  rš  r›  rè  ré  rê  c                ó   — g | ]	}|j         ‘Œ
S rh   )r¾  ©r|   rM  s     re   rZ  z/Client.clone_public_dataset.<locals>.<listcomp><  s   € Ð7Ð7Ð7¨˜AœHÐ7Ð7Ð7ri   c                ó   — g | ]	}|j         ‘Œ
S rh   )r¿  r$  s     re   rZ  z/Client.clone_public_dataset.<locals>.<listcomp>=  s   € Ð9Ð9Ð9¨1˜QœYÐ9Ð9Ð9ri   )r¾  r¿  rg  z)An error occurred while creating dataset z . You should delete it manually.N)rk   rf  r�   rx  r†  rm  ra   rž  r¤   rp  r  r€  ró  rš  r›  r{  ÚDataTypeÚkvrè  ré  rê  Úcreate_examplesrÿ   r1  rý  )
râ  r   r  rf  re  Úsource_clientÚdsr¾  rR  rM  s
             re   Úclone_public_datasetzClient.clone_public_dataset  sò  € ð, (Ð7¨4¬<ˆÝ%8¸À~Ñ%VÔ%VÑ"ˆ˜
Ýð #Ø!ð
ñ 
ô 
ˆð ×.Ò.¨zÑ:Ô:ˆØ#Ð. r¤wˆð	Ø×"Ò"°Ð"Ñ=Ô=ˆBÝ�KŠKØR˜<ÐRÐRÐRñô ð ð ˆIøÝÔ.ð 	ð 	ð 	ØˆDð	øøøð	å˜M×>Ò>¸zÑJÔJÑKÔKˆHØ×)Ò)Ø)ØœNØœ,Ð@­*Ô*=Ô*@Ø Ô.Ø!Ô0Ø "Ô 2ð *ñ ô ˆGðØ×$Ò$Ø7Ð7¨hÐ7Ñ7Ô7Ø9Ð9°Ð9Ñ9Ô9Ø&œzð %ñ ô ð ð øõ
 !ð 
ð 
ð 
õ —’ð5Àð 5ð 5ð 5ñô ð ð �øøøøð
øøøðð" �ø�ÐÐÐÐØˆsC   Á5B ÂBÂBÂA'E( Ä1D3 Ä2E( Ä3
E"Ä= EÅE"Å"E( Å(E+c                ó<   — |                       |¬¦  «        }|j        S )N)rg  )rm  r›  )râ  rg  rR  s      re   r�  zClient._get_data_typeO  s!   € Ø×#Ò#¨zÐ#Ñ:Ô:ˆØÔ Ð ri   rL  Ú
generationÚ
created_atúls_schemas.Examplec                ó>   — |                       d|id|i|||¬¦  «        S )aF  Add an example (row) to an LLM-type dataset.

        Args:
            prompt (str):
                The input prompt for the example.
            generation (Optional[str]):
                The output generation for the example.
            dataset_id (Optional[Union[UUID, str]]):
                The ID of the dataset.
            dataset_name (Optional[str]):
                The name of the dataset.
            created_at (Optional[datetime.datetime]):
                The creation timestamp of the example.

        Returns:
            Example: The created example
        ÚinputrÉ  ©r¾  r¿  rg  rf  r.  )Úcreate_example)râ  rL  r-  rg  rf  r.  s         re   Úcreate_llm_examplezClient.create_llm_exampleS  s:   € ð4 ×"Ò"Ø˜VÐ$Ø˜zÐ*Ø!Ø%Ø!ð #ñ 
ô 
ð 	
ri   Úmessagesú:list[Union[Mapping[str, Any], ls_schemas.BaseMessageLike]]Úgenerationsú>Optional[Union[Mapping[str, Any], ls_schemas.BaseMessageLike]]c           	     ó   — g }|D ]~}t          j        |¦  «        r@|                     t          j        t	          t
          j        |¦  «        ¦  «        ¦  «         ŒV|                     t	          t          |¦  «        ¦  «         Œd}|�Vt          j        |¦  «        r-t          j        t	          t
          j        |¦  «        ¦  «        }nt	          t          |¦  «        }|                      d|i|�d|ind|||¬¦  «        S )a›  Add an example (row) to a Chat-type dataset.

        Args:
            messages (List[Union[Mapping[str, Any], BaseMessageLike]]):
                The input messages for the example.
            generations (Optional[Union[Mapping[str, Any], BaseMessageLike]]):
                The output messages for the example.
            dataset_id (Optional[Union[UUID, str]]):
                The ID of the dataset.
            dataset_name (Optional[str]):
                The name of the dataset.
            created_at (Optional[datetime.datetime]):
                The creation timestamp of the example.

        Returns:
            Example: The created example
        Nr1  rÉ  r2  )	r¤   Úis_base_message_likerë  Úconvert_langchain_messager   r{  ÚBaseMessageLiker  r3  )	râ  r5  r7  rg  rf  r.  Úfinal_inputÚmessageÚfinal_generationss	            re   Úcreate_chat_examplezClient.create_chat_exampleu  s$  € ð8 ˆØð 	8ð 	8ˆGÝÔ,¨WÑ5Ô5ð 8Ø×"Ò"ÝÔ6Ý�ZÔ7¸ÑAÔAñô ñô ð ð ð ×"Ò"¥4­¨gÑ#6Ô#6Ñ7Ô7Ð7Ð7Ø ÐØÐ"ÝÔ,¨[Ñ9Ô9ð <Ý$,Ô$FÝ�Ô3°[ÑAÔAñ%ô %Ð!Ð!õ %)­¨{Ñ$;Ô$;Ð!Ø×"Ò"Ø˜[Ð)à1BÐ1N�Ð,Ð-Ð-ÐTXà!Ø%Ø!ð #ñ 
ô 
ð 	
ri   c                ór  — |€|                       |¬¦  «        j        }d}|                      |¦  «        }|t          j        j        k    rÈ|j        dk    rt          d|j        › d�¦  «        ‚	 t          j	        |j
        ¦  «        }n-# t          $ r  t          d|j        › d|j
        › �¦  «        ‚w xY wd|i}|j        sd}�n[	 t          j        |j        ¦  «        }	n-# t          $ r  t          d	|j        › d
|j        › �¦  «        ‚w xY wd|	i}�n|t          j        j        k    rÁ|j        dk    rt          d|j        › d�¦  «        ‚	 dt          j        |j
        ¦  «        i}n-# t          $ r  t          d|j        › d|j
        › �¦  «        ‚w xY w|j        sd}n�	 dt          j        |j        ¦  «        i}nd# t          $ r  t          d|j        › d
|j        › �¦  «        ‚w xY w|t          j        j        k    r|j
        }|j        }nt          d|› d�¦  «        ‚|                      |||||¬¦  «        S )a¦  Add an example (row) to a dataset from a run.

        Args:
            run (Run): The run to create an example from.
            dataset_id (Optional[Union[UUID, str]]): The ID of the dataset.
            dataset_name (Optional[str]): The name of the dataset.
            created_at (Optional[datetime.datetime]): The creation timestamp of the example.

        Returns:
            Example: The created example
        Nre  rn  z	Run type z+ is not supported for dataset of type 'LLM'z2Error converting LLM run inputs to prompt for run z with inputs r1  z7Error converting LLM run outputs to generation for run z with outputs rÉ  z, is not supported for dataset of type 'chat'z9Error converting LLM run inputs to chat messages for run z=Error converting LLM run outputs to chat generations for run zDataset type z not recognized.r2  )rm  rÿ   r  r{  r&  rn  rÃ  rï   r¤   Úget_prompt_from_inputsr¾  r¿  Úget_llm_generation_from_outputsÚchatÚget_messages_from_inputsÚ#get_message_generation_from_outputsr'  r3  )
râ  r»  rg  rf  r.  Údataset_typerL  r¾  r¿  r-  s
             re   Úcreate_example_from_runzClient.create_example_from_run­  s5  € ð$ ÐØ×*Ò*¸Ð*ÑEÔEÔHˆJØˆLØ×1Ò1°*Ñ=Ô=ˆØ�:Ô.Ô2Ò2Ð2ØŒ|˜uÒ$Ð$Ý ð1 ¤ð 1ð 1ð 1ñô ð ðÝ!Ô8¸¼ÑDÔD��øÝð ð ð Ý ð:Øœð:ð :Ø-0¬Zð:ð :ñô ð ðøøøð
 '.¨vÐ%6ˆFØ”;ð 
1Ø48�‘ðÝ!)Ô!IÈ#Ì+Ñ!VÔ!V�J�JøÝ!ð ð ð Ý$ð@ØœFð@ð @Ø25´+ð@ð @ñô ð ðøøøð
 $ ZÐ0�‘Ø�ZÔ0Ô5Ò5Ð5ØŒ|˜uÒ$Ð$Ý ð2 ¤ð 2ð 2ð 2ñô ð ðØ!¥8Ô#DÀSÄZÑ#PÔ#PÐQ��øÝð ð ð Ý ð:Øœð:ð :Ø-0¬Zð:ð :ñô ð ðøøøð
 ”;ð Ø��ð
à ¥(Ô"NØœKñ#ô #ð�G�Gøõ
 "ð ð ð Ý$ðHØ$'¤FðHð HØ:=¼+ðHð Hñô ð ðøøøð
 �ZÔ0Ô3Ò3Ð3à”ZˆFØ”kˆGˆGõ ÐK¨\ÐKÐKÐKÑLÔLÐLØ×"Ò"ØØØ!Ø%Ø!ð #ñ 
ô 
ð 	
s0   Á.B Â*B2ÃC Ã*D	ÅE' Å'*FÆF; Æ;*G%r¾  úwUnion[list[ls_schemas.ExampleCreate] | list[ls_schemas.ExampleUpsertWithAttachments] | list[ls_schemas.ExampleUpdate],]Úinclude_dataset_idú/tuple[Any, bytes, dict[str, io.BufferedReader]]c                ó:  — g }i }|r<t          |d         t          j        ¦  «        st          d¦  «        ‚|d         j        }|D �]”}t          |t          j        ¦  «        sCt          |t          j        ¦  «        s)t          |t          j        ¦  «        st          d¦  «        ‚|j        �t          |j        ¦  «        }n t          t          j
        ¦   «         ¦  «        }t          |t          j        ¦  «        rd }	n|j        }	t          |t          j        ¦  «        r|j        }
|j        }|j        }nd\  }
}}i |rd|ini ¥|	�d|	ini ¥|
rd|
ini ¥|rd|ini ¥|rd	|ini ¥}|j        �
|j        |d
<   |j        �
|j        |d<   t#          |¦  «        }|                     |› d |di ff¦  «         |j        �2t#          |j        ¦  «        }|                     |› d�d |di ff¦  «         |j        �2t#          |j        ¦  «        }|                     |› d�d |di ff¦  «         |j        �rZ|j                             ¦   «         D �]?\  }}t          |t.          ¦  «        r|d         }|d         }n|\  }}t          |t0          ¦  «        rÇ|r¶	 t2          j                             |¦  «        }t9          |d¦  «        }n,# t:          $ r t<                               d||¦  «         Y Œ¡w xY w||t          |¦  «        t          t          j
        ¦   «         ¦  «        z   <   |                     |› d|› �d ||› d|› �i ff¦  «         Œþt          d¦  «        ‚|                     |› d|› �d ||› dtA          |¦  «        › �i ff¦  «         �ŒAt          |t          j        ¦  «        r9|j!        r2t#          |j!        ¦  «        }|                     |› d�d |di ff¦  «         �Œ–tE          j#        |tH          ¬¦  «        }|j         dk    r| %                    ¦   «         }n|}|||fS )Nr   zWThe examples must be of type ExampleUpsertWithAttachments if include_dataset_id is Truez[The examples must be of type ExampleCreate or ExampleUpsertWithAttachments or ExampleUpdate©NNNrg  r.  Úuse_source_run_ioÚuse_source_run_attachmentsÚsource_run_idrC  r`  r  z.inputsz.outputsÚ	mime_typerL  r­  z,Attachment file not found for example %s: %sz.attachment.z	; length=zMdangerously_allow_filesystem must be True to upload files from the filesystemz.attachments_operationsrŽ  r�  )&r  r{  ÚExampleUpsertWithAttachmentsrï   rg  ÚExampleCreateÚExampleUpdaterÿ   rW   r[  rð  r.  rN  rO  rP  rC  r`  r—  rë  r¾  r¿  rþ  r‹   r  r   rŒ  r_  Úgetsizer´  ÚFileNotFoundErrorra   rb   rp   Úattachments_operationsr•  r–  r1   r—  )râ  r¾  rJ  r   rz  r{  rg  r  r¹  r.  rN  rO  rP  Úexample_bodyÚvalbÚinputsbÚoutputsbr†  rú  rQ  Úattachment_dataÚ	file_sizer®  Úattachments_operationsbr�  rL  s                             re   Ú_prepare_multipart_datazClient._prepare_multipart_data  sx  € ð &(ˆØ:<ÐØð 	0Ý˜h qœk­:Ô+RÑSÔSð Ý ð5ñô ð ð " !œÔ/ˆJàð _	ñ _	ˆGå˜w­
Ô(@ÑAÔAð	å" 7­JÔ,SÑTÔTð	õ # 7­JÔ,DÑEÔEð	õ
 !ð(ñô ð ð
 ŒzÐ%Ý  ¤™_œ_�
�
å ¥¤¡¤Ñ.Ô.�
å˜'¥:Ô#;Ñ<Ô<ð 0Ø!�
�
à$Ô/�
å˜'¥:Ô#;Ñ<Ô<ð 	Ø$+Ô$=Ð!Ø-4Ô-OÐ*Ø 'Ô 5��ðPÑLÐ!Ð#=¸}ðØ1CÐK�L *Ð-Ð-Èðà1;Ð1G�L *Ð-Ð-ÈRðð
 )ðÐ(Ð*;Ð<Ð<àðð 2ðÐ1Ð3MÐNÐNàðð 8EÐL�O ]Ð3Ð3È"ðˆLð ÔÐ+Ø+2Ô+;�˜ZÑ(ØŒ}Ð(Ø(/¬�˜WÑ%Ý˜|Ñ,Ô,ˆDà�LŠLà!�OàØØ*Øð	ðñ
ô 
ð 
ð Œ~Ð)Ý% g¤nÑ5Ô5�Ø—’à%Ð.Ð.Ð.à Ø#Ø.Øð	ðñ
ô 
ð 
ð ŒÐ*Ý& w¤Ñ7Ô7�Ø—’à%Ð/Ð/Ð/à Ø$Ø.Øð	ðñ
ô 
ð 
ð Ô"ñ 1Ø(/Ô(;×(AÒ(AÑ(CÔ(Cð 0ñ 0Ñ$�D˜*Ý! *­dÑ3Ô3ð @Ø$.¨{Ô$;˜	Ø*4°VÔ*<˜˜à5?Ñ2˜	 ?Ý! /µ4Ñ8Ô8ð *Ø7ð ð	)Ý,.¬G¯OªO¸OÑ,LÔ,L 	Ý'+¨O¸TÑ'BÔ'B  øÝ#4ð )ð )ð )Ý &§¢Ø$RØ$.Ø$3ñ!"ô !"ð !"ð
 !) ð)øøøð !%ð .Ý # OÑ 4Ô 4µs½4¼:¹<¼<Ñ7HÔ7HÑ Hñð "ŸLšLà'1Ð$EÐ$E¸tÐ$EÐ$Eà(,Ø(,Ø+4Ð(JÐ(J¸yÐ(JÐ(JØ(*ð	%&ð!"ñ
ô 
ð 
ð 
õ #-Ø oñ#ô #ð ð Ÿšà#-Ð AÐ A¸4Ð AÐ Aà$(Ø$3Ø'0Ð$QÐ$Q½3¸Ñ;OÔ;OÐ$QÐ$QØ$&ð	!"ðñ
ô 
ð 
ñ 
õ ˜7¥JÔ$<Ñ=Ô=ðàÔ2ðõ +6°gÔ6TÑ*UÔ*UÐ'Ø—’à%Ð>Ð>Ð>à Ø3Ø.Øð	ðñ
ô 
ð 
ùõ !Ô1°%Å)ÐLÑLÔLˆØŒ;˜*Ò$Ð$Ø×$Ò$Ñ&Ô&ˆDˆDàˆDà˜Ð/Ð/Ð/s   Ê/J>Ê>&K'Ë&K')Úupdatesr   r`  ú(Optional[list[ls_schemas.ExampleUpdate]]ú!ls_schemas.UpsertExamplesResponsec               ó2   — |                       |||¬¦  «        S )z“Update examples using multipart.

        .. deprecated:: 0.3.9

            Use Client.update_examples instead. Will be removed in 0.4.0.
        ©rg  r`  r   )Ú_update_examples_multipart)râ  rg  r`  r   s       re   Úupdate_examples_multipartz Client.update_examples_multipartÃ  ó*   € ð ×.Ò.Ø!ØØ)Eð /ñ 
ô 
ð 	
ri   c               ó6  — | j         j        pi                      dd¦  «        st          d¦  «        ‚|€g }|                      |d|¬¦  «        \  }}}	 |                      dt          | j        |¦  «        |i | j        ¥d|j	        i¥dœ¬	¦  «        }t          j        |¦  «         t          t          |                     ¦   «         ¦  «        ¦  «         n3# t          t          |                     ¦   «         ¦  «        ¦  «         w xY w|                     ¦   «         S )
a;  Update examples using multipart.

        Args:
            dataset_id (Union[UUID, str]): The ID of the dataset to update.
            updates (Optional[List[ExampleUpdate]]): The updates to apply to the examples.

        Raises:
            ValueError: If the multipart examples endpoint is not enabled.
        Ú"dataset_examples_multipart_enabledFz¬Your LangSmith deployment does not allow using the latest examples endpoints, please upgrade your deployment to the latest version or downgrade your SDK to langsmith<0.3.9.N©rJ  r   rº  rN  r  r”  ©rž  r¡  r{   rï   r_  r/  Ú_dataset_examples_pathrk   r  rš  r¤   r0  r  r  r  rù  )râ  rg  r`  r   r�  rL  r{  r2  s           re   re  z!Client._update_examples_multipartÖ  sK  € ð  ”	Ô(Ð.¨B×3Ò3Ø0°%ñ
ô 
ð 	õ ð&ñô ð ð
 ˆ?ØˆGà+/×+GÒ+GØØ$Ø)Eð ,Hñ ,
ô ,
Ñ(ˆ�Ð(ð	;Ø×0Ò0ØÝ& t¤|°ZÑ@Ô@à ð Øœ-ð à&¨Ô(<ð ð  ð ð  ð 1ñ 
ô 
ˆHõ Ô/°Ñ9Ô9Ð9å�Ð/×6Ò6Ñ8Ô8Ñ9Ô9Ñ:Ô:Ð:Ð:ø�L�Ð/×6Ò6Ñ8Ô8Ñ9Ô9Ñ:Ô:Ð:Ð:øøøØ�}Š}‰ŒÐó   ÁAC Ã0D)Úuploadsr   rn  ú(Optional[list[ls_schemas.ExampleCreate]]c               ó2   — |                       |||¬¦  «        S )z“Upload examples using multipart.

        .. deprecated:: 0.3.9

            Use Client.create_examples instead. Will be removed in 0.4.0.
        ©rg  rn  r   )Ú_upload_examples_multipart)râ  rg  rn  r   s       re   Úupload_examples_multipartz Client.upload_examples_multipart  rg  ri   r  úls_schemas.ExampleCreatec                óv  — d}|j         r$|t          t          |j         ¦  «        ¦  «        z  }|j        r$|t          t          |j        ¦  «        ¦  «        z  }|j        r$|t          t          |j        ¦  «        ¦  «        z  }|j        r®|j                             ¦   «         D ]”\  }}t          |t          ¦  «        r	|d         }n|\  }}t          |t          ¦  «        r@	 |t          j                             |¦  «        z  }n.# t          t          f$ r |dz  }Y nw xY w|t          |¦  «        z  }|dz  }Œ•|S )z?Estimate the size of an example in bytes for batching purposes.rZ  rL  ri  éÈ   )r¾  rp   r—  r¿  rC  rþ  r‹   r  r  r   rŒ  r_  rU  rV  ÚOSError)râ  r  Úsizer  rú  r\  s         re   Ú_estimate_example_sizezClient._estimate_example_size  sU  € àˆàŒ>ð 	5Ø•C� G¤NÑ3Ô3Ñ4Ô4Ñ4ˆDØŒ?ð 	6Ø•C� G¤OÑ4Ô4Ñ5Ô5Ñ5ˆDØÔð 	7Ø•C� GÔ$4Ñ5Ô5Ñ6Ô6Ñ6ˆDð Ôð 	Ø!(Ô!4×!:Ò!:Ñ!<Ô!<ð ð ‘��:Ý˜j­$Ñ/Ô/ð 4Ø&0°Ô&8�O�Oà)3Ñ&�A�å˜o­tÑ4Ô4ð 1ð*Ø¥¤§¢°Ñ @Ô @Ñ@˜˜øÝ-­wÐ7ð *ð *ð *Ø 	Ñ)˜˜˜ð*øøøð �C Ñ0Ô0Ñ0�DØ˜‘��àˆs   Ã""DÄDÄDr�  úlist[ls_schemas.ExampleCreate]ú$list[list[ls_schemas.ExampleCreate]]c                óh  — g }g }d}|D ]‘}|                       |¦  «        }||k    r2|r|                     |¦  «         g }d}|                     |g¦  «         ŒO||z   |k    }|r|r|                     |¦  «         |g}|}Œw|                     |¦  «         ||z  }Œ’|r|                     |¦  «         |S )zBatch examples by size limits.r   )ry  rë  )	râ  r¾  rC  ÚbatchesÚcurrent_batchÚcurrent_sizer  Úexample_sizeÚsize_exceededs	            re   Ú_batch_examples_by_sizezClient._batch_examples_by_size9  s   € ð ˆØ8:ˆØˆàð 	-ð 	-ˆGØ×6Ò6°wÑ?Ô?ˆLð Ð2Ò2Ð2à ð %Ø—N’N =Ñ1Ô1Ð1Ø$&�MØ#$�Là—’ ˜yÑ)Ô)Ð)Øà(¨<Ñ7Ð:NÒNˆMð ð - ð -Ø—’˜}Ñ-Ô-Ð-Ø!( 	�Ø+��à×$Ò$ WÑ-Ô-Ð-Ø Ñ,��ð ð 	*Ø�NŠN˜=Ñ)Ô)Ð)àˆri   c               ó6  — | j         j        pi                      dd¦  «        st          d¦  «        ‚|€g }|                      |d|¬¦  «        \  }}}	 |                      dt          | j        |¦  «        |i | j        ¥d|j	        i¥dœ¬	¦  «        }t          j        |¦  «         t          t          |                     ¦   «         ¦  «        ¦  «         n3# t          t          |                     ¦   «         ¦  «        ¦  «         w xY w|                     ¦   «         S )
a  Upload examples using multipart.

        Args:
            dataset_id (Union[UUID, str]): The ID of the dataset to upload to.
            uploads (Optional[List[ExampleCreate]]): The examples to upload.
            dangerously_allow_filesystem (bool): Whether to allow uploading files from the filesystem.

        Returns:
            ls_schemas.UpsertExamplesResponse: The count and ids of the successfully uploaded examples

        Raises:
            ValueError: If the multipart examples endpoint is not enabled.
        ri  Fú…Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.Nrj  r�  rN  r  r”  rk  )râ  rg  rn  r   r�  rL  r{  r2  s           re   rr  z!Client._upload_examples_multipartb  sL  € ð( ”	Ô(Ð.¨B×3Ò3Ø0°%ñ
ô 
ð 	õ ð Xñô ð ð ˆ?ØˆGØ+/×+GÒ+GØØ$Ø)Eð ,Hñ ,
ô ,
Ñ(ˆ�Ð(ð	;Ø×0Ò0ØÝ& t¤|°ZÑ@Ô@à ð Øœ-ð à&¨Ô(<ð ð  ð ð  ð 1ñ 
ô 
ˆHõ Ô/°Ñ9Ô9Ð9å�Ð/×6Ò6Ñ8Ô8Ñ9Ô9Ñ:Ô:Ð:Ð:ø�L�Ð/×6Ò6Ñ8Ô8Ñ9Ô9Ñ:Ô:Ð:Ð:øøøØ�}Š}‰ŒÐrm  )Úupsertsr   r…  ú7Optional[list[ls_schemas.ExampleUpsertWithAttachments]]c               ó`  — | j         j        pi                      dd¦  «        st          d¦  «        ‚|€g }|                      |d|¬¦  «        \  }}}	 |                      d| j        dd…         d	k    r| j        d
d…         dk    rdnd|i | j        ¥d|j        i¥dœ¬¦  «        }t          j
        |¦  «         t          t          |                     ¦   «         ¦  «        ¦  «         n3# t          t          |                     ¦   «         ¦  «        ¦  «         w xY w|                     ¦   «         S )zªUpsert examples.

        .. deprecated:: 0.3.9

            Use Client.create_examples and Client.update_examples instead. Will be
            removed in 0.4.0.
        Úexamples_multipart_enabledFr„  NTrj  r�  éýÿÿÿú/v1éüÿÿÿz/v1/z/v1/platform/examples/multipartz/platform/examples/multipartrN  r  r”  )rž  r¡  r{   rï   r_  r/  rk   r  rš  r¤   r0  r  r  r  rù  )râ  r…  r   r�  rL  r{  r2  s          re   Úupsert_examples_multipartz Client.upsert_examples_multipart•  sw  € ð ”	Ô(Ð.¨B×3Ò3Ø(¨%ñ
ô 
ð 	õ ð Xñô ð ð ˆ?ØˆGà+/×+GÒ+GØØ#Ø)Eð ,Hñ ,
ô ,
Ñ(ˆ�Ð(ð	;Ø×0Ò0Øð ”| B C CÔ(¨EÒ1Ð1°d´lÀ2À3À3Ô6GÈ6Ò6QÐ6Qð 6Ð5à7ð !ð Øœ-ð à&¨Ô(<ð ð  ð ð  ð 1ñ ô ˆHõ Ô/°Ñ9Ô9Ð9å�Ð/×6Ò6Ñ8Ô8Ñ9Ô9Ñ:Ô:Ð:Ð:ø�L�Ð/×6Ò6Ñ8Ô8Ñ9Ô9Ñ:Ô:Ð:Ð:øøøØ�}Š}‰ŒÐs   ÁA'C) Ã)0D)rf  rg  r¾  r   Úmax_concurrencyú3Optional[Sequence[ls_schemas.ExampleCreate | dict]]r�  ú!Annotated[int, Field(ge=1, le=3)]ú2ls_schemas.UpsertExamplesResponse | dict[str, Any]c               óR  — d|cxk    rdk    sn t          d¦  «        ‚|r4|r2d                     d„ |D ¦   «         ¦  «        }t          d|› d�¦  «        ‚h d£}|rDt          |¦  «                             |¦  «        x}	r t          d	t	          |	¦  «        › d
�¦  «        ‚|s|st          d¦  «        ‚|s|                      |¬¦  «        j        }|rd„ |D ¦   «         }
�n„|                     d¦  «        }|st          d¦  «        ‚t          |¦  «        }| 	                    ¦   «         D ]@\  }}|�9t          |¦  «        |k    r&t          d|› dt          |¦  «        › d|› d�¦  «        ‚ŒAd„ t          ||                     d¦  «        pd„ t          |¦  «        D ¦   «         |                     d¦  «        pd„ t          |¦  «        D ¦   «         |                     d¦  «        pd„ t          |¦  «        D ¦   «         |                     d¦  «        pd„ t          |¦  «        D ¦   «         |                     d¦  «        pd„ t          |¦  «        D ¦   «         ¦  «        D ¦   «         }
|
st          j        g d d¬!¦  «        S |                      |
¦  «        }|                      ||||¦  «        S )"að  Create examples in a dataset.

        Args:
            dataset_name (str | None):
                The name of the dataset to create the examples in. Must specify exactly
                one of dataset_name or dataset_id.
            dataset_id (UUID | str | None):
                The ID of the dataset to create the examples in. Must specify exactly
                one of dataset_name or dataset_id
            examples (Sequence[ExampleCreate | dict]):
                The examples to create.
            dangerously_allow_filesystem (bool):
                Whether to allow uploading files from the filesystem.
            **kwargs (Any): Legacy keyword args. Should not be specified if 'examples' is specified.

                - inputs (Sequence[Mapping[str, Any]]): The input values for the examples.
                - outputs (Optional[Sequence[Optional[Mapping[str, Any]]]]): The output values for the examples.
                - metadata (Optional[Sequence[Optional[Mapping[str, Any]]]]): The metadata for the examples.
                - splits (Optional[Sequence[Optional[str | List[str]]]]): The splits for the examples, which are divisions of your dataset such as 'train', 'test', or 'validation'.
                - source_run_ids (Optional[Sequence[Optional[Union[UUID, str]]]]): The IDs of the source runs associated with the examples.
                - ids (Optional[Sequence[Union[UUID, str]]]): The IDs of the examples.

        Raises:
            ValueError: If 'examples' and legacy args are both provided.

        Returns:
            The LangSmith JSON response. Includes 'count' and 'example_ids'.

        !!! warning "Behavior changed in `langsmith` 0.3.11"

            Updated to take argument 'examples', a single list where each
            element is the full example to create. This should be used instead of the
            legacy 'inputs', 'outputs', etc. arguments which split each examples
            attributes across arguments.

            Updated to support creating examples with attachments.

        Example:
            ```python
            from langsmith import Client

            client = Client()

            dataset = client.create_dataset("agent-qa")

            examples = [
                {
                    "inputs": {"question": "what's an agent"},
                    "outputs": {"answer": "an agent is..."},
                    "metadata": {"difficulty": "easy"},
                },
                {
                    "inputs": {
                        "question": "can you explain the agent architecture in this diagram?"
                    },
                    "outputs": {"answer": "this diagram shows..."},
                    "attachments": {"diagram": {"mime_type": "image/png", "data": b"..."}},
                    "metadata": {"difficulty": "medium"},
                },
                # more examples...
            ]

            response = client.create_examples(dataset_name="agent-qa", examples=examples)
            # -> {"example_ids": [...
            ```
        r[   r“   z'max_concurrency must be between 1 and 3r¡   c                ó   — g | ]}d |› d �‘Œ	S )r³  rh   )r|   rÕ  s     re   rZ  z*Client.create_examples.<locals>.<listcomp>  s    € Ð#=Ð#=Ð#=° H¨ H H HÐ#=Ð#=Ð#=ri   zCannot specify z when 'examples' is specified.>   Úidsr¾  Úsplitsr¿  rC  Úsource_run_idsz(Received unsupported keyword arguments: rÙ  z3Either dataset_id or dataset_name must be provided.re  c                ó^   — g | ]*}t          |t          ¦  «        rt          j        d i |¤Žn|‘Œ+S ©rh   )r  r  r{  rS  ©r|   r  s     re   rZ  z*Client.create_examples.<locals>.<listcomp>/  sM   € ð ð ð àõ 2<¸A½tÑ1DÔ1DÐK•
Ô(Ð-Ð-¨1Ð-Ð-Ð-È!ðð ð ri   r¾  z+Must specify either 'examples' or 'inputs.'Nú
Length of ú (z#) does not match length of inputs (r  c                óŒ   — g | ]A\  }}}}}}t          j        di |||||pt          t          j        ¦   «         ¦  «        |d œ¤Ž‘ŒBS ))r¾  r¿  rC  r`  rÿ   rP  rh   )r{  rS  rW   r[  rð  )r|   Úin_Úout_Ú	metadata_Úsplit_Úid_Úsource_run_id_s          re   rZ  z*Client.create_examples.<locals>.<listcomp>A  s}   € ð ð ð ñ F�C˜˜y¨&°#°~õ Ô(ð 	ð 	à"%Ø#'Ø$-Ø!'Ø!Ð6¥S­¬©¬Ñ%6Ô%6Ø)7ðð ð	ð 	ðð ð ri   r¿  c              3  ó   K  — | ]}d V — Œd S ry   rh   ©r|   r  s     re   r	  z)Client.create_examples.<locals>.<genexpr>N  s"   è è € Ð-MÐ-M°q¨dÐ-MÐ-MÐ-MÐ-MÐ-MÐ-Mri   rC  c              3  ó   K  — | ]}d V — Œd S ry   rh   r£  s     re   r	  z)Client.create_examples.<locals>.<genexpr>O  s"   è è € Ð.NÐ.N¸¨tÐ.NÐ.NÐ.NÐ.NÐ.NÐ.Nri   r”  c              3  ó   K  — | ]}d V — Œd S ry   rh   r£  s     re   r	  z)Client.create_examples.<locals>.<genexpr>P  s"   è è € Ð,LÐ,L°a¨TÐ,LÐ,LÐ,LÐ,LÐ,LÐ,Lri   r“  c              3  ó   K  — | ]}d V — Œd S ry   rh   r£  s     re   r	  z)Client.create_examples.<locals>.<genexpr>Q  s"   è è € Ð)IÐ)I°1¨$Ð)IÐ)IÐ)IÐ)IÐ)IÐ)Iri   r•  c              3  ó   K  — | ]}d V — Œd S ry   rh   r£  s     re   r	  z)Client.create_examples.<locals>.<genexpr>R  s"   è è € Ð4TÐ4T¸a°TÐ4TÐ4TÐ4TÐ4TÐ4TÐ4Tri   r   ©ry  rd   r  )rï   r¨   r  Ú
differencer  rm  rÿ   r{   rp   r‹   Úziprc  r{  ÚUpsertExamplesResponser‚  Ú!_upload_examples_batches_parallel)râ  rf  rg  r¾  r   r�  r�   Ú
kwarg_keysÚsupported_kwargsÚunsupportedrn  r¾  Ú	input_lenÚarg_nameÚ	arg_valuer}  s                   re   r(  zClient.create_examplesÆ  sp  € ðZ �OÐ(Ð(Ò(Ð( qÒ(Ð(Ð(Ð(ÝÐFÑGÔGÐGàð 	�hð 	ØŸšÐ#=Ð#=°fÐ#=Ñ#=Ô#=Ñ>Ô>ˆJÝØL *ÐLÐLÐLñô ð ð
ð 
ð 
Ðð ð 	¥c¨&¡k¤k×&<Ò&<Ð=MÑ&NÔ&NÐN�{ð 	ÝØP½5ÀÑ;MÔ;MÐPÐPÐPñô ð ð ð 	I˜lð 	IÝÐRÑSÔSÐSØð 	IØ×*Ò*¸Ð*ÑEÔEÔHˆJàð &	ðð à!ðñ ô ˆG‰Gð —Z’Z Ñ)Ô)ˆFØð PÝ Ð!NÑOÔOÐOå˜F™œˆIØ'-§|¢|¡~¤~ð ð Ñ#�˜)ØÐ(­S°©^¬^¸yÒ-HÐ-HÝ$ð; Xð ;ð ;µ°Y±´ð ;ð ;Ø.7ð;ð ;ð ;ñô ð øðð õ JMØØ—J’J˜yÑ)Ô)ÐMÐ-MÐ-M½EÀ)Ñ<LÔ<LÐ-MÑ-MÔ-MØ—J’J˜zÑ*Ô*ÐNÐ.NÐ.N½UÀ9Ñ=MÔ=MÐ.NÑ.NÔ.NØ—J’J˜xÑ(Ô(ÐLÐ,LÐ,L½5ÀÑ;KÔ;KÐ,LÑ,LÔ,LØ—J’J˜uÑ%Ô%ÐIÐ)IÐ)I½¸iÑ8HÔ8HÐ)IÑ)IÔ)IØ—J’JÐ/Ñ0Ô0ÐTÐ4TÐ4TÅ5ÈÑCSÔCSÐ4TÑ4TÔ4TñJô Jðñ ô ˆGð* ð 	ÝÔ4ØØØðñ ô ð ð ×.Ò.¨wÑ7Ô7ˆà×5Ò5Ø�ZÐ!=¸ñ
ô 
ð 	
ri   c                óØ  ‡ ‡‡‡— g }d}d }ddl m}  ||¬¦  «        5 Šˆˆˆˆ fd„|D ¦   «         }	t          j        |	¦  «        D ]y}
|
                     ¦   «         }|                     |                     dg ¦  «        ¦  «         ||                     dd¦  «        z  }|                     d¦  «        }|r
|�||k    r|}Œz	 d d d ¦  «         n# 1 swxY w Y   t          j        |||¬¦  «        S )	Nr   )ÚContextThreadPoolExecutor©Úmax_workersc                óJ   •— g | ]}‰                      ‰j        |‰‰¦  «        ‘Œ S rh   )r>  Ú_upload_single_batch)r|   r½  r   rg  rA  râ  s     €€€€re   rZ  z<Client._upload_examples_batches_parallel.<locals>.<listcomp>n  sH   ø€ ð ð ð ð ð —’ØÔ-ØØØ0ñ	ô ðð ð ri   ry  rd   r  r¨  )	Úlangsmith.utilsr´  r¿  r?  r¹  r  r{   r{  r«  )râ  r}  rg  r   r�  Úall_examples_idsÚtotal_countÚlatest_as_ofr´  rÃ  rA  r2  r  rA  s   ` ``         @re   r¬  z(Client._upload_examples_batches_paralleld  sƒ  øøøø€ ð ÐØˆØˆØ=Ð=Ð=Ð=Ð=Ð=à&Ð&°?ÐCÑCÔCð 	)Àxðð ð ð ð ð ð ð %ðñ ô ˆGõ œ/¨'Ñ2Ô2ð )ð )�Ø!Ÿ=š=™?œ?�Ø ×'Ò'¨¯ª°]ÀBÑ(GÔ(GÑHÔHÐHØ˜xŸ|š|¨G°QÑ7Ô7Ñ7�ð !Ÿš WÑ-Ô-�Øð )˜lÐ2°e¸lÒ6JÐ6JØ#(�Løð)ð	)ð 	)ð 	)ñ 	)ô 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)øøøð 	)ð 	)ð 	)ð 	)õ, Ô0Ø(°À<ð
ñ 
ô 
ð 	
s   �B C
Ã
CÃCc           	     ó  ‡— | j         j        pi                      dd¦  «        r2|                      t	          t
          j        ‰¦  «        ||¬¦  «        }|S |D ]-}t          |d¦  «        �d|_        t          j
        d¦  «         Œ.|                      ddi | j        ¥d	d
i¥t          ˆfd„|D ¦   «         ¦  «        ¬¦  «        }t          j        |¦  «         |                     ¦   «         }d„ |D ¦   «         t#          |¦  «        ddœS )zIUpload a single batch of examples (used by both sequential and parallel).ri  Frq  rþ  Nz7Must upgrade your LangSmith version to use attachments.r�  ú/examples/bulkrN  r  c                óX   •— g | ]&}i t          |d ¬¦  «        ¥dt          ‰¦  «        i¥‘Œ'S )T©Úexclude_nonerg  )Ú
dump_modelrW   )r|   Úuploadrg  s     €re   rZ  z/Client._upload_single_batch.<locals>.<listcomp>Ÿ  sU   ø€ ð ð ð ð
 #ð	Ý(¨¸dÐCÑCÔCðà(­#¨j©/¬/ðð ðð ð ri   r•  c                ó   — g | ]
}|d          ‘ŒS r„  rh   )r|   rL  s     re   rZ  z/Client._upload_single_batch.<locals>.<listcomp>«  s   € ÐEÐEÐE¨t  T¤
ÐEÐEÐEri   r¨  )rž  r¡  r{   rr  r   r[  r\  rÆ  rþ  rª   r«   r/  r  r—  r¤   r0  rù  rp   )râ  r½  rg  r   r2  rÃ  Úresponse_datas     `    re   r¸  zClient._upload_single_batch†  s]  ø€ àŒIÔ$Ð*¨×/Ò/Ø0°%ñ
ô 
ð &	ð ×6Ò6Ý¥¤	¨:Ñ6Ô6ØØ-Ið 7ñ ô ˆHð
 ˆOð  ð ð �Ý˜6 =Ñ1Ô1Ð=Ø)-�FÔ&Ý”MØQñô ð øð ×0Ò0ØØ ØM˜4œ=ÐM¨.Ð:LÐMÐMÝ ðð ð ð ð
 ',ðñ ô ñô ð	 1ñ ô ˆHõ Ô/°Ñ9Ô9Ð9Ø$ŸMšM™OœOˆMàEÐE°}ÐEÑEÔEÝ˜]Ñ+Ô+Øðð ð ri   úOptional[Mapping[str, Any]]r`  úOptional[str | list[str]]r¹  rP  rN  rO  c                ó¶  — |€|
st          d¦  «        ‚|€|                      |¬¦  «        j        }t          j        di |||||	|
||dœ¤Ž}|r||_        |r+t          |t          ¦  «        rt          j	        |¦  «        n|nt          j
        ¦   «         |_        | j        j        pi                      dd¦  «        r3|                      ||g¬¦  «         |                      |j        ¬¦  «        S t!          |d	¦  «        �d|_        t%          j        d
¦  «         |                      ddi | j        ¥ddi¥t-          i d„ t/          |¦  «                             ¦   «         D ¦   «         ¥dt          |¦  «        i¥¦  «        ¬¦  «        }t3          j        |¦  «         |                     ¦   «         }t          j        di |¤| j        |                      ¦   «         dœ¤ŽS )a-  Create a dataset example in the LangSmith API.

        Examples are rows in a dataset, containing the inputs
        and expected outputs (or other reference information)
        for a model or chain.

        Args:
            inputs (Mapping[str, Any]):
                The input values for the example.
            dataset_id (Optional[Union[UUID, str]]):
                The ID of the dataset to create the example in.
            dataset_name (Optional[str]):
                The name of the dataset to create the example in.
            created_at (Optional[datetime.datetime]):
                The creation timestamp of the example.
            outputs (Optional[Mapping[str, Any]]):
                The output values for the example.
            metadata (Optional[Mapping[str, Any]]):
                The metadata for the example.
            split (Optional[str | List[str]]):
                The splits for the example, which are divisions
                of your dataset such as 'train', 'test', or 'validation'.
            example_id (Optional[Union[UUID, str]]):
                The ID of the example to create. If not provided, a new
                example will be created.
            source_run_id (Optional[Union[UUID, str]]):
                The ID of the source run associated with this example.
            use_source_run_io (bool):
                Whether to use the inputs, outputs, and attachments from the source run.
            use_source_run_attachments (Optional[List[str]]):
                Which attachments to use from the source run. If use_source_run_io
                is True, all attachments will be used regardless of this param.
            attachments (Optional[Attachments]):
                The attachments for the example.

        Returns:
            Example: The created example.
        Nz/Must provide either inputs or use_source_run_iore  )r¾  r¿  rC  r`  rP  rN  rO  rþ  ri  F)rg  rn  )r¹  rþ  z6Must upgrade your LangSmith version to use attachmentsr�  r}  rN  r  c                ó   — i | ]
\  }}|®||“ŒS ry   rh   r5  s      re   r€   z)Client.create_example.<locals>.<dictcomp>  s   € ÐVÐVÐV¡D A qÈÈ˜1˜aÈÈÈri   rg  r•  r²  rh   )rï   rm  rÿ   r{  rS  r.  r  rW   r[  r\  rð  rž  r¡  r{   rr  Úread_examplerÆ  rþ  rª   r«   r/  r  r—  rÂ  r‹   r¤   r0  rù  r~  r  r¶  )râ  r¾  rg  rf  r.  r¿  rC  r`  r¹  rP  rN  rO  rþ  rL  r2  r¹  s                   re   r3  zClient.create_example°  s=  € ðl ˆ>Ð"3ˆ>ÝÐNÑOÔOÐOàÐØ×*Ò*¸Ð*ÑEÔEÔHˆJåÔ'ð 
ð 
à Ø"Ø$ØØ!.Ø%6Ø.HØ*ð	ð 	ð
ð 
ˆð ð 	)Ø(ˆDŒOð ð¥j°½SÑ&AÔ&AÐQ�TŒY�zÑ"Ô"Ð"ÀzÀzå”‘”ð 	Œð ŒIÔ$Ð*¨×/Ò/Ø0°%ñ
ô 
ð 	ð ×+Ò+°zÈDÈ6Ð+ÑRÔRÐRØ×$Ò$°´Ð$Ñ8Ô8Ð8õ �t˜]Ñ+Ô+Ð7Ø#'�Ô Ý”ÐVÑWÔWÐWØ×0Ò0ØØØM˜4œ=ÐM¨.Ð:LÐMÐMÝ ðØVÐV­J°tÑ,<Ô,<×,BÒ,BÑ,DÔ,DÐVÑVÔVðà$¥c¨*¡o¤oðð ñô ð	 1ñ 
ô 
ˆHõ Ô/°Ñ9Ô9Ð9Ø—]’]‘_”_ˆFÝÔ%ð ð Øðàœ.Ø×7Ò7Ñ9Ô9ðð ð ð ð ri   )r  c               ón  — |                       ddt          |d¦  «        › �d|r|                     ¦   «         ndi¬¦  «        }|                     ¦   «         }t	          |d| j        ¬¦  «        }t          j        di d	„ |                     ¦   «         D ¦   «         ¤|| j	        |  
                    ¦   «         d
œ¤ŽS )aÍ  Read an example from the LangSmith API.

        Args:
            example_id (Union[UUID, str]): The ID of the example to read.
            as_of (Optional[datetime.datetime]): The dataset version tag OR
                timestamp to retrieve the example as of.
                Response examples will only be those that were present at the time
                of the tagged (or timestamped) version.

        Returns:
            Example: The example.
        r-  ú
/examples/r¹  r  Nr†  Úattachment_urlsrê  c                ó&   — i | ]\  }}|d k    ¯||“ŒS ©rÍ  rh   r5  s      re   r€   z'Client.read_example.<locals>.<dictcomp>:  s)   € ÐJÐJÐJ™˜˜1°1Ð8IÒ3IÐ3Iˆq�!Ð3IÐ3IÐ3Iri   ©rþ  r  r  rh   )r/  ra  rÄ  rù  rì  rk   r{  r~  r‹   r  r¶  )râ  r¹  r  r2  r  rþ  s         re   rÊ  zClient.read_example  sá   € ð ×,Ò,ØØ=� *¨lÑ;Ô;Ð=Ð=à¨eÐ=˜ŸšÑ*Ô*Ð*¸ðð -ñ 
ô 
ˆð —-’-‘/”/ˆÝEØÐ%6ÀÄð
ñ 
ô 
ˆõ Ô!ð 
ð 
ØJÐJ §¢¡¤ÐJÑJÔJð
à#Ø”nØ×3Ò3Ñ5Ô5ð	
ð 
ð 
ð 
ð 	
ri   )rŠ  r‹  rC  ró  Úinclude_attachmentsú'Optional[Union[datetime.datetime, str]]r”  Úinline_s3_urlsrÑ  c          
   +  ón  K  — i |¥||t          |t          j        ¦  «        r|                     ¦   «         n||||�t          |d¦  «        nd|
dœ¥}|	�t	          |	¦  «        |d<   |�||d<   n$|�!|                      |¬¦  «        j        }||d<   n	 |rg d¢|d<   t          |                      d	|¬
¦  «        ¦  «        D ]v\  }}t          |d| j
        ¬¦  «        }t          j        di d„ |                     ¦   «         D ¦   «         ¤|| j        |                      ¦   «         dœ¤ŽV — |�|dz   |k    r dS ŒwdS )aç
  Retrieve the example rows of the specified dataset.

        Args:
            dataset_id (Optional[Union[UUID, str]]): The ID of the dataset to filter by.
            dataset_name (Optional[str]): The name of the dataset to filter by.
            example_ids (Optional[Sequence[Union[UUID, str]]): The IDs of the examples to filter by.
            as_of (Optional[Union[datetime.datetime, str]]): The dataset version tag OR
                timestamp to retrieve the examples as of.
                Response examples will only be those that were present at the time
                of the tagged (or timestamped) version.
            splits (Optional[Sequence[str]]): A list of dataset splits, which are
                divisions of your dataset such as 'train', 'test', or 'validation'.
                Returns examples only from the specified splits.
            inline_s3_urls (bool, default=True): Whether to inline S3 URLs.
            offset (int, default=0): The offset to start from. Defaults to 0.
            limit (Optional[int]): The maximum number of examples to return.
            metadata (Optional[dict]): A dictionary of metadata to filter by.
            filter (Optional[str]): A structured filter string to apply to
                the examples.
            include_attachments (bool, default=False): Whether to include the
                attachments in the response.
            **kwargs (Any): Additional keyword arguments are ignored.

        Yields:
            The examples.

        Examples:
            List all examples for a dataset:

            ```python
            from langsmith import Client

            client = Client()

            # By Dataset ID
            examples = client.list_examples(
                dataset_id="c9ace0d8-a82c-4b6c-13d2-83401d68e9ab"
            )
            # By Dataset Name
            examples = client.list_examples(dataset_name="My Test Dataset")
            ```

            List examples by id

            ```python
            example_ids = [
                "734fc6a0-c187-4266-9721-90b7a025751a",
                "d6b4c1b9-6160-4d63-9b61-b034c585074f",
                "4d31df4e-f9c3-4a6e-8b6c-65701c2fed13",
            ]
            examples = client.list_examples(example_ids=example_ids)
            ```

            List examples by metadata

            ```python
            examples = client.list_examples(
                dataset_name=dataset_name, metadata={"foo": "bar"}
            )
            ```

            List examples by structured filter

            ```python
            examples = client.list_examples(
                dataset_name=dataset_name,
                filter='and(not(has(metadata, \'{"foo": "bar"}\')), exists(metadata, "tenant_id"))',
            )
            ```
        Nrj  )rŠ  rÿ   r  r”  rÓ  r‹  ró  rC  rR  re  )rÍ  r¿  rC  rò  r}  r†  rÍ  rê  c                ó&   — i | ]\  }}|d k    ¯||“ŒS rÏ  rh   r5  s      re   r€   z(Client.list_examples.<locals>.<dictcomp>µ  s)   € ÐNÐNÐN™D˜A˜q°qÐ<MÒ7MÐ7M�1�aÐ7MÐ7MÐ7Mri   rÐ  r[   rh   )r  rÃ  rÄ  r0  r—  rm  rÿ   r  rŽ  rì  rk   r{  r~  r‹   r  r¶  )râ  rg  rf  ry  r  r”  rÓ  rŠ  r‹  rC  ró  rÑ  r�   r‡  r   r  rþ  s                    re   r¼  zClient.list_examples@  sÅ  è è € ðl"
Øð"
àØå%/°µxÔ7HÑ%IÔ%IÐT�—’Ñ!Ô!Ð!ÈuàØ,Ø(-Ð(9•S˜ ‘_”_�_¸sØð"
ð "
ð "
ˆð ÐÝ!,¨XÑ!6Ô!6ˆF�:ÑØÐ!Ø *ˆF�9ÑÐØÐ%Ø×*Ò*¸Ð*ÑEÔEÔHˆJØ *ˆF�9ÑÐàØð 	JØIÐIÐIˆF�8ÑÝ#Ø×$Ò$ [¸Ð$Ñ@Ô@ñ
ô 
ð 	ð 	‰JˆAˆwõ JØÐ):ÀDÄLðñ ô ˆKõ Ô$ð ð ØNÐN G§M¢M¡O¤OÐNÑNÔNðà'Øœ.Ø×7Ò7Ñ9Ô9ð	ð ð ð ð ð ð ð Ð  Q¨¡U¨e¢^ ^Ø��øð	ð 	ri   )r¾  r¿  rC  r`  rg  rW  rþ  rW  ú*Optional[ls_schemas.AttachmentsOperations]c               ó   — |�1| j         j        pi                      dd¦  «        st          d¦  «        ‚t	          |||||||¬¦  «        }	t          j        di d„ |	                     ¦   «         D ¦   «         ¤Ž}
|€|                      |¦  «        j	        }| j         j        pi                      dd¦  «        r%t	          |  
                    ||
g¬¦  «        ¦  «        S |                      dd	t          |d
¦  «        › �i | j        ¥ddi¥t          i d„ t          |
¦  «                             ¦   «         D ¦   «         ¥dt!          |¦  «        i¥¦  «        ¬¦  «        }t#          j        |¦  «         |                     ¦   «         S )a¼  Update a specific example.

        Args:
            example_id (Union[UUID, str]):
                The ID of the example to update.
            inputs (Optional[Dict[str, Any]]):
                The input values to update.
            outputs (Optional[Mapping[str, Any]]):
                The output values to update.
            metadata (Optional[Dict]):
                The metadata to update.
            split (Optional[str | List[str]]):
                The dataset split to update, such as
                'train', 'test', or 'validation'.
            dataset_id (Optional[Union[UUID, str]]):
                The ID of the dataset to update.
            attachments_operations (Optional[AttachmentsOperations]):
                The attachments operations to perform.
            attachments (Optional[Attachments]):
                The attachments to add to the example.

        Returns:
            Dict[str, Any]: The updated example.
        Nri  FúYour LangSmith deployment does not allow using the attachment operations, please upgrade your deployment to the latest version.)r¾  r¿  rÿ   rC  r`  rW  rþ  c                ó   — i | ]
\  }}|®||“ŒS ry   rh   r5  s      re   r€   z)Client.update_example.<locals>.<dictcomp>ò  s   € ÐFÐFÐF™˜˜1¸¸ˆq�!¸¸¸ri   )rg  r`  rº  rÌ  r¹  rN  r  c                ó   — i | ]
\  }}|®||“ŒS ry   rh   r5  s      re   r€   z)Client.update_example.<locals>.<dictcomp>  s+   € ð ð ð á $  1Ø ˜}ð ˜qà,˜}˜}ri   rg  r•  rh   )rž  r¡  r{   rï   r  r{  rT  r‹   rÊ  rg  re  r/  ra  r  r—  rÂ  rW   r¤   r0  rù  )râ  r¹  r¾  r¿  rC  r`  rg  rW  rþ  Úexample_dictr  r2  s               re   Úupdate_examplezClient.update_example½  sò  € ðH "Ð-Ø”IÔ,Ð2°×7Ò7Ø4°eñô ð õ !ð Vñô ð õ ØØØØØØ#9Ø#ð
ñ 
ô 
ˆõ Ô*ð 
ð 
ØFÐF × 2Ò 2Ñ 4Ô 4ÐFÑFÔFð
ð 
ˆð ÐØ×*Ò*¨:Ñ6Ô6ÔAˆJàŒIÔ$Ð*¨×/Ò/Ø0°%ñ
ô 
ð 	#õ Ø×/Ò/Ø)°G°9ð 0ñ ô ñô ð ð ×0Ò0ØØA�X j°,Ñ?Ô?ÐAÐAØM˜4œ=ÐM¨.Ð:LÐMÐMÝ ððð å(2°7Ñ(;Ô(;×(AÒ(AÑ(CÔ(Cðñ ô ðð %¥c¨*¡o¤oðð ñ	ô 	ð	 1ñ ô ˆHõ Ô/°Ñ9Ô9Ð9Ø—=’=‘?”?Ð"ri   )rf  rg  r`  r   ú
str | NoneúID_TYPE | Noneú3Optional[Sequence[ls_schemas.ExampleUpdate | dict]]c               ój  — |r"|r t          dt          |¦  «        › d�¦  «        ‚|s|st          d¦  «        ‚|r|rt          d¦  «        ‚|r|                      |¬¦  «        j        }|r;d„ |D ¦   «         }|s+|d         j        r|d         j        }�nÍt          d¦  «        ‚�n¼|                     d	d
¦  «        }|st          d¦  «        ‚|s…d|vr!|                      |d         ¦  «        j        }n`t          t          |d         ¦  «        ¦  «        dk    rt          d¦  «        ‚|d         d         st          d¦  «        ‚|d         d         }| j	        j
        pi                      d¦  «        }|s:|                     d¦  «        p|                     d¦  «        	 �t          d¦  «        ‚t          |¦  «        }	|                     ¦   «         D ]@\  }
}|�9t          |¦  «        |	k    r&t          d|
› dt          |¦  «        › d|	› d�¦  «        ‚ŒAd„ t          ||                     dd„ t          |	¦  «        D ¦   «         ¦  «        |                     dd„ t          |	¦  «        D ¦   «         ¦  «        |                     dd„ t          |	¦  «        D ¦   «         ¦  «        |                     dd „ t          |	¦  «        D ¦   «         ¦  «        |                     dd!„ t          |	¦  «        D ¦   «         ¦  «        |                     dd"„ t          |	¦  «        D ¦   «         ¦  «        |                     dd#„ t          |	¦  «        D ¦   «         ¦  «        ¦  «        D ¦   «         }d
}| j	        j
        pi                      dd$¦  «        rM|                      t          t           j        |¦  «        ||¬%¦  «        }d&|                     d'd¦  «        › d(�i|¥S |                      d)d*i | j        ¥d+d,i¥t)          d-„ |D ¦   «         ¦  «        ¬.¦  «        }t+          j        |¦  «         |                     ¦   «         S )/a¤  Update multiple examples.

        Examples are expected to all be part of the same dataset.

        Args:
            dataset_name (str | None):
                The name of the dataset to update. Should specify exactly one of
                'dataset_name' or 'dataset_id'.
            dataset_id (UUID | str | None):
                The ID of the dataset to update. Should specify exactly one of
                'dataset_name' or 'dataset_id'.
            updates (Sequence[ExampleUpdate | dict] | None):
                The example updates. Overwrites any specified fields and does not
                update any unspecified fields.
            dangerously_allow_filesystem (bool):
                Whether to allow using filesystem paths as attachments.
            **kwargs (Any):
                Legacy keyword args. Should not be specified if 'updates' is specified.

                - example_ids (Sequence[UUID | str]): The IDs of the examples to update.
                - inputs (Sequence[dict | None] | None): The input values for the examples.
                - outputs (Sequence[dict | None] | None): The output values for the examples.
                - metadata (Sequence[dict | None] | None): The metadata for the examples.
                - splits (Sequence[str | list[str] | None] | None): The splits for the examples, which are divisions of your dataset such as 'train', 'test', or 'validation'.
                - attachments_operations (Sequence[AttachmentsOperations | None] | None): The operations to perform on the attachments.
                - dataset_ids (Sequence[UUID | str] | None): The IDs of the datasets to move the examples to.

        Returns:
            The LangSmith JSON response. Includes 'message', 'count', and 'example_ids'.

        !!! warning "Behavior changed in `langsmith` 0.3.9"

            Updated to ...

        Example:
            ```python
            from langsmith import Client

            client = Client()

            dataset = client.create_dataset("agent-qa")

            examples = [
                {
                    "inputs": {"question": "what's an agent"},
                    "outputs": {"answer": "an agent is..."},
                    "metadata": {"difficulty": "easy"},
                },
                {
                    "inputs": {
                        "question": "can you explain the agent architecture in this diagram?"
                    },
                    "outputs": {"answer": "this diagram shows..."},
                    "attachments": {"diagram": {"mime_type": "image/png", "data": b"..."}},
                    "metadata": {"difficulty": "medium"},
                },
                # more examples...
            ]

            response = client.create_examples(dataset_name="agent-qa", examples=examples)
            example_ids = response["example_ids"]

            updates = [
                {
                    "id": example_ids[0],
                    "inputs": {"question": "what isn't an agent"},
                    "outputs": {"answer": "an agent is not..."},
                },
                {
                    "id": example_ids[1],
                    "attachments_operations": [
                        {"rename": {"diagram": "agent_diagram"}, "retain": []}
                    ],
                },
            ]
            response = client.update_examples(dataset_name="agent-qa", updates=updates)
            # -> {"example_ids": [...
            ```
        z&Must pass in either 'updates' or args z, not both.z6Please pass in a non-empty sequence for arg 'updates'.z;Must pass in exactly one of 'dataset_name' or 'dataset_id'.re  c                ó^   — g | ]*}t          |t          ¦  «        rt          j        d i |¤Žn|‘Œ+S r—  )r  r  r{  rT  r˜  s     re   rZ  z*Client.update_examples.<locals>.<listcomp>{  sM   € ð ð ð àõ 2<¸A½tÑ1DÔ1DÐK•
Ô(Ð-Ð-¨1Ð-Ð-Ð-È!ðð ð ri   r   z=Must pass in (exactly) one of 'dataset_name' or 'dataset_id'.ry  Nz9Must pass in (exactly) one of 'updates' or 'example_ids'.r  r[   z-Dataset IDs must be the same for all examplesz+If specified, dataset_ids must be non-null.ri  rW  rþ  rØ  r™  rš  z%) does not match length of examples (r  c                óT   — g | ]%\  }}}}}}}}t          j        di ||||||||d œ¤Ž‘Œ&S ))rÿ   r¾  r¿  rg  rC  r`  rþ  rW  rh   )r{  rT  )	r|   r   rœ  r�  rž  rŸ  Údataset_id_Úattachments_Úattachments_operations_s	            re   rZ  z*Client.update_examples.<locals>.<listcomp>®  su   € ð ð ð ñ j�C˜˜d I¨v°{ÀLÐRiõ Ô(ð ð à!Ø"%Ø#'Ø&1Ø$-Ø!'Ø'3Ø2Ið	ð 	ðð ðð ð ri   r¾  c              3  ó   K  — | ]}d V — Œd S ry   rh   r£  s     re   r	  z)Client.update_examples.<locals>.<genexpr>½  ó"   è è € Ð)LÐ)L°1¨$Ð)LÐ)LÐ)LÐ)LÐ)LÐ)Lri   r¿  c              3  ó   K  — | ]}d V — Œd S ry   rh   r£  s     re   r	  z)Client.update_examples.<locals>.<genexpr>¾  s"   è è € Ð*MÐ*M°A¨4Ð*MÐ*MÐ*MÐ*MÐ*MÐ*Mri   rC  c              3  ó   K  — | ]}d V — Œd S ry   rh   r£  s     re   r	  z)Client.update_examples.<locals>.<genexpr>¿  s"   è è € Ð+NÐ+N°Q¨DÐ+NÐ+NÐ+NÐ+NÐ+NÐ+Nri   r”  c              3  ó   K  — | ]}d V — Œd S ry   rh   r£  s     re   r	  z)Client.update_examples.<locals>.<genexpr>À  rç  ri   c              3  ó   K  — | ]}d V — Œd S ry   rh   r£  s     re   r	  z)Client.update_examples.<locals>.<genexpr>Á  ó"   è è € Ð.QÐ.Q¸¨tÐ.QÐ.QÐ.QÐ.QÐ.QÐ.Qri   c              3  ó   K  — | ]}d V — Œd S ry   rh   r£  s     re   r	  z)Client.update_examples.<locals>.<genexpr>Â  rì  ri   c              3  ó   K  — | ]}d V — Œd S ry   rh   r£  s     re   r	  z)Client.update_examples.<locals>.<genexpr>Ä  s"   è è € Ð2UÐ2U¸A°4Ð2UÐ2UÐ2UÐ2UÐ2UÐ2Uri   Frd  r>  rd   z examples updatedrº  r¾  rN  r  c                ód   — g | ]-}d „ t          |¦  «                             ¦   «         D ¦   «         ‘Œ.S )c                ó   — i | ]
\  }}|®||“ŒS ry   rh   r5  s      re   r€   z5Client.update_examples.<locals>.<listcomp>.<dictcomp>à  s+   € ð ð ð á$( A qØ#$ =ð !" 1à#0 = =ri   )rÂ  r‹   r»  s     re   rZ  z*Client.update_examples.<locals>.<listcomp>ß  sU   € ð ð ð ð !(ðð å,6°wÑ,?Ô,?×,EÒ,EÑ,GÔ,Gðñ ô ðð ð ri   r•  )rï   r  rm  rÿ   rg  r{   rÊ  rp   r  rž  r¡  r‹   rª  rc  re  r   r[  r\  r/  r  r—  r¤   r0  rù  )râ  rf  rg  r`  r   r�   Úupdates_objry  Úmultipart_enabledÚexamples_lenr±  r²  r2  s                re   Úupdate_exampleszClient.update_examples  s1  € ðp ð 	�gð 	ÝØS½¸v¹¼ÐSÐSÐSñô ð ð ð 	W˜'ð 	WÝÐUÑVÔVÐVàð 	I˜Jð 	IÝØMñô ð ð ð 	IØ×*Ò*¸Ð*ÑEÔEÔHˆJàð M	ðð à ðñ ô ˆKð
 ð Ø˜q”>Ô,ð Ø!,¨Q¤Ô!:�J‘Jå$ØWñô ð ñ	ð !Ÿ*š* ]°DÑ9Ô9ˆKØð Ý ØOñô ð ð ð 	:Ø ¨Ð.Ð.à!%×!2Ò!2°;¸q´>Ñ!BÔ!BÔ!M�J�JÝ�˜V MÔ2Ñ3Ô3Ñ4Ô4°qÒ8Ð8Ý$Ð%TÑUÔUÐUØ Ô.¨qÔ1ð :Ý$Ð%RÑSÔSÐSà!'¨Ô!6°qÔ!9�Jà!%¤Ô!9Ð!?¸R× DÒ DØ4ñ!ô !Ðð &ðà—Z’ZÐ 8Ñ9Ô9ÐV¸V¿ZºZÈÑ=VÔ=VØðõ !ðXñô ð õ
 ˜{Ñ+Ô+ˆLØ'-§|¢|¡~¤~ð ð Ñ#�˜)ØÐ(­S°©^¬^¸|Ò-KÐ-KÝ$ð@ Xð @ð @µ°Y±´ð @ð @Ø0<ð@ð @ð @ñô ð øðð õ nqØØ—J’J˜xÐ)LÐ)L½¸lÑ8KÔ8KÐ)LÑ)LÔ)LÑMÔMØ—J’J˜yÐ*MÐ*M½¸|Ñ9LÔ9LÐ*MÑ*MÔ*MÑNÔNØ—J’J˜zÐ+NÐ+N½%ÀÑ:MÔ:MÐ+NÑ+NÔ+NÑOÔOØ—J’J˜xÐ)LÐ)L½¸lÑ8KÔ8KÐ)LÑ)LÔ)LÑMÔMØ—J’J˜}Ð.QÐ.Q½UÀ<Ñ=PÔ=PÐ.QÑ.QÔ.QÑRÔRØ—J’J˜}Ð.QÐ.Q½UÀ<Ñ=PÔ=PÐ.QÑ.QÔ.QÑRÔRØ—J’JØ0Ð2UÐ2UÅÀ|ÑATÔATÐ2UÑ2UÔ2Uñô ñnô nðñ ô ˆKð6 ˆØŒIÔ$Ð*¨×/Ò/Ø0°%ñ
ô 
ð !	#ð ×6Ò6Ý¥¤	¨:Ñ6Ô6Ø#Ø-Ið 7ñ ô ˆHð ˜hŸlšl¨7°AÑ6Ô6ÐIÐIÐIðàðð ð ×0Ò0ØØ ØM˜4œ=ÐM¨.Ð:LÐMÐMåðð ð ,7ðñ ô ñ	ô 	ð 1ñ ô ˆHõ" Ô/°Ñ9Ô9Ð9Ø—=’=‘?”?Ð"ri   c                óŠ   — |                       ddt          |d¦  «        › �| j        ¬¦  «        }t          j        |¦  «         dS )z¯Delete an example by ID.

        Args:
            example_id (Union[UUID, str]):
                The ID of the example to delete.

        Returns:
            None
        rV  rÌ  r¹  rW  NrX  )râ  r¹  r2  s      re   Údelete_examplezClient.delete_exampleí  sT   € ð ×,Ò,ØØ=� *¨lÑ;Ô;Ð=Ð=Ø”Mð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   )Úhard_deleteúSequence[ID_TYPE]r÷  c               óÞ  — |r—d„ t          |¦  «        D ¦   «         ddœ}t          | j        d¦  «        }t          | j        |¦  «        }|                      ¦   «          | j                             d|i | j        ¥ddi¥t          |¦  «        | j	        ¬¦  «        }n?d	d
„ t          |¦  «        D ¦   «         i}|  
                    ddi | j        ¥ddi¥|¬¦  «        }t          j        |¦  «         dS )a"  Delete multiple examples by ID.

        Parameters
        ----------
        example_ids : Sequence[ID_TYPE]
            The IDs of the examples to delete.
        hard_delete : bool, default=False
            If True, permanently delete the examples. If False, soft delete them.
        c           
     óV   — g | ]&\  }}t          t          |d |› d�¦  «        ¦  «        ‘Œ'S ©zexample_ids[ú]©rW   ra  ©r|   r   r   s      re   rZ  z*Client.delete_examples.<locals>.<listcomp>  óJ   € ð  ð  ð  á˜˜3õ � Ð&9°QÐ&9Ð&9Ð&9Ñ:Ô:Ñ;Ô;ð ð  ð  ri   T)ry  r÷  zdatasets/examples/deleter�  rN  r  )r�   rL  rº  ry  c           
     óV   — g | ]&\  }}t          t          |d |› d�¦  «        ¦  «        ‘Œ'S rû  rý  rþ  s      re   rZ  z*Client.delete_examples.<locals>.<listcomp>#  rÿ  ri   rV  r}  rÿ  N)r  Ú_platform_pathrk   rg  r"  rs   rf  r  r—  r  r/  r¤   r0  )râ  ry  r÷  rÅ  r_  Úfull_urlr2  r‡  s           re   Údelete_exampleszClient.delete_examplesþ  sD  € ð ð #	ð
 ð  å"+¨KÑ"8Ô"8ð ñ  ô  ð  $ðð ˆDõ " $¤,Ð0JÑKÔKˆDÝ% d¤l°DÑ9Ô9ˆHØ×%Ò%Ñ'Ô'Ð'Ø”|×+Ò+ØØØM˜4œ=ÐM¨.Ð:LÐMÐMÝ  Ñ&Ô&Øœð ,ñ ô ˆHˆHð ð  ð  å"+¨KÑ"8Ô"8ð ñ  ô  ð&ˆFð ×0Ò0ØØØM˜4œ=ÐM¨.Ð:LÐMÐMØð	 1ñ ô ˆHõ 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   )rg  rf  r  ú'Optional[Union[str, datetime.datetime]]ú	list[str]c               óp  — |€,|€t          d¦  «        ‚|                      |¬¦  «        j        }i }|�3t          |t          j        ¦  «        r|                     ¦   «         n||d<   |                      ddt          |d¦  «        › d�|¬	¦  «        }t          j	        |¦  «         | 
                    ¦   «         S )
aÛ  Get the splits for a dataset.

        Args:
            dataset_id (Optional[Union[UUID, str]]): The ID of the dataset.
            dataset_name (Optional[str]): The name of the dataset.
            as_of (Optional[Union[str, datetime.datetime]]): The version
                of the dataset to retrieve splits for. Can be a timestamp or a
                string tag. Defaults to "latest".

        Returns:
            List[str]: The names of this dataset's splits.
        NúMust provide dataset name or IDre  r  r-  rk  rg  ú/splitsr†  )rï   rm  rÿ   r  rÃ  rÄ  r/  ra  r¤   r0  rù  )râ  rg  rf  r  r‡  r2  s         re   Úlist_dataset_splitszClient.list_dataset_splits0  sË   € ð& ÐØÐ#Ý Ð!BÑCÔCÐCØ×*Ò*¸Ð*ÑEÔEÔHˆJØˆØÐå%/°µxÔ7HÑ%IÔ%IÐT�—’Ñ!Ô!Ð!Èuð �7‰Oð ×,Ò,ØØD� *¨lÑ;Ô;ÐDÐDÐDØð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ø�}Š}‰ŒÐri   )rg  rf  rì  Ú
split_nameúlist[ID_TYPE]rì  c               ó  — |€,|€t          d¦  «        ‚|                      |¬¦  «        j        }|d„ t          |¦  «        D ¦   «         |dœ}|                      ddt          |d¦  «        › d	�|¬
¦  «        }t          j        |¦  «         dS )aF  Update the splits for a dataset.

        Args:
            dataset_id (Optional[Union[UUID, str]]): The ID of the dataset to update.
            dataset_name (Optional[str]): The name of the dataset to update.
            split_name (str): The name of the split to update.
            example_ids (List[Union[UUID, str]]): The IDs of the examples to add to or
                remove from the split.
            remove (Optional[bool]): If True, remove the examples from the split.
                If False, add the examples to the split.

        Returns:
            None
        Nr  re  c           
     óV   — g | ]&\  }}t          t          |d |› d�¦  «        ¦  «        ‘Œ'S rû  rý  rþ  s      re   rZ  z0Client.update_dataset_splits.<locals>.<listcomp>r  sJ   € ð ð ð á�A�sõ •H˜SÐ"5°Ð"5Ð"5Ð"5Ñ6Ô6Ñ7Ô7ðð ð ri   )r
  r¾  rì  rO  rk  rg  r  ©rù  )rï   rm  rÿ   r  r/  ra  r¤   r0  )râ  rg  rf  r
  ry  rì  rL  r2  s           re   Úupdate_dataset_splitszClient.update_dataset_splitsU  sÃ   € ð. ÐØÐ#Ý Ð!BÑCÔCÐCØ×*Ò*¸Ð*ÑEÔEÔHˆJà$ðð å'¨Ñ4Ô4ðñ ô ð ð
ð 
ˆð ×,Ò,ØÐK¥¨°\Ñ BÔ BÐKÐKÐKÐRVð -ñ 
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   ú@Union[V2Run, ls_schemas.Run, ls_schemas.RunBase, str, uuid.UUID]ú0Union[V2Run, ls_schemas.Run, ls_schemas.RunBase]c               óÈ  — t          |t          t          j        f¦  «        r¾t	          j        | j        j        ¦  «        }|t          j        j	        k    r-|€t          j        d¦  «        ‚|€t          j        d¦  «        ‚n|€t          j        dt          d¬¦  «         t          ¦   «         5  |                      ||||¬¦  «        }ddd¦  «         n# 1 swxY w Y   n|}|S )a¨  Resolve the run ID.

        Args:
            run (Union[V2Run, Run, RunBase, str, UUID]):
                The run to resolve.
            load_child_runs (bool):
                Whether to load child runs.
            project_id (Optional[Union[UUID, str]]):
                The ID of the project (session) that owns the run. Required to
                look the run up on SmithDB-only backends.
            start_time (Optional[datetime]):
                The run's start time. Required to look the run up on
                SmithDB-only backends.

        Returns:
            Run: The resolved run.

        Raises:
            TypeError: If the run type is invalid.
        Nztproject_id is required to resolve a run from an ID when ClickHouse query support is disabled (SmithDB-only backend).ztstart_time is required to resolve a run from an ID when ClickHouse query support is disabled (SmithDB-only backend).zŒResolving a run from an ID without passing project_id is deprecated and will raise an error in a future release. Pass project_id explicitly.r“   r¢   ©ræ  rå  r¿  )r  rW   r[  r\  r(   rG   rž  r¡  rF   r¢  r¤   rB  rª   r«   r”  rÚ  rï  )râ  r»  ræ  rå  r¿  rÝ  Úrun_s          re   Ú_resolve_run_idzClient._resolve_run_id~  sQ  € õ8 �c�C¥¤Ð+Ñ,Ô,ð "	Ý)Ô;¸D¼IÔ<TÑUÔUˆGØÕ-Ô:ÔGÒGÐGØÐ%Ý"Ô1ð3ñô ð ð
 Ð%Ý"Ô1ð3ñô ð ð &ð Ð#Ý”ð3õ 'Ø ðñ ô ð õ /Ñ0Ô0ð ð ØIMÏÊØØ$3Ø)Ø)ð	 JWñ Jô J�ðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð øð ˆDØˆs   Â.CÃCÃCú5Union[ls_schemas.Example, str, uuid.UUID, dict, None]úOptional[ls_schemas.Example]c                ó|  — t          |t          t          j        f¦  «        r|                      |¦  «        }n„t          |t
          j        ¦  «        r|}ngt          |t          ¦  «        r.t          j        di |¤| j        |  	                    ¦   «         dœ¤Ž}n$|j
        �|                      |j
        ¦  «        }nd}|S )aB  Resolve the example ID.

        Args:
            example (Optional[Union[Example, str, UUID, dict]]):
                The example to resolve.
            run (Union[V2Run, Run, RunBase]):
                The run associated with the example.

        Returns:
            Optional[Example]: The resolved example.
        r²  Nrh   )r  rW   r[  r\  rÊ  r{  r~  r  r  r¶  rª  )râ  r  r»  Úreference_example_s       re   Ú_resolve_example_idzClient._resolve_example_id¿  sÛ   € õ  �g¥¥T¤YÐ/Ñ0Ô0ð 	&Ø!%×!2Ò!2°7Ñ!;Ô!;ÐÐÝ˜¥Ô!3Ñ4Ô4ð 	&Ø!(ÐÐÝ˜¥Ñ&Ô&ð 		&Ý!+Ô!3ð "ð "Øð"àœ.Ø×7Ò7Ñ9Ô9ð"ð "ð "ð "ÐÐð
 Ô%Ð1Ø!%×!2Ò!2°3Ô3KÑ!LÔ!LÐÐà!%ÐØ!Ð!ri   )Úfn_namerØ  úJUnion[ls_evaluator.EvaluationResult, ls_evaluator.EvaluationResults, dict]r  ú#list[ls_evaluator.EvaluationResult]c               óJ  ‡‡‡— ddl mŠ dˆˆfd„Šdd„}t          |‰j        ¦  «        r|g}nu ||¦  «        rˆfd„|d         D ¦   «         }nUt          |t          ¦  «        r  ‰t          t          |¦  «        ¦  «        g}n t          dt          |¦  «        › d�¦  «        ‚|S )Nr   rÖ   Úsingle_resultú*Union[ls_evaluator.EvaluationResult, dict]rX   úls_evaluator.EvaluationResultc                óÞ   •— t          | t          ¦  «        rVi | ¥}d|v rd|vr|d         |d<   |                     dd ¦  «         ‰�|                     d¦  «        €‰|d<    ‰j        di |¤ŽS | S )NÚ	reasoningÚcommentr}   rh   )r  r  rç  r{   ÚEvaluationResult)r  Úmerged_resultr  Úls_evaluators     €€re   Ú_cast_resultz1Client._select_eval_results.<locals>._cast_resulté  sž   ø€ õ ˜-­Ñ.Ô.ð FØ0A°=Ð0A�Ø -Ð/Ð/°IÀ]Ð4RÐ4RØ/<¸[Ô/I�M )Ñ,Ø×!Ò! +¨tÑ4Ô4Ð4ØÐ&¨=×+<Ò+<¸UÑ+CÔ+CÐ+KØ+2�M %Ñ(Ø4�|Ô4ÐEÐE°}ÐEÐEÐEØ Ð ri   rØ  r   ú)TypeGuard[ls_evaluator.EvaluationResults]c                ó4   — t          | t          ¦  «        od| v S )NrØ  )r  r  )rØ  s    re   Ú_is_eval_resultsz5Client._select_eval_results.<locals>._is_eval_resultsö  s   € Ý˜g¥tÑ,Ô,ÐE°¸gÐ1EÐEri   c                ó&   •— g | ]} ‰|¦  «        ‘ŒS rh   rh   )r|   rÓ  r(  s     €re   rZ  z/Client._select_eval_results.<locals>.<listcomp>ü  s!   ø€ ÐDÐDÐD¨A˜˜ Q™œÐDÐDÐDri   z!Invalid evaluation results type: z.. Must be EvaluationResult, EvaluationResults.)r  r   rX   r!  )rØ  r   rX   r)  )Úlangsmith.evaluationr×   r  r%  r  r   rï   r  )râ  rØ  r  r+  Úresults_r(  r'  s     `  @@re   Ú_select_eval_resultszClient._select_eval_resultsß  s  øøø€ ð 	CÐBÐBÐBÐBÐBð	!ð 	!ð 	!ð 	!ð 	!ð 	!ð 	!ð	Fð 	Fð 	Fð 	Fõ �g˜|Ô<Ñ=Ô=ð 
	Ø�yˆHˆHØÐ˜gÑ&Ô&ð 	ØDÐDÐDÐD°¸Ô1CÐDÑDÔDˆHˆHÝ˜¥Ñ&Ô&ð 	Ø$˜¥T­$°Ñ%8Ô%8Ñ9Ô9Ð:ˆHˆHåð@µD¸±M´Mð @ð @ð @ñô ð ð ˆri   zªevaluate_run() is deprecated and will be removed after Jan 31, 2027. There is no replacement: run the evaluator yourself and log the result with client.create_feedback().)rå  r¿  Úsource_infor  ræ  r×   úls_evaluator.RunEvaluatorr0  r  ú9Optional[Union[ls_schemas.Example, str, dict, uuid.UUID]]r!  c               ó   — |                       ||||¬¦  «        }|                      ||¦  «        }	|                     t          t          j        |¦  «        |	¬¦  «        }
|                      |
|||¬¦  «        }|d         S )a¹  Evaluate a run.

        .. admonition:: Deprecated

            There is no replacement. Run the evaluator yourself and log the
            result with :meth:`langsmith.Client.create_feedback`.
            Will be removed after Jan 31, 2027.

        Args:
            run (Union[V2Run, Run, RunBase, str, UUID]):
                The run to evaluate. Passing `schemas.Run` (the legacy
                read-side datamodel) is deprecated; pass the v2 `Run`
                datamodel (from `client.runs.retrieve`) instead.
            evaluator (RunEvaluator):
                The evaluator to use.
            project_id (Optional[Union[UUID, str]]):
                The ID of the project (session) that owns the run. Omitting it is deprecated and will
                raise in a future release.
            start_time (Optional[datetime]):
                The run's start time, passed to `runs.retrieve` when resolving
                `run` from an ID. Required when resolving a run from an ID on
                SmithDB-only backends (no ClickHouse query support).
            source_info (Optional[Dict[str, Any]]):
                Additional information about the source of the evaluation to log
                as feedback metadata.
            reference_example (Optional[Union[Example, str, dict, UUID]]):
                The example to use as a reference for the evaluation.
                If not provided, the run's reference example will be used.
            load_child_runs (bool, default=False):
                Whether to load child runs when resolving the run ID.
                **Deprecated**: see `read_run`.

        Returns:
            Feedback: The feedback object created by the evaluation.
        r  ©r  ©r0  rå  r   )r  r  Úevaluate_runr   r{  rÕ   Ú_log_evaluation_feedback©râ  r»  r×   rå  r¿  r0  r  ræ  r  r  Úevaluator_responserØ  s               re   r6  zClient.evaluate_run  s¥   € ðj ×#Ò#ØØ+Ø!Ø!ð	 $ñ 
ô 
ˆð "×5Ò5Ð6GÈÑNÔNÐØ&×3Ò3Ý•” Ñ&Ô&Ø&ð 4ñ 
ô 
Ðð ×/Ò/ØØØ#Ø!ð	 0ñ 
ô 
ˆð �qŒzÐri   )Ú	_executorr9  ú:Optional[Union[V2Run, ls_schemas.Run, ls_schemas.RunBase]]r:  úOptional[cf.ThreadPoolExecutor]c               ó¦  ‡ ‡— ‰                       |¦  «        }ˆˆ fd„}|�"t          |dd ¦  «        pt          |dd ¦  «        nd }|D �]	}	|pi }
|	j        ri |	j        ¥|
¥}
d }|	j        r|	j        }n	|�|j        }|	j        �|	j                             dd ¦  «        nd } |di d|“d|	j        “d|	j        “d|	j	        “d	|	j
        “d
|	j        “d|
“d|	j        “dt          t          t          j                 |	j        ¦  «        “dt          j        j        “d|€|nd “d|	j        “d|rt          |dd ¦  «        nd “d|p|“d|r|j        nd “d|“Ž �Œ|S )Nc                 óP   •— ‰r ‰j         ‰j        fi | ¤Ž d S  ‰j        di | ¤Ž d S )Nrh   )r>  Úcreate_feedback)r�   r:  râ  s    €€re   Ú_submit_feedbackz9Client._log_evaluation_feedback.<locals>._submit_feedback\  sN   ø€ Øð /Ø �	Ô  Ô!5Ð@Ð@¸Ð@Ð@Ð@Ð@Ð@à$�Ô$Ð.Ð. vÐ.Ð.Ð.Ð.Ð.ri   rÁ  rå  rý  rÀ  r}   r—  r~   r$  Ú
correctionr0  rP  Úfeedback_configÚfeedback_source_typerÁ  rê  r¿  rh   )r/  rÆ  Úevaluator_infoÚtarget_run_idrÿ   rÁ  r{   r}   r—  r~   r$  rA  rP  r   r   r{  ÚFeedbackConfigrB  ÚFeedbackSourceTypeÚMODELr¿  )râ  r9  r»  r0  rå  r:  rØ  r@  Úrun_session_idÚresÚsource_info_rî  rý  s   `    `       re   r7  zClient._log_evaluation_feedbackO  s*  øø€ ð ×+Ò+Ð,>Ñ?Ô?ˆð	/ð 	/ð 	/ð 	/ð 	/ð 	/ð ˆõ �S˜,¨Ñ-Ô-ÐQµ¸¸lÈDÑ1QÔ1Qøàð 	ð ð 	ñ 	ˆCØ&Ð,¨"ˆLØÔ!ð FØE #Ô"4ÐE¸ÐE�ØˆGØÔ ð !ØÔ+��Ø�Øœ&�Ø47´IÐ4I�C”I—M’M '¨4Ñ0Ô0Ð0ÈtˆEàÐð ð ð Ø�wðà”G�Gðð ”i�iðð ”i�ið	ð
 œ˜ðð œ>˜>ðð )˜Lðð "Ô/Ð/ðõ !%Ý�ZÔ6Ô7¸Ô9Lñ!ô !ð !ðõ &0Ô%BÔ%HÐ%Hðð *-¨˜:˜:¸$øðð ”i�iðð <?ÐH�  j°$Ñ7Ô7Ð7ÀDøðð  *Ð7¨Zøð!ð" .1Ð:˜3œ>˜>°døð#ð$ �eð%ð ñ ð( ˆri   z«aevaluate_run() is deprecated and will be removed after Jan 31, 2027. There is no replacement: run the evaluator yourself and log the result with client.create_feedback().c             ƒ  ó  K  — |                       ||||¬¦  «        }|                      ||¦  «        }	|                     t          t          j        |¦  «        |	¬¦  «        ƒ d{V —†}
|                      |
|||¬¦  «        }|d         S )aÙ  Evaluate a run asynchronously.

        .. admonition:: Deprecated

            There is no replacement. Run the evaluator yourself and log the
            result with :meth:`langsmith.Client.create_feedback`.
            Will be removed after Jan 31, 2027.

        Args:
            run (Union[V2Run, Run, RunBase, str, UUID]):
                The run to evaluate. Passing `schemas.Run` (the legacy
                read-side datamodel) is deprecated; pass the v2 `Run`
                datamodel (from `client.runs.retrieve`) instead.
            evaluator (RunEvaluator):
                The evaluator to use.
            project_id (Optional[Union[UUID, str]]):
                The ID of the project (session) that owns the run. Omitting it is deprecated and will
                raise in a future release.
            start_time (Optional[datetime]):
                The run's start time, passed to `runs.retrieve` when resolving
                `run` from an ID. Required when resolving a run from an ID on
                SmithDB-only backends (no ClickHouse query support).
            source_info (Optional[Dict[str, Any]]):
                Additional information about the source of the evaluation to log
                as feedback metadata.
            reference_example (Optional[Union[Example, str, dict, UUID]]):
                The example to use as a reference for the evaluation.
                If not provided, the run's reference example will be used.
            load_child_runs (bool, default=False):
                Whether to load child runs when resolving the run ID.
                **Deprecated**: see `read_run`.

        Returns:
            EvaluationResult: The evaluation result object created by the evaluation.
        r  r4  Nr5  r   )r  r  Úaevaluate_runr   r{  rÕ   r7  r8  s               re   rM  zClient.aevaluate_runŠ  sÇ   è è € ðj ×#Ò#ØØ+Ø!Ø!ð	 $ñ 
ô 
ˆð "×5Ò5Ð6GÈÑNÔNÐØ#,×#:Ò#:Ý•” Ñ&Ô&Ø&ð $;ñ $
ô $
ð 
ð 
ð 
ð 
ð 
ð 
Ðð
 ×/Ò/ØØØ#Ø!ð	 0ñ 
ô 
ˆð �qŒzÐri   Úunnamedr”   )r—  r~   rê  rA  r$  r0  rC  rP  Úfeedback_idrB  r?  rå  Úcomparative_experiment_idÚfeedback_group_idrÁ  rý  rÁ  r¿  Úextend_trace_retentionr}   r—  r˜  ú(Union[float, int, bool, str, dict, None]rA  úUnion[dict, None]r$  úUnion[str, None]rC  ú)Union[ls_schemas.FeedbackSourceType, str]rO  rB  ú#Optional[ls_schemas.FeedbackConfig]rP  rQ  rÁ  rR  úls_schemas.Feedbackc          	     óª	  — |p|}|€|€t          d¦  «        ‚|�|�t          d¦  «        ‚|�|€t          | j        ¦  «         |r*t          j        dt          |¦  «        › �t          ¦  «         	 t          |	t          j	        ¦  «        st          j	        |	¦  «        }	|	t          j	        j
        k    rt          j        |¬¦  «        }n=|	t          j	        j        k    rt          j        |¬¦  «        }nt          d|	› �¦  «        ‚|j        �|j        ni |_        |
�"d|j        vrdt          |
¦  «        i|j        d<   |j        r–d|j        v r�|j        d         }t!          |d	¦  «        r1t#          t%          |d	¦  «        ¦  «        r|                     ¦   «         }d|v r1t          t)          |j        d         d         d
¦  «        ¦  «        |d<   ||j        d<   t+          |�|n|d¬¦  «        }t          j        d)i dt+          |¦  «        “dt+          |d¬¦  «        “dt+          |d¬¦  «        “d|“dt/          |¦  «        “d|“d|“d|“d|“dt0          j                             t0          j        j        ¦  «        “dt0          j                             t0          j        j        ¦  «        “d|“d|“d|“dt+          |d¬¦  «        “dt+          |d¬¦  «        “d|“d|“d|“Ž}| j         o!| j        j        pi                      dd¦  «        }|�r$|�r!| j        j        �rtA          j!        | j        j        d ¦  «        rõ| j"        €| j#        �ç|j$        �à| j%        €ÙtM          |¦  «        }| j#        �†tO          |¦  «        }| j#        j(        5  tS          || j#        tT          ¦  «        }|r5| j#        xj+        d!z  c_+        | j,        r| j,         -                    ¦   «          ddd¦  «         n# 1 swxY w Y   n‡| j"        �5|  .                    t_          t          |j0        ¦  «        |¦  «        ¦  «         nJtc          |                     d¬"¦  «        ¦  «        }|  2                    d#d$d%|i|t@          j3        f¬&¦  «         t          j4        d)i |                     ¦   «         ¤ŽS # tj          $ r#} tl           7                    d'd¬(¦  «         | ‚d} ~ ww xY w)*aÞ  Create feedback for a run.

        !!! note

            To enable feedback to be batch uploaded in the background you must
            specify `trace_id`. *We highly encourage this for latency-sensitive environments.*

        Args:
            key (str):
                The name of the feedback metric.
            score (Optional[Union[float, int, bool]]):
                The score to rate this run on the metric or aspect.
            value (Optional[Union[float, int, bool, str, dict]]):
                The display value or non-numeric value for this feedback.
            run_id (Optional[Union[UUID, str]]):
                The ID of the run to provide feedback for. At least one of run_id,
                trace_id, or project_id must be specified.
            trace_id (Optional[Union[UUID, str]]):
                The ID of the trace (i.e. root parent run) of the run to provide
                feedback for (specified by run_id). If run_id and trace_id are the
                same, only trace_id needs to be specified. **NOTE**: trace_id is
                required feedback ingestion to be batched and backgrounded.
            correction (Optional[dict]):
                The proper ground truth for this run.
            comment (Optional[str]):
                A comment about this feedback, such as a justification for the score or
                chain-of-thought trajectory for an LLM judge.
            source_info (Optional[Dict[str, Any]]):
                Information about the source of this feedback.
            feedback_source_type (Union[FeedbackSourceType, str]):
                The type of feedback source, such as model (for model-generated feedback)
                or API.
            source_run_id (Optional[Union[UUID, str]]):
                The ID of the run that generated this feedback, if a "model" type.
            feedback_id (Optional[Union[UUID, str]]):
                The ID of the feedback to create. If not provided, a random UUID will be
                generated.
            feedback_config (Optional[FeedbackConfig]):
                The configuration specifying how to interpret feedback with this key.
                Examples include continuous (with min/max bounds), categorical,
                or freeform.
            stop_after_attempt (int, default=10):
                The number of times to retry the request before giving up.
            project_id (Optional[Union[UUID, str]]):
                The ID of the project (or experiment) to provide feedback on. This is
                used for creating summary metrics for experiments.
            comparative_experiment_id (Optional[Union[UUID, str]]):
                If this feedback was logged as a part of a comparative experiment, this
                associates the feedback with that experiment.
            feedback_group_id (Optional[Union[UUID, str]]):
                When logging preferences, ranking runs, or other comparative feedback,
                this is used to group feedback together.
            extra (Optional[Dict]):
                Metadata for the feedback.
            session_id (Optional[Union[UUID, str]]):
                The session (project) ID of the run. Required for run-level
                feedback; omitting it is deprecated. See
                https://docs.langchain.com/langsmith/smithdb-sdk-migration#feedback-create
            start_time (Optional[datetime]):
                The start time of the run. Better performance if provided.
            extend_trace_retention (bool, default=True):
                If false, create the feedback without extending the trace's retention
                tier.
            **kwargs (Any):
                Additional keyword arguments.

        Returns:
            Feedback: The created feedback object.

        Example:
            ```python
            from langsmith import trace, traceable, Client


            @traceable
            def foo(x):
                return {"y": x * 2}


            @traceable
            def bar(y):
                return {"z": y - 1}


            client = Client()

            inputs = {"x": 1}
            with trace(name="foobar", inputs=inputs) as root_run:
                result = foo(**inputs)
                result = bar(**result)
                root_run.outputs = result
                trace_id = root_run.id
                child_runs = root_run.child_runs

            # Provide feedback for a trace (a.k.a. a root run)
            client.create_feedback(
                key="user_feedback",
                score=1,
                trace_id=trace_id,
            )

            # Provide feedback for a child run
            foo_run_id = [run for run in child_runs if run.name == "foo"][0].id
            client.create_feedback(
                key="correctness",
                score=0,
                run_id=foo_run_id,
                # trace_id= is optional but recommended to enable batched and backgrounded
                # feedback ingestion.
                trace_id=trace_id,
            )
            ```
        Nz8One of run_id, trace_id, or project_id  must be providedz?project_id cannot be provided if run_id or trace_id is providedzLThe following arguments are no longer used in the create_feedback endpoint: )rC  zUnknown feedback source type Ú__runrÀ  r½  z+feedback_source.metadata['__run']['run_id']TrÊ  rÿ   rê  r}   r—  r~   rA  r$  Úfeedback_sourcer.  Úmodified_atrB  rÁ  r¿  rP  rQ  rÁ  rý  rR  Úuse_multipart_endpointz0.8.10r[   rÀ  r�  ú	/feedbackrL  )r>  r?  r@  zError creating feedbackr	  rh   )8rï   r¥  rž  rª   r«   r©   r”  r  r{  rG  ÚAPIÚAPIFeedbackSourcerH  ÚModelFeedbackSourcerC  rW   r‡  rÅ  rÆ  r½  ra  rÉ  ÚFeedbackCreater�  rÃ  rc   rÍ  rÎ  r,  r:  r{   rî   r¤   Úis_version_greater_or_equalr  r!  rê  r&  r@   rB   r  r?   r1   r  r"  r  ró  r*   rÿ   r—  r/  rp  ÚFeedbackr@  ra   rý  )!râ  rÀ  r}   r—  r~   rê  rA  r$  r0  rC  rP  rO  rB  r?  rå  rP  rQ  rÁ  rý  rÁ  r¿  rR  r�   r[  Ú	_run_metaÚ_session_idÚfeedbackr³  r  r  r  Úfeedback_blockrM  s!                                    re   r?  zClient.create_feedbackÓ  sg  € ð\ Ð#˜8ˆØˆ>˜jÐ0ÝÐWÑXÔXÐXØÐ *Ð"8ÝØQñô ð ð Ð *Ð"4Ý& t¤yÑ1Ô1Ð1Øð 	ÝŒMð/Ý$ V™nœnð/ð /å"ñô ð ð
r	ÝÐ2µJÔ4QÑRÔRð Ý'1Ô'DØ(ñ(ô (Ð$ð $¥zÔ'DÔ'HÒHÐHåÔ0¸+ÐFÑFÔFð  �ð &­Ô)FÔ)LÒLÐLÝ",Ô"@È+Ð"VÑ"VÔ"V��å Ð!WÐAUÐ!WÐ!WÑXÔXÐXà,;Ô,DÐ,P�Ô(Ð(ÐVXð Ô$ð Ð(¨W¸OÔ<TÐ-TÐ-TØ5=½sÀ=Ñ?QÔ?QÐ4R�Ô(¨Ñ1ØÔ'ð >¨G°Ô7OÐ,OÐ,Oð />Ô.FÀwÔ.O�	Ý˜9 lÑ3Ô3ð 7½Ý˜I |Ñ4Ô4ñ9ô 9ð 7ð !*× 4Ò 4Ñ 6Ô 6�IØ˜yÐ(Ð(Ý*-Ý Ø+Ô4°WÔ=¸hÔGØIñô ñ+ô +�I˜hÑ'ð 5>�Ô(¨Ñ1å&Ø(Ð4�
�
¸*ÐRVðñ ô ˆKõ "Ô0ð ð ð Ý Ñ,Ô,Ð,ðõ $ F¸Ð=Ñ=Ô=Ð=ð	õ
 & h¸DÐAÑAÔAÐAðð �Cðõ -¨UÑ3Ô3Ð3ðð �eðð &˜:ðð  ˜ðð !0 ðõ $Ô,×0Ò0µÔ1BÔ1FÑGÔGÐGðõ %Ô-×1Ò1µ(Ô2CÔ2GÑHÔHÐHðð !0 ðð '˜;ðð  &˜:ð!õ" +7Ø-¸4ð+ñ +ô +ð +ð#õ( #/Ð/@ÈdÐ"SÑ"SÔ"SÐ"Sð)ð* �eð+ð, �eð-ð. (>Ð'=ð/ˆHð4 !%Ô 8Ð8ð 2Ø”	Ô-Ð3°ßŠcÐ*¨DÑ1Ô1ð ð
 ñ*à*ñ*ð ”IÔ%ñ*õ Ô8¸¼Ô9JÈHÑUÔUð	*ð Ô&Ð2°dÔ6LÐ6XàÔ%Ð1ØÔ&Ð.å 7¸Ñ AÔ A�ØÔ)Ð5åTØ)ñô ð #ð
 Ô/Ô4ð 	Að 	AÝ#GØ*Ø Ô2Ý%ñ$ô $˜ð
 $ð AØ Ô2Ð>Ô>À!ÑCÐ>Ô>Ø#Ô9ð AØ $Ô :× >Ò >Ñ @Ô @Ð @ð	Að 	Að 	Añ 	Aô 	Að 	Að 	Að 	Að 	Að 	Að 	Aøøøð 	Að 	Að 	Að 	Aøð Ô'Ð3Ø×+Ò+Ý(­¨X¬[Ñ)9Ô)9¸=ÑIÔIñô ð øõ "-¨X×-@Ò-@ÈdÐ-@Ñ-SÔ-SÑ!TÔ!T�Ø×)Ò)ØØà ð$ð (:Ý&Ô=Ð?ð *ñ ô ð õ Ô&Ð?Ð?¨×)<Ò)<Ñ)>Ô)>Ð?Ð?Ð?øÝð 	ð 	ð 	Ý�LŠLÐ2¸TˆLÑBÔBÐBØˆGøøøøð	øøøs?   Á0L R% ÎAO/Ï#R% Ï/O3Ï3R% Ï6O3Ï7B-R% Ò%
SÒ/SÓS)r—  r~   rA  r$  c               ó  — i }|�t          |¦  «        |d<   |�||d<   |�||d<   |�||d<   |                      ddt          |d¦  «        › �i | j        ¥d	d
i¥t	          |¦  «        ¬¦  «        }t          j        |¦  «         dS )aj  Update a feedback in the LangSmith API.

        Args:
            feedback_id (Union[UUID, str]):
                The ID of the feedback to update.
            score (Optional[Union[float, int, bool]]):
                The score to update the feedback with.
            value (Optional[Union[float, int, bool, str, dict]]):
                The value to update the feedback with.
            correction (Optional[dict]):
                The correction to update the feedback with.
            comment (Optional[str]):
                The comment to update the feedback with.

        Returns:
            None
        Nr—  r~   rA  r$  rº  ú
/feedback/rO  rN  r  r•  )r�  r/  ra  r  r—  r¤   r0  )râ  rO  r—  r~   rA  r$  Úfeedback_updater2  s           re   Úupdate_feedbackzClient.update_feedbackä   s¼   € ð4 +-ˆØÐÝ'=¸eÑ'DÔ'DˆO˜GÑ$ØÐØ',ˆO˜GÑ$ØÐ!Ø,6ˆO˜LÑ)ØÐØ)0ˆO˜IÑ&Ø×,Ò,ØØ?� +¨}Ñ=Ô=Ð?Ð?ØI�t”}ÐI nÐ6HÐIÐIÝ˜_Ñ-Ô-ð	 -ñ 
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   c                ó–   — |                       ddt          |d¦  «        › �¦  «        }t          j        di |                     ¦   «         ¤ŽS )zÑRead a feedback from the LangSmith API.

        Args:
            feedback_id (Union[UUID, str]):
                The ID of the feedback to read.

        Returns:
            Feedback: The feedback.
        r-  rj  rO  rh   )r/  ra  r{  rd  rù  ©râ  rO  r2  s      re   Úread_feedbackzClient.read_feedback!  sR   € ð ×,Ò,ØØ?� +¨}Ñ=Ô=Ð?Ð?ñ
ô 
ˆõ Ô"Ð5Ð5 X§]¢]¡_¤_Ð5Ð5Ð5ri   )r  Úfeedback_keyrC  r‹  rp  ú1Optional[Sequence[ls_schemas.FeedbackSourceType]]úIterator[ls_schemas.Feedback]c             +  óî   K  — ||�t          |d¦  «        nddœ|¥}|�||d<   |�||d<   t          |                      d|¬¦  «        ¦  «        D ]&\  }}t          j        d	i |¤ŽV — |�|dz   |k    r dS Œ'dS )
aÜ  List the feedback objects on the LangSmith API.

        Args:
            run_ids (Optional[Sequence[Union[UUID, str]]]):
                The IDs of the runs to filter by.
            feedback_key (Optional[Sequence[str]]):
                The feedback key(s) to filter by. Examples: 'correctness'
                The query performs a union of all feedback keys.
            feedback_source_type (Optional[Sequence[FeedbackSourceType]]):
                The type of feedback source, such as model or API.
            limit (Optional[int]):
                The maximum number of feedback to return.
            **kwargs (Any):
                Additional keyword arguments.

        Yields:
            The feedback objects.
        Nrj  )r»  r‹  r}   rï  r^  r†  r[   rh   )r0  r  rŽ  r{  rd  )	râ  r  rp  rC  r‹  r�   r‡  r   rg  s	            re   Úlist_feedbackzClient.list_feedback!  sÌ   è è € ð8 Ø(-Ð(9•S˜ ‘_”_�_¸sð
ð 
ð ð
ˆð
 Ð#Ø(ˆF�5‰MØÐ+Ø3ˆF�8ÑÝ$Ø×$Ò$ [¸Ð$Ñ@Ô@ñ
ô 
ð 	ð 	‰KˆAˆxõ Ô%Ð1Ð1¨Ð1Ð1Ð1Ð1Ð1ØÐ  Q¨¡U¨e¢^ ^Ø��øð	ð 	ri   c                óŠ   — |                       ddt          |d¦  «        › �| j        ¬¦  «        }t          j        |¦  «         dS )z±Delete a feedback by ID.

        Args:
            feedback_id (Union[UUID, str]):
                The ID of the feedback to delete.

        Returns:
            None
        rV  rj  rO  rW  NrX  rn  s      re   Údelete_feedbackzClient.delete_feedbackJ!  sT   € ð ×,Ò,ØØ?� +¨}Ñ=Ô=Ð?Ð?Ø”Mð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   )r~   rA  r$  rC  rT  c               ó  — t          || j        d¬¦  «        \  }}|| j        k    rt          d|› �¦  «        ‚|                      ddt	          |¦  «        › �t          |||||dœ¦  «        | j        ¬¦  «        }	t          j        |	¦  «         dS )	a½  Create feedback from a presigned token or URL.

        Args:
            token_or_url (Union[str, uuid.UUID]): The token or URL from which to create
                feedback.
            score (Optional[Union[float, int, bool]]): The score of the feedback.
            value (Optional[Union[float, int, bool, str, dict]]): The value of the
                feedback.
            correction (Optional[dict]): The correction of the feedback.
            comment (Optional[str]): The comment of the feedback.
            metadata (Optional[dict]): Additional metadata for the feedback.

        Raises:
            ValueError: If the source API URL is invalid.

        Returns:
            None
        r[   )rU  zInvalid source API URL. r�  z/feedback/tokens/)r—  r~   rA  r$  rC  r  N)	rf  rk   rï   r/  ra  r—  r  r¤   r0  )
râ  r   r—  r~   rA  r$  rC  r  re  r2  s
             re   Úcreate_feedback_from_tokenz!Client.create_feedback_from_token[!  sÂ   € õ8 &9Ø˜$œ,°!ð&
ñ &
ô &
Ñ"ˆ˜
ð ˜Tœ\Ò)Ð)ÝÐH¸ÐHÐHÑIÔIÐIØ×,Ò,ØØ6¥¨Ñ 4Ô 4Ð6Ð6Ýà"Ø"Ø",Ø&Ø (ðð ñ	ô 	ð ”Mð -ñ 
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   )Ú
expirationrB  rO  ry  ú0Optional[datetime.datetime | datetime.timedelta]úls_schemas.FeedbackIngestTokenc               ó~  — ||||pt          t          j        ¦   «         ¦  «        dœ}|€t          j        ddd¬¦  «        |d<   nžt          |t          j        ¦  «        r|                     ¦   «         |d<   nlt          |t          j        ¦  «        r3t          j        |j	        |j
        dz  |j
        d	z  d	z  ¬¦  «        |d<   nt          d
t          |¦  «        › �¦  «        ‚|                      ddt          |¦  «        ¬¦  «        }t          j        |¦  «         t          j        di |                     ¦   «         ¤ŽS )a�  Create a pre-signed URL to send feedback data to.

        This is useful for giving browser-based clients a way to upload
        feedback data directly to LangSmith without accessing the
        API key.

        Args:
            run_id (Union[UUID, str]):
                The ID of the run.
            feedback_key (str):
                The key of the feedback to create.
            expiration (Optional[datetime.datetime | datetime.timedelta]): The expiration time of the pre-signed URL.
                Either a datetime or a timedelta offset from now.
                Default to 3 hours.
            feedback_config (Optional[FeedbackConfig]):
                If creating a feedback_key for the first time,
                this defines how the metric should be interpreted,
                such as a continuous score (w/ optional bounds),
                or distribution over categorical values.
            feedback_id (Optional[Union[UUID, str]): The ID of the feedback to create. If not provided, a new
                feedback will be created.

        Returns:
            FeedbackIngestToken: The pre-signed URL for uploading feedback data.
        )rÀ  rp  rB  rÿ   Nr   r“   ©r#  ÚhoursÚminutesÚ
expires_inÚ
expires_até  rP   úUnknown expiration type: r�  ú/feedback/tokens)rL  rh   )rW   r[  rð  r{  ÚTimeDeltaInputr  rÃ  rÄ  r.  r#  Úsecondsrï   r  r/  r—  r¤   r0  ÚFeedbackIngestTokenrù  )râ  rÀ  rp  ry  rB  rO  rÅ  r2  s           re   Úcreate_presigned_feedback_tokenz&Client.create_presigned_feedback_token�!  sd  € ðF Ø(Ø.ØÐ2¥¥T¤Z¡\¤\Ñ!2Ô!2ð	 
ð  
ˆð ÐÝ!+Ô!:ØØØð"ñ "ô "ˆD�ÑÐõ
 ˜
¥HÔ$5Ñ6Ô6ð 		MØ!+×!5Ò!5Ñ!7Ô!7ˆD�ÑÐÝ˜
¥HÔ$6Ñ7Ô7ð 	MÝ!+Ô!:Ø”_Ø Ô(¨DÑ0Ø#Ô+¨rÑ1°RÑ7ð"ñ "ô "ˆD�ÑÐõ ÐK½¸jÑ9IÔ9IÐKÐKÑLÔLÐLà×,Ò,ØØÝ˜TÑ"Ô"ð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5ÝÔ-Ð@Ð@°·²±´Ð@Ð@Ð@ri   )ry  Úfeedback_configsÚfeedback_keysr‰  ú7Optional[Sequence[Optional[ls_schemas.FeedbackConfig]]]ú(Sequence[ls_schemas.FeedbackIngestToken]c               óÖ  ‡ ‡‡	‡
‡‡‡— |�/t          |¦  «        t          |¦  «        k    rt          d¦  «        ‚|sdgt          |¦  «        z  }d\  ŠŠ|€t          j        ddd¬¦  «        Šn˜t	          |t
          j        ¦  «        r|                     ¦   «         Šnit	          |t
          j        ¦  «        r0t          j        |j        |j	        dz  |j	        dz  dz  ¬¦  «        Šnt          d	t          |¦  «        › �¦  «        ‚t          ˆˆˆfd
„t          ||¦  «        D ¦   «         ¦  «        Š	dˆ	ˆ fd„Šg }t          j        t          ‰ j        ¦  «        ¬¦  «        5 Š
ˆ
ˆfd„‰ j                             ¦   «         D ¦   «         }t          j        |¦  «        D ]5}|                     ¦   «         }|                     d„ |D ¦   «         ¦  «         Œ6	 ddd¦  «         n# 1 swxY w Y   |S )a  Create a pre-signed URL to send feedback data to.

        This is useful for giving browser-based clients a way to upload
        feedback data directly to LangSmith without accessing the
        API key.

        Args:
            run_id (Union[UUID, str]):
                The ID of the run.
            feedback_keys (Sequence[str]):
                The key of the feedback to create.
            expiration (Optional[datetime.datetime | datetime.timedelta]): The expiration time of the pre-signed URL.
                Either a datetime or a timedelta offset from now.
                Default to 3 hours.
            feedback_configs (Optional[Sequence[Optional[FeedbackConfig]]]):
                If creating a feedback_key for the first time,
                this defines how the metric should be interpreted,
                such as a continuous score (w/ optional bounds),
                or distribution over categorical values.

        Returns:
            Sequence[FeedbackIngestToken]: The pre-signed URL for uploading feedback data.
        NzBThe length of feedback_keys and feedback_configs must be the same.©NNr   r“   r}  r‚  rP   rƒ  c                ó&   •— g | ]\  }}‰||‰‰d œ‘ŒS ))rÀ  rp  rB  r€  r�  rh   )r|   rp  rB  r�  r€  rÀ  s      €€€re   rZ  z;Client.create_presigned_feedback_tokens.<locals>.<listcomp>
"  sE   ø€ ð ð ð ñ 2�L /ð %Ø$0Ø'6Ø",Ø",ðð ðð ð ri   rk   rW   r’  r‡  rX   r  c                ó¾   •— ‰                      d| › d�‰i ‰j        ¥t          |p‰j        i¥dœ¬¦  «        }t	          j        |¦  «         |                     ¦   «         S )Nr�  r„  r  r”  )r/  r  rv  r’  r¤   r0  rù  )rk   r’  r2  rÅ  râ  s      €€re   Úreqz4Client.create_presigned_feedback_tokens.<locals>.req"  s   ø€ Ø×0Ò0ØØÐ,Ð,Ð,à ð Øœ-ð å! 7Ð#:¨d¬lð ð  ð ð  ð 1ñ 
ô 
ˆHõ Ô/°Ñ9Ô9Ð9Ø—=’=‘?”?Ð"ri   rµ  c                óD   •— g | ]\  }}‰                      ‰||¦  «        ‘ŒS rh   ©r>  )r|   rk   r’  rA  r‘  s      €€re   rZ  z;Client.create_presigned_feedback_tokens.<locals>.<listcomp>)"  s=   ø€ ð ð ð á$�G˜Wð —’  W¨gÑ6Ô6ðð ð ri   c                ó0   — g | ]}t          j        d i |¤Ž‘ŒS r—  )r{  r‡  )r|   r|  s     re   rZ  z;Client.create_presigned_feedback_tokens.<locals>.<listcomp>0"  s)   € ÐQÐQÐQÀ•ZÔ3Ð;Ð;°dÐ;Ð;ÐQÐQÐQri   )rk   rW   r’  r‡  rX   r  )rp   rï   r{  r…  r  rÃ  rÄ  r.  r#  r†  r  r—  rª  r¿  r>  r®  r‹   r?  r¹  r  )râ  rÀ  rŠ  ry  r‰  ÚtokensÚfutsÚfutr2  rÅ  rA  r�  r€  r‘  s   ``       @@@@@re   Ú create_presigned_feedback_tokensz'Client.create_presigned_feedback_tokensÎ!  s¶  øøøøøøø€ ðD Ð'­C°Ñ,>Ô,>Å#ÐFVÑBWÔBWÒ,WÐ,WÝØTñô ð ð  ð 	;Ø $˜v­¨MÑ(:Ô(:Ñ:Ðà!+Ñˆ
�JØÐÝ#Ô2ØØØðñ ô ˆJˆJõ
 ˜
¥HÔ$5Ñ6Ô6ð 		MØ#×-Ò-Ñ/Ô/ˆJˆJÝ˜
¥HÔ$6Ñ7Ô7ð 	MÝ#Ô2Ø”_Ø Ô(¨DÑ0Ø#Ô+¨rÑ1°RÑ7ðñ ô ˆJˆJõ ÐK½¸jÑ9IÔ9IÐKÐKÑLÔLÐLåðð ð ð ð ð õ 69Ø!Ð#3ñ6ô 6ðñ ô ñ
ô 
ˆð	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð ˆÝÔ"­s°4Ô3GÑ/HÔ/HÐIÑIÔIð 		ÈXðð ð ð ð à(,Ô(<×(BÒ(BÑ(DÔ(Dðñ ô ˆDõ ” tÑ,Ô,ð ð �ØŸ:š:™<œ<�Ø—’ØQÐQÈÐQÑQÔQñô ð ð ðð		ð 		ð 		ñ 		ô 		ð 		ð 		ð 		ð 		ð 		ð 		øøøð 		ð 		ð 		ð 		ð ˆs   Å A1GÇG"Ç%G")r‹  ú(Iterator[ls_schemas.FeedbackIngestToken]c             #  óê   K  — t          |d¦  «        |�t          |d¦  «        nddœ}t          |                      d|¬¦  «        ¦  «        D ]&\  }}t	          j        di |¤ŽV — |�|dz   |k    r dS Œ'dS )	a  List the feedback ingest tokens for a run.

        Args:
            run_id (Union[UUID, str]): The ID of the run to filter by.
            limit (Optional[int]): The maximum number of tokens to return.

        Yields:
            The feedback ingest tokens.
        rÀ  Nrj  )rÀ  r‹  r„  r†  r[   rh   )ra  r0  r  rŽ  r{  r‡  )râ  rÀ  r‹  r‡  r   Útokens         re   Úlist_presigned_feedback_tokensz%Client.list_presigned_feedback_tokens4"  s®   è è € õ  ˜v xÑ0Ô0Ø(-Ð(9•S˜ ‘_”_�_¸sð
ð 
ˆõ "Ø×$Ò$Ð%7ÀÐ$ÑGÔGñ
ô 
ð 	ð 	‰HˆAˆuõ Ô0Ð9Ð9°5Ð9Ð9Ð9Ð9Ð9ØÐ  Q¨¡U¨e¢^ ^Ø��øð	ð 	ri   z{Composite feedback formulas are no longer supported in the SDK. Add composite feedback scores via the LangSmith UI instead.)rg  rÁ  r‹  rŠ  ú$Iterator[ls_schemas.FeedbackFormula]c               ó*   — t          | j        ¦  «        ‚)a  List feedback formulas.

        .. admonition:: Deprecated

            Composite feedback formulas are no longer supported in the SDK.
            Add composite feedback scores via the LangSmith UI instead.
            This method now raises ``NotImplementedError``.
        ©ÚNotImplementedErrorÚ!_FEEDBACK_FORMULA_DEPRECATION_MSG)râ  rg  rÁ  r‹  rŠ  s        re   Úlist_feedback_formulaszClient.list_feedback_formulasY"  s   € õ( " $Ô"HÑIÔIÐIri   Úfeedback_formula_idúls_schemas.FeedbackFormulac                ó*   — t          | j        ¦  «        ‚)a  Get a feedback formula by ID.

        .. admonition:: Deprecated

            Composite feedback formulas are no longer supported in the SDK.
            Add composite feedback scores via the LangSmith UI instead.
            This method now raises ``NotImplementedError``.
        rŸ  ©râ  r£  s     re   Úget_feedback_formula_by_idz!Client.get_feedback_formula_by_ido"  s   € õ " $Ô"HÑIÔIÐIri   )rg  rÁ  Úaggregation_typeúLiteral['sum', 'avg']Úformula_partsúASequence[Union[ls_schemas.FeedbackFormulaWeightedVariable, dict]]c               ó*   — t          | j        ¦  «        ‚)a  Create a feedback formula.

        .. admonition:: Deprecated

            Composite feedback formulas are no longer supported in the SDK.
            Add composite feedback scores via the LangSmith UI instead.
            This method now raises ``NotImplementedError``.
        rŸ  )râ  rp  r¨  rª  rg  rÁ  s         re   Úcreate_feedback_formulazClient.create_feedback_formula€"  s   € õ. " $Ô"HÑIÔIÐIri   c               ó*   — t          | j        ¦  «        ‚)a  Update a feedback formula.

        .. admonition:: Deprecated

            Composite feedback formulas are no longer supported in the SDK.
            Add composite feedback scores via the LangSmith UI instead.
            This method now raises ``NotImplementedError``.
        rŸ  )râ  r£  rp  r¨  rª  s        re   Úupdate_feedback_formulazClient.update_feedback_formula™"  s   € õ, " $Ô"HÑIÔIÐIri   c                ó*   — t          | j        ¦  «        ‚)a  Delete a feedback formula by ID.

        .. admonition:: Deprecated

            Composite feedback formulas are no longer supported in the SDK.
            Add composite feedback scores via the LangSmith UI instead.
            This method now raises ``NotImplementedError``.
        rŸ  r¦  s     re   Údelete_feedback_formulazClient.delete_feedback_formula±"  s   € õ " $Ô"HÑIÔIÐIri   )Úis_lower_score_betterúls_schemas.FeedbackConfigr²  úls_schemas.FeedbackConfigSchemac               ó¬   — |||dœ}|                       dd|¬¦  «        }t          j        |¦  «         t          j        di |                     ¦   «         ¤ŽS )aD  Create a feedback configuration.

        Defines how feedback with a given key should be interpreted.
        If an identical configuration already exists for the key, it is
        returned unchanged. If a different configuration already exists
        for the key, an error is raised.

        Args:
            feedback_key (str):
                The feedback key to configure.
            feedback_config (FeedbackConfig):
                The configuration defining type, bounds, and categories.
            is_lower_score_better (Optional[bool]):
                Whether a lower score is considered better.
                Defaults to False.

        Returns:
            FeedbackConfigSchema: The created or existing feedback
                configuration.

        Raises:
            requests.HTTPError: If a conflicting configuration already
                exists for the given key (HTTP 400).

        Example:
            .. code-block:: python

                from langsmith import Client

                client = Client()
                config = client.create_feedback_config(
                    feedback_key="user-rating",
                    feedback_config={
                        "type": "continuous",
                        "min": 0.0,
                        "max": 5.0,
                    },
                )
        )rp  rB  r²  r�  ú/feedback-configsr  rh   ©r/  r¤   r0  r{  ÚFeedbackConfigSchemarù  ©râ  rp  rB  r²  rÅ  r2  s         re   Úcreate_feedback_configzClient.create_feedback_configÂ"  sq   € ð^ )Ø.Ø%:ð 
ð  
ˆð
 ×,Ò,ØØØð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5ÝÔ.ÐAÐA°·²±´ÐAÐAÐAri   )rp  r�  r‹  rŠ  ú)Iterator[ls_schemas.FeedbackConfigSchema]c             #  óê   K  — |�t          |d¦  «        nd|dœ}|�||d<   |�||d<   t          |                      d|¬¦  «        ¦  «        D ]&\  }}t          j        d	i |¤ŽV — |�|dz   |k    r dS Œ'dS )
a)  List feedback configurations.

        Args:
            feedback_key (Optional[Sequence[str]]):
                Filter by specific feedback keys.
            name_contains (Optional[str]):
                Filter by substring match on the feedback key.
            limit (Optional[int]):
                The maximum number of configurations to return.
            offset (int):
                The number of configurations to skip. Defaults to 0.

        Yields:
            FeedbackConfigSchema: The feedback configurations.

        Example:
            .. code-block:: python

                from langsmith import Client

                client = Client()
                for config in client.list_feedback_configs():
                    print(f"{config.feedback_key}: {config.feedback_config}")
        Nrj  ©r‹  rŠ  r}   r�  r¶  r†  r[   rh   )r0  r  rŽ  r{  r¸  )râ  rp  r�  r‹  rŠ  r‡  r   rÖ  s           re   Úlist_feedback_configszClient.list_feedback_configsý"  sÄ   è è € ðB ).Ð(9•S˜ ‘_”_�_¸sØð"
ð "
ˆð Ð#Ø(ˆF�5‰MØÐ$Ø&3ˆF�?Ñ#Ý"Ø×$Ò$Ð%8ÀÐ$ÑHÔHñ
ô 
ð 	ð 	‰IˆAˆvõ Ô1Ð;Ð;°FÐ;Ð;Ð;Ð;Ð;ØÐ  Q¨¡U¨e¢^ ^Ø��øð	ð 	ri   )rB  r²  c               óÄ   — d|i}|�||d<   |�||d<   |                       dd|¬¦  «        }t          j        |¦  «         t          j        di |                     ¦   «         ¤ŽS )	a½  Update a feedback configuration.

        Only the provided fields will be updated; others remain unchanged.

        Args:
            feedback_key (str):
                The feedback key of the configuration to update.
            feedback_config (Optional[FeedbackConfig]):
                The new configuration values.
            is_lower_score_better (Optional[bool]):
                Whether a lower score is considered better.

        Returns:
            FeedbackConfigSchema: The updated feedback configuration.

        Raises:
            LangSmithNotFoundError: If no configuration exists for the
                given feedback key (HTTP 404).

        Example:
            .. code-block:: python

                from langsmith import Client

                client = Client()
                config = client.update_feedback_config(
                    "user-rating",
                    is_lower_score_better=True,
                )
        rp  NrB  r²  rº  r¶  r  rh   r·  r¹  s         re   Úupdate_feedback_configzClient.update_feedback_config,#  sŠ   € ðL ˜Lð 
ˆð Ð&Ø&5ˆDÐ"Ñ#Ø Ð,Ø,AˆDÐ(Ñ)Ø×,Ò,ØØØð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5ÝÔ.ÐAÐA°·²±´ÐAÐAÐAri   c                ób   — |                       ddd|i¬¦  «        }t          j        |¦  «         dS )aÆ  Delete a feedback configuration.

        This performs a soft delete. The configuration can be recreated
        later with the same key.

        Args:
            feedback_key (str):
                The feedback key of the configuration to delete.

        Example:
            .. code-block:: python

                from langsmith import Client

                client = Client()
                client.delete_feedback_config("user-rating")
        rV  r¶  rp  r†  N©r/  r¤   r0  )râ  rp  r2  s      re   Údelete_feedback_configzClient.delete_feedback_config`#  sE   € ð$ ×,Ò,ØØØ" LÐ1ð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   )Ú	queue_idsr†  r�  r‹  rÄ  ú$Iterator[ls_schemas.AnnotationQueue]c             #  ó  K  — |�d„ t          |¦  «        D ¦   «         nd|||�t          |d¦  «        nddœ}t          |                      d|¬¦  «        ¦  «        D ]&\  }}t          j        di |¤ŽV — |�|dz   |k    r dS Œ'dS )	a  List the annotation queues on the LangSmith API.

        Args:
            queue_ids (Optional[List[Union[UUID, str]]]):
                The IDs of the queues to filter by.
            name (Optional[str]):
                The name of the queue to filter by.
            name_contains (Optional[str]):
                The substring that the queue name should contain.
            limit (Optional[int]):
                The maximum number of queues to return.

        Yields:
            The annotation queues.
        Nc                ó<   — g | ]\  }}t          |d |› d�¦  «        ‘ŒS )z
queue_ids[rü  )ra  rþ  s      re   rZ  z1Client.list_annotation_queues.<locals>.<listcomp>”#  s2   € ÐUÐUÐU±f°a¸•˜#Ð0¨AÐ0Ð0Ð0Ñ1Ô1ÐUÐUÐUri   rj  )r“  r†  r�  r‹  ú/annotation-queuesr†  r[   rh   )r  r0  rŽ  r{  ÚAnnotationQueue)râ  rÄ  r†  r�  r‹  r‡  r   Úqueues           re   Úlist_annotation_queueszClient.list_annotation_queues{#  sà   è è € ð4 Ð(ð VÐUÅ	È)Ñ@TÔ@TÐUÑUÔUÐUààØ*Ø(-Ð(9•S˜ ‘_”_�_¸sð	
ð 	
ˆõ "Ø×$Ò$Ð%9À&Ð$ÑIÔIñ
ô 
ð 	ð 	‰HˆAˆuõ Ô,ð ð Øðð ð ð ð ð Ð  Q¨¡U¨e¢^ ^Ø��øð	ð 	ri   )rš  Úqueue_idÚrubric_instructionsÚrubric_itemsrÌ  rÍ  rÎ  ú4Optional[list[ls_schemas.AnnotationQueueRubricItem]]ú%ls_schemas.AnnotationQueueWithDetailsc               óR  — |||�t          |¦  «        nt          t          j        ¦   «         ¦  «        |dœ}|�||d<   |                      ddd„ |                     ¦   «         D ¦   «         ¬¦  «        }t          j        |¦  «         t          j        di | 	                    ¦   «         ¤ŽS )	a<  Create an annotation queue on the LangSmith API.

        Args:
            name (str):
                The name of the annotation queue.
            description (Optional[str]):
                The description of the annotation queue.
            queue_id (Optional[Union[UUID, str]]):
                The ID of the annotation queue.
            rubric_instructions (Optional[str]):
                The rubric instructions for the annotation queue.
            rubric_items (Optional[list[AnnotationQueueRubricItem]]):
                The feedback configs to assign to this queue's rubric.
                Each item specifies a feedback_key and optional per-queue
                customization like description and value_descriptions.

        Returns:
            AnnotationQueue: The created annotation queue object.
        N)r†  rš  rÿ   rÍ  rÎ  r�  rÈ  c                ó   — i | ]
\  }}|®||“ŒS ry   rh   r5  s      re   r€   z2Client.create_annotation_queue.<locals>.<dictcomp>Ì#  s   € ÐAÐAÐA™4˜1˜a°1°=�!�Q°=°=°=ri   r  rh   )
rW   r[  rð  r/  r‹   r¤   r0  r{  ÚAnnotationQueueWithDetailsrù  )râ  r†  rš  rÌ  rÍ  rÎ  rÅ  r2  s           re   Úcreate_annotation_queuezClient.create_annotation_queue¥#  sÁ   € ð: Ø&Ø#+Ð#7•#�h‘-”-�-½SÅÄÁÄÑ=NÔ=NØ#6ð	 
ð  
ˆð Ð#Ø#/ˆD�Ñ Ø×,Ò,ØØ ØAÐA 4§:¢:¡<¤<ÐAÑAÔAð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5ÝÔ4ð 
ð 
Ø�mŠm‰oŒoð
ð 
ð 	
ri   úls_schemas.AnnotationQueuec                óÒ   — dt          |d¦  «        › �}|                      d|› | j        ¬¦  «        }t          j        |¦  «         t          j        di |                     ¦   «         ¤ŽS )zìRead an annotation queue with the specified `queue_id`.

        Args:
            queue_id (Union[UUID, str]): The ID of the annotation queue to read.

        Returns:
            AnnotationQueue: The annotation queue object.
        ú/annotation-queues/rÌ  r-  rW  rh   )ra  r/  r  r¤   r0  r{  rÓ  rù  )râ  rÌ  r¹  r2  s       re   Úread_annotation_queuezClient.read_annotation_queueÓ#  su   € ð J­°(¸JÑ)GÔ)GÐIÐIˆØ×,Ò,ØØˆMØ”Mð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5ÝÔ4ÐGÐG°x·}²}±´ÐGÐGÐGri   )r†  rš  rÍ  rÎ  c               ó¼   — i }|�||d<   |�||d<   |�||d<   |�||d<   |                       ddt          |d¦  «        › �|¬	¦  «        }t          j        |¦  «         dS )
a{  Update an annotation queue with the specified `queue_id`.

        Args:
            queue_id (Union[UUID, str]): The ID of the annotation queue to update.
            name (Optional[str]): The new name for the annotation queue.
            description (Optional[str]): The new description for the
                annotation queue.
            rubric_instructions (Optional[str]): The new rubric instructions for the
                annotation queue.
            rubric_items (Optional[list[AnnotationQueueRubricItem]]):
                The feedback configs to assign to this queue's rubric.

        Returns:
            None
        Nr†  rš  rÍ  rÎ  rº  r×  rÌ  r  ©r/  ra  r¤   r0  )râ  rÌ  r†  rš  rÍ  rÎ  rÅ  r2  s           re   Úupdate_annotation_queuezClient.update_annotation_queueå#  s—   € ð0  "ˆØÐØˆD�‰LØÐ"Ø"-ˆD�ÑØÐ*Ø*=ˆDÐ&Ñ'ØÐ#Ø#/ˆD�Ñ Ø×,Ò,ØØB¥(¨8°ZÑ"@Ô"@ÐBÐBØð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   c                ó’   — |                       ddt          |d¦  «        › �ddi| j        ¥¬¦  «        }t          j        |¦  «         dS )zÇDelete an annotation queue with the specified `queue_id`.

        Args:
            queue_id (Union[UUID, str]): The ID of the annotation queue to delete.

        Returns:
            None
        rV  r×  rÌ  r  r  rW  NrX  )râ  rÌ  r2  s      re   Údelete_annotation_queuezClient.delete_annotation_queue$  s_   € ð ×,Ò,ØØB¥(¨8°ZÑ"@Ô"@ÐBÐBØÐ1ÐC°T´]ÐCð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   )r  rö  ú%Optional[Sequence[ls_schemas.RunKey]]c               ó®  — |�|�t          j        d¦  «        ‚|�.dt          |d¦  «        › d�}d„ t          |¦  «        D ¦   «         }n`|�Jt	          j        dt          d¬	¦  «         dt          |d¦  «        › d
�}d„ t          |¦  «        D ¦   «         }nt          j        d¦  «        ‚|                      d||¬¦  «        }t          j        |¦  «         dS )aü  Add runs to an annotation queue with the specified `queue_id`.

        Provide exactly one of `runs` or `run_ids`:

        - `runs` (preferred): each entry carries the run's full lookup key
          (`run_id`, `session_id`, `start_time`, and an optional
          `source_proposed_example_id`). This lets the run be located directly,
          without a scan, and is required for workspaces served by SmithDB.
        - `run_ids`: a plain list of run IDs. This path is deprecated and will
          be removed after Jan 31, 2027; prefer `runs`.
          See https://docs.langchain.com/langsmith/smithdb-sdk-migration#annotation-queues-add-runs.

        Args:
            queue_id (Union[UUID, str]): The ID of the annotation queue.
            run_ids (Optional[List[Union[UUID, str]]]): The IDs of the runs to be
                added to the annotation queue.
            runs (Optional[Sequence[RunKey]]): The runs to add, each with
                its full lookup key.

        Returns:
            None
        Nz+Provide exactly one of `runs` or `run_ids`.r×  rÌ  z/runs/by-keyc                ó4   — g | ]\  }}t          ||¦  «        ‘ŒS rh   )rÆ  )r|   r   r»  s      re   rZ  z7Client.add_runs_to_annotation_queue.<locals>.<listcomp>A$  s'   € ÐRÐRÐR¹¸¸3Õ+¨C°Ñ3Ô3ÐRÐRÐRri   a  The run_ids parameter of add_runs_to_annotation_queue() is deprecated and will be removed after Jan 31, 2027. Use the runs parameter with RunKey objects instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#annotation-queues-add-runs for the migration guide.r6  r¢   r  c           
     óV   — g | ]&\  }}t          t          |d |› d�¦  «        ¦  «        ‘Œ'S )zrun_ids[rü  rý  rþ  s      re   rZ  z7Client.add_runs_to_annotation_queue.<locals>.<listcomp>K$  sC   € ð ð ð Ù8>¸¸3••H˜S /¨Q / / /Ñ2Ô2Ñ3Ô3ðð ð ri   r�  r  )	r¤   r§   ra  r  rª   r«   r”  r/  r0  )râ  rÌ  r  rö  r_  Ú	json_bodyr2  s          re   Úadd_runs_to_annotation_queuez#Client.add_runs_to_annotation_queue$  s#  € ð: Ð Ð 3ÝÔ-Ø=ñô ð ð ÐØU­°(¸JÑ)GÔ)GÐUÐUÐUˆDØRÐRÅ)ÈDÁ/Ä/ÐRÑRÔRˆIˆIØÐ ÝŒMðEõ #Øðñ ô ð ð O­°(¸JÑ)GÔ)GÐNÐNÐNˆDðð ÝBKÈGÑBTÔBTðñ ô ˆIˆIõ Ô-Ø=ñô ð ð ×,Ò,¨V°TÀ	Ð,ÑJÔJˆÝÔ+¨HÑ5Ô5Ð5Ð5Ð5ri   c          
     óž   — |                       ddt          |d¦  «        › dt          |d¦  «        › �¦  «        }t          j        |¦  «         dS )aC  Delete a run from an annotation queue with the specified `queue_id` and `run_id`.

        Args:
            queue_id (Union[UUID, str]): The ID of the annotation queue.
            run_id (Union[UUID, str]): The ID of the run to be added to the annotation
                queue.

        Returns:
            None
        rV  r×  rÌ  r»  rÀ  NrÚ  )râ  rÌ  rÀ  r2  s       re   Ú delete_run_from_annotation_queuez'Client.delete_run_from_annotation_queueU$  s^   € ð ×,Ò,ØØd¥(¨8°ZÑ"@Ô"@ÐdÐdÍÐQWÐYaÑHbÔHbÐdÐdñ
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5Ð5Ð5ri   r½  ú%ls_schemas.RunWithAnnotationQueueInfoc               óÜ   — dt          |d¦  «        › d�}|                      d|› d|› �| j        ¬¦  «        }t          j        |¦  «         t          j        di |                     ¦   «         ¤ŽS )aË  Get a run from an annotation queue at the specified index.

        Args:
            queue_id (Union[UUID, str]): The ID of the annotation queue.
            index (int): The index of the run to retrieve.

        Returns:
            RunWithAnnotationQueueInfo: The run at the specified index.

        Raises:
            LangSmithNotFoundError: If the run is not found at the given index.
            LangSmithError: For other API-related errors.
        r×  rÌ  ra  r-  rm   rW  rh   )ra  r/  r  r¤   r0  r{  ÚRunWithAnnotationQueueInforù  )râ  rÌ  r½  r¹  r2  s        re   Úget_run_from_annotation_queuez$Client.get_run_from_annotation_queueh$  s„   € ð  N­°(¸JÑ)GÔ)GÐMÐMÐMˆØ×,Ò,ØØÐ!Ð!˜%Ð!Ð!Ø”Mð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5ÝÔ4ÐGÐG°x·}²}±´ÐGÐGÐGri   )r  r‹  r  úHOptional[Literal['needs_my_review', 'needs_others_review', 'completed']]ú/Iterator[ls_schemas.RunWithAnnotationQueueInfo]c             #  ó  K  — d|�t          |d¦  «        ndi}|�||d<   dt          |d¦  «        › d�}t          |                      ||¬¦  «        ¦  «        D ]&\  }}t	          j        d
i |¤ŽV — |�|d	z   |k    r dS Œ'dS )aL  List runs in an annotation queue with the specified `queue_id`.

        Args:
            queue_id (Union[UUID, str]): The ID of the annotation queue.
            status (Optional[Literal["needs_my_review", "needs_others_review", "completed"]]):
                Filter runs by review status. If None, returns runs across all
                review states.
            limit (Optional[int]): The maximum number of runs to return.

        Yields:
            The runs currently in the annotation queue, with queue metadata
            (e.g. ``added_at``, ``last_reviewed_time``).
        r‹  Nrj  r  r×  rÌ  r  r†  r[   rh   )r0  ra  r  rŽ  r{  rè  )râ  rÌ  r  r‹  r‡  r_  r   r»  s           re   Úlist_runs_from_annotation_queuez&Client.list_runs_from_annotation_queue�$  sÀ   è è € ð. ¨Ð(9•S˜ ‘_”_�_¸sð
ˆð ÐØ%ˆF�8ÑØJ¥X¨h¸
Ñ%CÔ%CÐJÐJÐJˆÝ × 8Ò 8¸ÀfÐ 8Ñ MÔ MÑNÔNð 	ð 	‰FˆAˆsÝÔ7Ð>Ð>¸#Ð>Ð>Ð>Ð>Ð>ØÐ  Q¨¡U¨e¢^ ^Ø��øð	ð 	ri   )rä  rš  r.  rC  rÿ   Úexperimentsrä  ú ls_schemas.ComparativeExperimentc               óR  — |st          d¦  «        ‚|€!|                      |d         ¬¦  «        j        }|st          d¦  «        ‚|pt          t	          j        ¦   «         ¦  «        |||||p-t          j                             t          j        j	        ¦  «        i dœ}|�||d         d<   t          d	„ |                     ¦   «         D ¦   «         ¦  «        }	|                      d
dd|	i¬¦  «        }
t          j        |
¦  «         |
                     ¦   «         }t!          j        di |¤ŽS )a�  Create a comparative experiment on the LangSmith API.

        These experiments compare 2 or more experiment results over a shared dataset.

        Args:
            name (str): The name of the comparative experiment.
            experiments (Sequence[Union[UUID, str]]): The IDs of the experiments to compare.
            reference_dataset (Optional[Union[UUID, str]]): The ID of the dataset these experiments are compared on.
            description (Optional[str]): The description of the comparative experiment.
            created_at (Optional[datetime.datetime]): The creation time of the comparative experiment.
            metadata (Optional[Dict[str, Any]]): Additional metadata for the comparative experiment.
            id (Optional[Union[UUID, str]]): The ID of the comparative experiment.

        Returns:
            ComparativeExperiment: The created comparative experiment object.
        z$At least one experiment is required.Nr   r¦  z A reference dataset is required.)rÿ   r†  Úexperiment_idsrŠ  rš  r.  rÁ  rÁ  rC  c                ó   — i | ]\  }}||“Œ	S rh   rh   r5  s      re   r€   z8Client.create_comparative_experiment.<locals>.<dictcomp>Ñ$  s   € Ð9Ð9Ð9¡D A q˜1˜aÐ9Ð9Ð9ri   r�  z/datasets/comparativerL  r”  rh   )rï   r  rŠ  rW   r[  rð  rÃ  rc   rÍ  rÎ  r—  r‹   r/  r¤   r0  rù  r{  ÚComparativeExperiment)râ  r†  rî  rä  rš  r.  rC  rÿ   rÅ  Úserr2  Ú
response_ds               re   Úcreate_comparative_experimentz$Client.create_comparative_experiment¢$  sN  € ð6 ð 	EÝÐCÑDÔDÐDØÐ$à $× 1Ò 1Ø& qœ>ð !2ñ !ô !ä"ð ð !ð 	AÝÐ?Ñ@Ô@Ð@àÐ)��DœJ™LœLÑ)Ô)ØØ)Ø$5Ø&Ø$ÐT­Ô(9×(=Ò(=½hÔ>OÔ>SÑ(TÔ(TØð 
ð  
ˆð ÐØ(0ˆD�ŒM˜*Ñ%ÝÐ9Ð9¨D¯JªJ©L¬LÐ9Ñ9Ô9Ñ:Ô:ˆØ×,Ò,ØØ#à˜ðð -ñ 
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5Ø—]’]‘_”_ˆ
ÝÔ/Ð=Ð=°*Ð=Ð=Ð=ri   r  c                óL   — |                       ¦   «         }|dk    p
|j        |k    S )zçCheck if the current workspace has the same handle as owner.

        Args:
            owner (str): The owner to check against.

        Returns:
            bool: True if the current tenant is the owner, False otherwise.
        r  )r6  Útenant_handle)râ  r  Úsettingss      re   Ú_current_tenant_is_ownerzClient._current_tenant_is_ownerÝ$  s,   € ð ×%Ò%Ñ'Ô'ˆØ˜Š|Ð>˜xÔ5¸Ò>Ð>ri   Úactionúls_utils.LangSmithUserErrorc                ój   — t          j        d|› d|                      ¦   «         j        › d|› �¦  «        S )NzCannot z% for another tenant.
Current tenant: z,
Requested tenant: )r¤   r§   r6  rø  )râ  rû  r  s      re   Ú_owner_conflict_errorzClient._owner_conflict_erroré$  sS   € õ Ô*ð)�fð )ð )Ø#×1Ò1Ñ3Ô3ÔAð)ð )à!&ð)ð )ñ
ô 
ð 	
ri   Úprompt_owner_and_namec                ó˜   — |                       dd|› d�||dœ¬¦  «        }|                     ¦   «         d         }|r|d         d         nd	S )
aŸ  Get the latest commit hash for a prompt.

        Args:
            prompt_owner_and_name (str): The owner and name of the prompt.
            limit (int, default=1): The maximum number of commits to fetch. Defaults to 1.
            offset (int, default=0): The number of commits to skip. Defaults to 0.

        Returns:
            Optional[str]: The latest commit hash, or None if no commits are found.
        r-  ú	/commits/rm   r½  r†  Úcommitsr   rF  N)r/  rù  )râ  rÿ  r‹  rŠ  r2  r  s         re   Ú_get_latest_commit_hashzClient._get_latest_commit_hashò$  sh   € ð ×,Ò,ØØ0Ð-Ð0Ð0Ð0Ø"¨fÐ5Ð5ð -ñ 
ô 
ˆð
 —-’-‘/”/ )Ô,ˆØ,3Ð=ˆw�qŒz˜-Ô(Ð(¸Ð=ri   Ú	commit_idúUnion[str, list[str]]c                ó"  ‡ ‡‡‡‡— t          |t          ¦  «        r|gn|}dˆˆˆ fd„Št          j        ¦   «         5 Šˆˆfd„|D ¦   «         }t          j        |¦  «        D ]}|                     ¦   «          Œ	 ddd¦  «         dS # 1 swxY w Y   dS )a‡  Update tags for a prompt commit.

        Args:
            prompt_owner_and_name (str): The owner and name of the prompt in the format 'owner/repo'.
            commit_id (str): The commit hash/ID to tag.
            tags (Union[str, list[str]]): A single tag or list of tags to apply to the commit.

        Raises:
            requests.exceptions.HTTPError: If the request fails.
        r  rW   c                ór   •— | ‰dœ}‰                      dd‰› d�|¬¦  «        }t          j        |¦  «         d S )N)Útag_namer  r�  ú/repos/r  r  rÂ  )r  r·  r2  r  rÿ  râ  s      €€€re   Ú
create_tagz.Client._create_commit_tags.<locals>.create_tag%  s^   ø€ àØ&ðð ˆGð ×0Ò0ØÐ>Ð"7Ð>Ð>Ð>ÀWð 1ñ ô ˆHõ Ô/°Ñ9Ô9Ð9Ð9Ð9ri   c                ó<   •— g | ]}‰                      ‰|¦  «        ‘ŒS rh   r“  )r|   r  r
  rA  s     €€re   rZ  z.Client._create_commit_tags.<locals>.<listcomp>$%  s'   ø€ ÐLÐLÐL¸C�x—’ z°3Ñ7Ô7ÐLÐLÐLri   N)r  rW   )r  rW   r¿  r>  r?  r¹  )	râ  rÿ  r  r©  Útag_listrÃ  rA  r
  rA  s	   ```    @@re   Ú_create_commit_tagszClient._create_commit_tags%  s  øøøøø€ õ (¨­cÑ2Ô2Ð<�D�6�6¸ˆð	:ð 	:ð 	:ð 	:ð 	:ð 	:ð 	:ð 	:õ Ô"Ñ$Ô$ð 	 ¨ØLÐLÐLÐLÐLÀ8ÐLÑLÔLˆGåœ/¨'Ñ2Ô2ð  ð  �Ø—’‘”��ð ð	 ð 	 ð 	 ñ 	 ô 	 ð 	 ð 	 ð 	 ð 	 ð 	 ð 	 ð 	 øøøð 	 ð 	 ð 	 ð 	 ð 	 ð 	 s   »;BÂBÂBr  Úlikeúdict[str, int]c                óÂ   — t          j        |¦  «        \  }}}|                      dd|› d|› �d|i¬¦  «        }|                     ¦   «          |                     ¦   «         S )aš  Like or unlike a prompt.

        Args:
            prompt_identifier (str): The identifier of the prompt.
            like (bool): True to like the prompt, False to unlike it.

        Returns:
            A dictionary with the key 'likes' and the count of likes as the value.

        Raises:
            requests.exceptions.HTTPError: If the prompt is not found or
            another error occurs.
        r�  z/likes/rm   r  r  )r¤   r  r/  Úraise_for_statusrù  )râ  r  r  r  Úprompt_namer  r2  s          re   Ú_like_or_unlike_promptzClient._like_or_unlike_prompt)%  st   € õ  !)Ô @ÐARÑ SÔ SÑˆˆ{˜AØ×,Ò,ØÐ3˜eÐ3Ð3 kÐ3Ð3¸6À4¸.ð -ñ 
ô 
ˆð 	×!Ò!Ñ#Ô#Ð#Ø�}Š}‰ŒÐri   c           	     óö   — t          j        |¦  «        \  }}}|                      |¦  «        s| j        › d|› d|› d|dd…         › �S |                      ¦   «         }| j        › d|› d|dd…         › d|j        › �S )z®Get a URL for a prompt.

        Args:
            prompt_identifier (str): The identifier of the prompt.

        Returns:
            str: The URL for the prompt.

        z/hub/rm   ri  Nrå  z	/prompts/z?organizationId=)r¤   r  rú  r  r6  rÿ   )râ  r  r  r  rF  rù  s         re   Ú_get_prompt_urlzClient._get_prompt_url@%  s»   € õ +3Ô*JØñ+
ô +
Ñ'ˆˆ{˜Kð ×,Ò,¨UÑ3Ô3ð 	SØ”nÐRÐR¨5ÐRÐR°;ÐRÐRÀÈRÈaÈRÄÐRÐRÐRà×%Ò%Ñ'Ô'ˆàŒ~ð -ð -¨ð -ð -°kÀ"À1À"´oð -ð -Ø'œ{ð-ð -ð	
ri   c                ó8   — |                       |¦  «        }|rdndS )zÄCheck if a prompt exists.

        Args:
            prompt_identifier (str): The identifier of the prompt.

        Returns:
            bool: True if the prompt exists, False otherwise.
        TF)Ú
get_prompt)râ  r  rL  s      re   Ú_prompt_existszClient._prompt_existsW%  s%   € ð —’Ð!2Ñ3Ô3ˆØÐ(ˆtˆt 5Ð(ri   c                ó0   — |                       |d¬¦  «        S )zßLike a prompt.

        Args:
            prompt_identifier (str): The identifier of the prompt.

        Returns:
            Dict[str, int]: A dictionary with the key 'likes' and the count of likes as the value.

        T©r  ©r  ©râ  r  s     re   Úlike_promptzClient.like_promptc%  s   € ð ×*Ò*Ð+<À4Ð*ÑHÔHÐHri   c                ó0   — |                       |d¬¦  «        S )záUnlike a prompt.

        Args:
            prompt_identifier (str): The identifier of the prompt.

        Returns:
            Dict[str, int]: A dictionary with the key 'likes' and the count of likes as the value.

        Fr  r  r  s     re   Úunlike_promptzClient.unlike_prompto%  s   € ð ×*Ò*Ð+<À5Ð*ÑIÔIÐIri   rj  r&  )r‹  rŠ  Ú	is_publicÚis_archivedÚ
sort_fieldÚsort_directionrÿ  r   r!  r"  úls_schemas.PromptSortFieldr#  úLiteral['desc', 'asc']úls_schemas.ListPromptsResponsec          	     ó®   — |||rdn|�dnd|rdnd||||rdnddœ}|                       dd|¬¦  «        }	t          j        di |	                     ¦   «         ¤ŽS )	a'  List prompts with pagination.

        Args:
            limit (int, default=100): The maximum number of prompts to return. Defaults to 100.
            offset (int, default=0): The number of prompts to skip. Defaults to 0.
            is_public (Optional[bool]): Filter prompts by if they are public.
            is_archived (Optional[bool]): Filter prompts by if they are archived.
            sort_field (PromptSortField): The field to sort by.
                Defaults to "updated_at".
            sort_direction (Literal["desc", "asc"], default="desc"): The order to sort by.
                Defaults to "desc".
            query (Optional[str]): Filter prompts by a search query.

        Returns:
            ListPromptsResponse: A response object containing
            the list of prompts.
        r\  NÚfalse)r‹  rŠ  r   r!  r"  r#  rÿ  Úmatch_prefixr-  r	  r†  rh   )r/  r{  ÚListPromptsResponserù  )
râ  r‹  rŠ  r   r!  r"  r#  rÿ  r‡  r2  s
             re   Úlist_promptszClient.list_prompts{%  s‡   € ð: Øà#ÐS��°IÐ4I¨¨Ètà%0Ð=˜6˜6°gØ$Ø,ØØ&+Ð5˜F˜F°ð
ð 
ˆð ×,Ò,¨U°IÀfÐ,ÑMÔMˆÝÔ-Ð@Ð@°·²±´Ð@Ð@Ð@ri   úOptional[ls_schemas.Prompt]c                óê   — t          j        |¦  «        \  }}}	 |                      dd|› d|› �¦  «        }t          j        di |                     ¦   «         d         ¤ŽS # t           j        $ r Y dS w xY w)a£  Get a specific prompt by its identifier.

        Args:
            prompt_identifier (str): The identifier of the prompt.
                The identifier should be in the format "prompt_name" or "owner/prompt_name".

        Returns:
            Optional[Prompt]: The prompt object.

        Raises:
            requests.exceptions.HTTPError: If the prompt is not found or
                another error occurs.
        r-  r	  rm   rE  Nrh   )r¤   r  r/  r{  ÚPromptrù  rp  ©râ  r  r  r  r  r2  s         re   r  zClient.get_prompt§%  s—   € õ !)Ô @ÐARÑ SÔ SÑˆˆ{˜Að	Ø×0Ò0ØØ/˜%Ð/Ð/ +Ð/Ð/ñô ˆHõ Ô$Ð?Ð? x§}¢}¡¤°vÔ'>Ð?Ð?Ð?øÝÔ.ð 	ð 	ð 	Ø�4�4ð	øøøs   šAA ÁA2Á1A2©rš  Úreadmer©  r   r1  úls_schemas.Promptc               ó²  — |                       ¦   «         }|r|j        st          j        d¦  «        ‚t          j        |¦  «        \  }}}	|                      |¬¦  «        s|                      d|¦  «        ‚||pd|pd|pg |dœ}
|                      dd|
¬¦  «        }|                     ¦   «          t          j
        d
i |                     ¦   «         d	         ¤ŽS )aõ  Create a new prompt.

        Does not attach prompt object, just creates an empty prompt.

        Args:
            prompt_identifier (str): The identifier of the prompt.
                The identifier should be in the formatof owner/name:hash, name:hash, owner/name, or name
            description (Optional[str]): A description of the prompt.
            readme (Optional[str]): A readme for the prompt.
            tags (Optional[Sequence[str]]): A list of tags for the prompt.
            is_public (bool): Whether the prompt should be public.

        Returns:
            Prompt: The created prompt object.

        Raises:
            ValueError: If the current tenant is not the owner.
            HTTPError: If the server request fails.
        ú¥Cannot create a public prompt without first
creating a LangChain Hub handle. You can add a handle by creating a public prompt at:
https://smith.langchain.com/prompts)r  zcreate a promptr‹  )Úrepo_handlerš  r1  r©  r   r�  r	  r  rE  rh   )r6  rø  r¤   r§   r  rú  rþ  r/  r  r{  r.  rù  )râ  r  rš  r1  r©  r   rù  r  r  r  rù  r2  s               re   Úcreate_promptzClient.create_prompt¿%  s  € ð8 ×%Ò%Ñ'Ô'ˆØð 	˜XÔ3ð 	ÝÔ-ð6ñô ð õ !)Ô @ÐARÑ SÔ SÑˆˆ{˜AØ×,Ò,°5Ð,Ñ9Ô9ð 	GØ×,Ò,Ð->ÀÑFÔFÐFð 'Ø&Ð,¨"Ø�l Ø�J˜BØ"ð<
ð <
ˆð ×,Ò,¨V°YÀTÐ,ÑJÔJˆØ×!Ò!Ñ#Ô#Ð#ÝÔ Ð;Ð; 8§=¢=¡?¤?°6Ô#:Ð;Ð;Ð;ri   ©Úparent_commit_hashr©  rš  r  r8  c               óº  — |                       |¦  «        st          j        d¦  «        ‚t          |¦  «        }t	          |t
          ¦  «        rd|v rd|v r|}nD	 ddlm} n# t          $ r t          d¦  «        ‚w xY w ||¦  «        }	t          j
        |	¦  «        }t          j        |¦  «        \  }
}}|
› d|› �}|dk    s|€|                      |¦  «        }||d
œ}|�||d<   |                      dd|› �|¬¦  «        }| 	                    ¦   «         d         }|d         }|d         }|r|                      |||¦  «         |                      |› d|› �¦  «        S )a  Create a commit for an existing prompt.

        Args:
            prompt_identifier (str): The identifier of the prompt.
            object (Any): The LangChain object to commit.
            parent_commit_hash (Optional[str]): The hash of the parent commit.
                Defaults to latest commit.
            tags (Optional[str | list[str]]): A single tag or list of tags to apply to the commit.
                Defaults to None.
            description (Optional[str]): Optional human-readable description for the
                commit (max 1000 chars). Defaults to None.

        Returns:
            str: The url of the prompt commit.

        Raises:
            HTTPError: If the server request fails.
            ValueError: If the prompt does not exist.
        z0Prompt does not exist, you must create it first.rÿ   r   r   )rú  úvThe client.create_commit function requires the langchain-corepackage to run.
Install with `pip install langchain-core`rm   ÚlatestN)Úparent_commitrû   rš  r�  r  r  ÚcommitrF  ri  )r  r¤   rp  Úprep_obj_for_pushr  r  Úlangchain_core.loadrú  rÀ   rù  r'  r  r  r/  r  r  )râ  r  r  r8  r©  rš  ÚpreppedÚmanifest_dictrú  Újson_objectr  r  r  rÿ  Úrequest_dictr2  Úcommit_jsonrF  r  s                      re   Úcreate_commitzClient.create_commitô%  sæ  € ð8 ×"Ò"Ð#4Ñ5Ô5ð 	ÝÔ1ØBñô ð õ
 $ FÑ+Ô+ˆÝ�g�tÑ$Ô$ð 	4¨°¨¨¸TÀW¸_¸_Ø#ˆMˆMðØ5Ð5Ð5Ð5Ð5Ð5Ð5øÝð ð ð Ý!ðQñô ð ðøøøð  ˜% ™.œ.ˆKÝ œJ {Ñ3Ô3ˆMå (Ô @ÐARÑ SÔ SÑˆˆ{˜AØ#(Ð 8Ð 8¨;Ð 8Ð 8Ðà Ò)Ð)Ð-?Ð-GØ!%×!=Ò!=Ð>SÑ!TÔ!TÐð 0Ø%ð(
ð (
ˆð Ð"Ø*5ˆL˜Ñ'Ø×,Ò,ØÐ7Ð 5Ð7Ð7¸lð -ñ 
ô 
ˆð —m’m‘o”o hÔ/ˆØ! -Ô0ˆØ Ô%ˆ	Øð 	MØ×$Ò$Ð%:¸IÀtÑLÔLÐLØ×#Ò#Ð'<Ð$LÐ$L¸{Ð$LÐ$LÑMÔMÐMs   ÁA! Á!A;)rš  r1  r©  r   r!  c               ó`  — |                       ¦   «         }|r|j        st          d¦  «        ‚i }|�||d<   |�||d<   |�||d<   |�||d<   |�||d<   t          j        |¦  «        \  }	}
}|                      dd	|	› d
|
› �|¬¦  «        }|                     ¦   «          |                     ¦   «         S )a$  Update a prompt's metadata.

        To update the content of a prompt, use push_prompt or create_commit instead.

        Args:
            prompt_identifier (str): The identifier of the prompt to update.
            description (Optional[str]): New description for the prompt.
            readme (Optional[str]): New readme for the prompt.
            tags (Optional[Sequence[str]]): New list of tags for the prompt.
            is_public (Optional[bool]): New public status for the prompt.
            is_archived (Optional[bool]): New archived status for the prompt.

        Returns:
            Dict[str, Any]: The updated prompt data as returned by the server.

        Raises:
            ValueError: If the prompt_identifier is empty.
            HTTPError: If the server request fails.
        r4  Nrš  r1  r   r!  r©  rº  r	  rm   r  )r6  rø  rï   r¤   r  r/  r  rù  )râ  r  rš  r1  r©  r   r!  rù  rù  r  r  r  r2  s                re   Úupdate_promptzClient.update_prompt<&  sÿ   € ð: ×%Ò%Ñ'Ô'ˆØð 	˜XÔ3ð 	Ýð6ñô ð ð <>ˆàÐ"Ø"-ˆD�ÑØÐØ#ˆD�‰NØÐ Ø )ˆD�ÑØÐ"Ø"-ˆD�ÑØÐØˆD�‰Lå (Ô @ÐARÑ SÔ SÑˆˆ{˜AØ×,Ò,ØÐ4˜uÐ4Ð4 {Ð4Ð4¸4ð -ñ 
ô 
ˆð 	×!Ò!Ñ#Ô#Ð#Ø�}Š}‰ŒÐri   c                óì   — t          j        |¦  «        \  }}}|                      |¦  «        s|                      d|¦  «        ‚|                      dd|› d|› �¦  «        }|                     ¦   «          dS )a6  Delete a prompt.

        Args:
            prompt_identifier (str): The identifier of the prompt to delete.

        Returns:
            bool: True if the prompt was successfully deleted, False otherwise.

        Raises:
            ValueError: If the current tenant is not the owner of the prompt.
        zdelete a promptrV  r	  rm   N)r¤   r  rú  rþ  r/  r  r/  s         re   Údelete_promptzClient.delete_promptv&  sˆ   € õ !)Ô @ÐARÑ SÔ SÑˆˆ{˜AØ×,Ò,¨UÑ3Ô3ð 	GØ×,Ò,Ð->ÀÑFÔFÐFà×,Ò,¨XÐ7VÀÐ7VÐ7VÈÐ7VÐ7VÑWÔWˆØ×!Ò!Ñ#Ô#Ð#Ð#Ð#ri   r  c                ó   — |rdnd}|› |› �S )zßGenerate a cache key for a prompt.

        Args:
            prompt_identifier: The prompt identifier.
            include_model: Whether model info is included.

        Returns:
            The cache key string.
        z:with_modelr‹  rh   )râ  r  r  rq   s       re   Ú_get_cache_keyzClient._get_cache_key‰&  s#   € ð #0Ð7��°RˆØ#Ð- VÐ-Ð-Ð-ri   úls_schemas.PromptCommitc           
     óÌ   — t          j        |¦  «        \  }}}|                      dd|› d|› d|› |rdnd› �¦  «        }t          j        di ||dœ|                     ¦   «         ¥¤ŽS )z÷Fetch a prompt directly from the API (no cache).

        Args:
            prompt_identifier: The prompt identifier.
            include_model: Whether to include model information.

        Returns:
            The fetched PromptCommit.
        r-  r  rm   z?include_model=truer‹  ©r  rE  rh   )r¤   r  r/  r{  ÚPromptCommitrù  )râ  r  r  r  r  rF  r2  s          re   Ú_fetch_prompt_from_apizClient._fetch_prompt_from_api˜&  s·   € õ +3Ô*JØñ+
ô +
Ñ'ˆˆ{˜Kð ×,Ò,ØðD˜Eð Dð D Kð Dð D°+ð DØ,9ÐAÐ(Ð(¸rðDð Dñ
ô 
ˆõ Ô&ð 
ð 
Ø {ÐFÐF°h·m²m±o´oÐFð
ð 
ð 	
ri   ©r  Ú
skip_cacher  rR  r  c               óZ  — t          ||¬¦  «         t          | j        ||¦  «        }|s<| j        �5|                      ||¦  «        }| j                             ||¦  «        }|�|S  |¦   «         }|s9| j        �2|                      ||¦  «        }| j                             |||¦  «         |S )am  Pull a prompt object from the LangSmith API.

        Public prompts referenced by owner/name cross a trust boundary because the
        prompt manifest may contain serialized LangChain objects and configuration
        that affect runtime behavior. For example, a prompt can intentionally
        configure a model with a custom base URL, headers, model name, or other
        constructor arguments. These are supported features, but they also mean
        the prompt contents should be treated as executable configuration rather
        than plain text.

        Set `dangerously_pull_public_prompt=True` only after reviewing and
        trusting the prompt contents, not merely the publishing account. Prompts
        from your own or your organization's account can still be unsafe if that
        account or prompt was compromised.

        Args:
            prompt_identifier: The identifier of the prompt.
            include_model: Whether to include model information.
            skip_cache: Whether to skip the prompt cache. Defaults to `False`.
            dangerously_pull_public_prompt: Set to `True` to allow pulling a
                public prompt by owner/name, for example `username/promptname`.
                Defaults to `False`.

        Returns:
            The prompt object.

        Raises:
            ValueError: If no commits are found for the prompt.
        )r  )r  r
   rP  r-  rK  r{   r  )	râ  r  r  rR  r  Úrefresh_funcÚ	cache_keyÚcachedr¹  s	            re   Úpull_prompt_commitzClient.pull_prompt_commit´&  sÖ   € õJ 	%ØØ+Ið	
ñ 	
ô 	
ð 	
õ ØÔ'Ð):¸Mñ
ô 
ˆð
 ð 	˜dœkÐ5Ø×+Ò+Ð,=¸}ÑMÔMˆIØ”[—_’_ Y°Ñ=Ô=ˆFØÐ!Ø�ð �‘”ˆð ð 	=˜dœkÐ5Ø×+Ò+Ð,=¸}ÑMÔMˆIØŒK�OŠO˜I v¨|Ñ<Ô<Ð<àˆri   ©r‹  rŠ  r  ú'Iterator[ls_schemas.ListedPromptCommit]c             #  ó”  K  — t          j        |¦  «        \  }}}|�t          d|¦  «        n|||dœ}d}		 ||d<   |                      dd|› d	|› d	�|¬
¦  «        }
|
                     ¦   «         }|d         }|d         }|sdS |D ]*}|�	|	|k    r dS t          j        di ||dœ|¥¤ŽV — |	dz  }	Œ+|t          |¦  «        z  }||k    rdS Œ”)aâ  List commits for a given prompt.

        Args:
            prompt_identifier (str): The identifier of the prompt in the format 'owner/repo_name'.
            limit (Optional[int]): The maximum number of commits to return. If None, returns all commits.
            offset (int, default=0): The number of commits to skip before starting to return results.
            include_model (bool, default=False): Whether to include the model information in the commit data.

        Yields:
            A ListedPromptCommit object for each commit.

        !!! note

            This method uses pagination to retrieve commits. It will make multiple API calls if necessary to retrieve all commits
            or up to the specified limit.
        Nrj  rX  r   TrŠ  r-  r  rm   r†  r  ru  rN  r[   rh   )r¤   r  r0  r/  rù  r{  ÚListedPromptCommitrp   )râ  r  r‹  rŠ  r  r  r  r  r‡  r   r2  Úvalr‹   ru  Úits                  re   Úlist_prompt_commitszClient.list_prompt_commitsô&  sO  è è € õ0 !)Ô @ÐARÑ SÔ SÑˆˆ{˜Að ).Ð(9•S˜˜e‘_”_�_¸uØØ*ð
ð 
ˆð
 ˆð	Ø%ˆF�8ÑØ×0Ò0ØØ2˜EÐ2Ð2 KÐ2Ð2Ð2Øð 1ñ ô ˆHð
 —-’-‘/”/ˆCØ˜	”NˆEØ˜”LˆEàð Ø�Øð ð �ØÐ$¨¨eª¨Ø�F�FÝ Ô3ð ð Ø %¨{ÐAÐA¸bÐAðð ð ð ð ð �Q‘��à•c˜%‘j”jÑ ˆFØ˜ŠˆØ�ð/	ri   )r  r   r"  rR  r  r  r   r!  r"  c               óZ   — |                       ||||¬¦  «        }t          ||||¬¦  «        S )a  Pull a prompt and return it as a LangChain `PromptTemplate`.

        This method requires [`langchain-core`](https://pypi.org/project/langchain-core).

        Args:
            prompt_identifier: The identifier of the prompt.
            include_model: Whether to include model configuration in the loaded
                prompt.
            secrets: A map of secrets to use for explicit serialized LangChain secret
                references in the manifest, e.g. `{'OPENAI_API_KEY': 'sk-...'}`.

                If a manifest secret reference is not found in the map, it will be
                loaded from the environment only if `secrets_from_env` is `True`.
                Deserialized model integrations may still use their own
                environment-based credential defaults during initialization.
            secrets_from_env: Whether explicit serialized LangChain secret
                references in the manifest may be loaded from environment variables
                during deserialization.
            skip_cache: Whether to skip the prompt cache. Defaults to `False`.
            dangerously_pull_public_prompt: Set to `True` to allow pulling a
                public prompt by owner/name (for example, `username/promptname`).
                Only do this for trusted prompts. Defaults to `False`.

        Returns:
            Any: The prompt object in the specified format.

        !!! warning "Security note"

            Pulled prompts should be treated as executable configuration, not plain
            text.

            The `secrets` and `secrets_from_env` arguments only control explicit
            serialized LangChain secret references in the manifest. They do not
            prevent deserialized model integrations from using their own
            environment-based credential defaults during initialization. For example,
            a deserialized OpenAI chat model may still use `OPENAI_API_KEY` from the
            environment if its constructor supports that default.

            Avoid pulling public prompts or prompts outside your own organization
            unless you have reviewed and trust their contents. When you do pull a
            trusted external prompt, prefer pinning to a specific commit SHA rather
            than following a mutable latest version. This is especially important
            when `include_model=True`.

        !!! warning "Behavior changed in `langsmith` 0.5.1"

            Updated to take arguments `secrets` and `secrets_from_env` which default
            to None and False, respectively.

            By default, explicit serialized LangChain secret references in a pulled
            manifest are not resolved from environment variables unless you specify
            `secrets_from_env=True`.

            These updates were made to remediate vulnerability
            [GHSA-c67j-w6g6-q2cm](https://github.com/langchain-ai/langchain/security/advisories/GHSA-c67j-w6g6-q2cm)
            in the `langchain-core` package which this method (but not the entire
            langsmith package) depends on.
        rQ  )r  r   r"  )rW  rQ  )râ  r  r  r   r"  rR  r  r  s           re   Úpull_promptzClient.pull_prompt-'  sP   € ðH ×/Ò/ØØ'Ø!Ø+Ið	 0ñ 
ô 
ˆõ (ØØ'ØØ-ð	
ñ 
ô 
ð 	
ri   r;  )r  r8  r   rš  r1  r©  Úcommit_tagsÚcommit_descriptionúOptional[Any]ra  rb  c               ó@  — |                       |¦  «        r8t          d„ ||||fD ¦   «         ¦  «        r|                      |||||¬¦  «         n|                      ||�|nd|||¬¦  «         |€|                      |¬¦  «        S |                      |||||	¬¦  «        }
|
S )a¾  Push a prompt to the LangSmith API.

        Can be used to update prompt metadata or prompt content.

        If the prompt does not exist, it will be created.
        If the prompt exists, it will be updated.

        Args:
            prompt_identifier (str): The identifier of the prompt.
            object (Optional[Any]): The LangChain object to push.
            parent_commit_hash (str): The parent commit hash.
                Defaults to "latest".
            is_public (Optional[bool]): Whether the prompt should be public.
                If None (default), the current visibility status is maintained for existing prompts.
                For new prompts, None defaults to private.
                Set to True to make public, or False to make private.
            description (Optional[str]): A description of the prompt.
                Defaults to an empty string.
            readme (Optional[str]): A readme for the prompt.
                Defaults to an empty string.
            tags (Optional[Sequence[str]]): A list of tags for the prompt.
                Defaults to an empty list.
            commit_tags (Optional[str | list[str]]): A single tag or list of tags for the prompt commit.
                Defaults to an empty list.
            commit_description (Optional[str]): Optional human-readable description
                for the commit (max 1000 chars). Defaults to None.

        Returns:
            str: The URL of the prompt.
        c              3  ó   K  — | ]}|d uV — Œ	d S ry   rh   )r|   Úparams     re   r	  z%Client.push_prompt.<locals>.<genexpr>«'  s8   è è € ð ð Ø&+�˜TÐ!ðð ð ð ð ð ri   r0  NF)r   rš  r1  r©  )r  r7  )r  r  rG  r6  r  rE  )râ  r  r  r8  r   rš  r1  r©  ra  rb  rg  s              re   Úpush_promptzClient.push_prompt~'  s  € ðX ×ÒÐ0Ñ1Ô1ð 	Ýð ð Ø09¸;ÈÐPTÐ/Uðñ ô ñ ô ð 	ð ×"Ò"Ø%Ø +Ø!ØØ'ð #ñ ô ð øð ×ÒØ!Ø'0Ð'<˜)˜)À%Ø'ØØð ñ ô ð ð ˆ>Ø×'Ò'Ð:KÐ'ÑLÔLÐLð × Ò ØØØ1ØØ*ð !ñ 
ô 
ˆð ˆ
ri   ©rî   Ú
identifierrî   úls_schemas.AgentContextc               óp   — |                       |d|¬¦  «        }t          j                             |¦  «        S )a
  Pull an agent from Hub.

        Args:
            identifier: Repo identifier (owner/name:hash, owner/name, or name).
            version: Commit hash or tag; overrides any hash in identifier.

        Returns:
            AgentContext: The agent snapshot.
        Úagentrh  )Ú_pull_hub_directoryr{  ÚAgentContextÚmodel_validate©râ  ri  rî   rL  s       re   Ú
pull_agentzClient.pull_agentË'  s5   € ð ×'Ò'¨
°GÀWÐ'ÑMÔMˆÝÔ&×5Ò5°dÑ;Ô;Ð;ri   )r<  rš  r1  r©  r   rM  ú%dict[str, Optional[ls_schemas.Entry]]r<  c          
     ó<   — |                       |d||||||¬¦  «        S )z=Push an agent to Hub, creating the repo if it does not exist.rl  ©rM  r<  rš  r1  r©  r   ©Ú_push_hub_directory©râ  ri  rM  r<  rš  r1  r©  r   s           re   Ú
push_agentzClient.push_agentÝ'  ó9   € ð ×'Ò'ØØØØ'Ø#ØØØð (ñ 	
ô 	
ð 		
ri   úls_schemas.SkillContextc               óp   — |                       |d|¬¦  «        }t          j                             |¦  «        S )zPull a skill from Hub.Úskillrh  )rm  r{  ÚSkillContextro  rp  s       re   Ú
pull_skillzClient.pull_skillô'  s5   € ð ×'Ò'¨
°GÀWÐ'ÑMÔMˆÝÔ&×5Ò5°dÑ;Ô;Ð;ri   c          
     ó<   — |                       |d||||||¬¦  «        S )zPush a skill to Hub.r|  rt  ru  rw  s           re   Ú
push_skillzClient.push_skillþ'  ry  ri   c                ó0   — |                       |¦  «         dS )z/Delete an agent and its owned child file repos.N©Ú_delete_hub_directory©râ  ri  s     re   Údelete_agentzClient.delete_agent(  ó   € à×"Ò" :Ñ.Ô.Ð.Ð.Ð.ri   c                ó0   — |                       |¦  «         dS )z.Delete a skill and its owned child file repos.Nr‚  r„  s     re   Údelete_skillzClient.delete_skill(  r†  ri   c                ó^   — t          j        |¦  «        \  }}}|                      ||¦  «        S )zCheck if an agent repo exists.©r¤   Úparse_hub_identifierÚ_hub_repo_exists©râ  ri  r  r†  r  s        re   Úagent_existszClient.agent_exists(  ó.   € å!Ô6°zÑBÔB‰ˆˆt�QØ×$Ò$ U¨DÑ1Ô1Ð1ri   c                ó^   — t          j        |¦  «        \  }}}|                      ||¦  «        S )zCheck if a skill repo exists.rŠ  r�  s        re   Úskill_existszClient.skill_exists"(  r�  ri   ©r‹  rŠ  r   r!  rÿ  c               ó8   — |                       d|||||¬¦  «        S )zList agents with pagination.rl  r’  ©Ú_list_hub_repos©râ  r‹  rŠ  r   r!  rÿ  s         re   Úlist_agentszClient.list_agents'(  ó3   € ð ×#Ò#ØØØØØ#Øð $ñ 
ô 
ð 	
ri   c               ó8   — |                       d|||||¬¦  «        S )zList skills with pagination.r|  r’  r”  r–  s         re   Úlist_skillszClient.list_skills:(  r˜  ri   Ú	repo_typeúLiteral['agent', 'skill']c          	     óò   — t          j        |¦  «        \  }}}|�|n	|dk    r|nd}d|i}|r||d<   |                      dt          | j        ¦  «        › d|› d|› d�|¬¦  «        }	|	                     ¦   «         S )	zDFetch hub directory payload, merged with owner/repo from identifier.Nr;  r›  r=  r-  rm   ú/directoriesr†  )r¤   r‹  r/  r7   rk   rù  )
râ  ri  r›  rî   r  r†  r=  r`  r‡  r2  s
             re   rm  zClient._pull_hub_directoryM(  s¯   € õ 'Ô;¸JÑGÔGÑˆˆt�VàÐ*ˆGˆG¸6ÀXÒ;MÐ;M°°ÐSWð 	ð #.¨yÐ!9ˆØð 	&Ø%ˆF�8ÑØ×,Ò,ØÝ  ¤Ñ.Ô.ÐKÐK°ÐKÐK¸ÐKÐKÐKØð -ñ 
ô 
ˆð
 �}Š}‰ŒÐri   c          
     ó¢  — t          |¦  «         t          j        |¦  «        \  }	}
}|                      |	¦  «        s|                      d|› �|	¦  «        ‚|                      |	|
¦  «        r9t          d„ ||||fD ¦   «         ¦  «        r|                      |	|
||||¬¦  «         nat          j	        |
¦  «        s%t          j
        d|
›dt          j        › d�¦  «        ‚|                      |
||||t          |¦  «        ¬¦  «         i }|                     ¦   «         D ]&\  }}|€d||<   Œ|                     d¬	¦  «        ||<   Œ'd
|i}|�||d<   |                      dt#          | j        ¦  «        › d|	› d|
› d�|¬¦  «        }|                     ¦   «         d         d         }|                      ¦   «         }t+          | j        |
||j        ¦  «        S )zFCreate a hub directory commit, creating the repo if it does not exist.zpush c              3  ó   K  — | ]}|d uV — Œ	d S ry   rh   )r|   rÖ  s     re   r	  z-Client._push_hub_directory.<locals>.<genexpr>w(  s&   è è € ÐQÐQ Q�1˜D�=ÐQÐQÐQÐQÐQÐQri   r0  zInvalid repo_handle z: must match rÙ  NTrÀ  rM  r<  r�  rm   z/directories/commitsr  r=  rF  )r8   r¤   r‹  rú  rþ  rŒ  r  Ú_update_hub_repo_metadatar5   Úmatchr§   ÚpatternÚ_create_hub_reporé   r‹   r½  r/  r7   rk   rù  r6  r6   r  rÿ   )râ  ri  r›  rM  r<  rš  r1  r©  r   r  r†  r  Úrequest_filesr_  ÚentryrÅ  r2  rF  rù  s                      re   rv  zClient._push_hub_directoryc(  sR  € õ 	˜}Ñ-Ô-Ð-å!Ô6°zÑBÔB‰ˆˆt�QØ×,Ò,¨UÑ3Ô3ð 	IØ×,Ò,Ð-@°YÐ-@Ð-@À%ÑHÔHÐHà× Ò  ¨Ñ-Ô-ð 	ÝÐQÐQ¨;¸ÀÀiÐ*PÐQÑQÔQÑQÔQð Ø×.Ò.ØØØ +Ø!ØØ'ð /ñ ô ð øõ 'Ô,¨TÑ2Ô2ð ÝÔ1ðA¨4ð Að AÝ"5Ô"=ðAð Að Añô ð ð ×!Ò!ØØØ'ØØÝ˜y™/œ/ð "ñ ô ð ð >@ˆØ Ÿ;š;™=œ=ð 	Jð 	J‰KˆD�%Øˆ}Ø&*�˜dÑ#Ð#à&+×&6Ò&6ÀDÐ&6Ñ&IÔ&I�˜dÑ#Ð#à '¨Ð7ˆØÐ$Ø$1ˆD�Ñ!à×,Ò,ØÝ  ¤Ñ.Ô.ÐSÐS°ÐSÐS¸ÐSÐSÐSØð -ñ 
ô 
ˆð
 —m’m‘o”o hÔ/°Ô>ˆØ×%Ò%Ñ'Ô'ˆÝ ¤°°kÀ8Ä;ÑOÔOÐOri   c           	     óî   — t          j        |¦  «        \  }}}|                      |¦  «        s|                      d|¦  «        ‚|                      dt          | j        ¦  «        › d|› d|› d�¦  «         dS )zDelete a hub directory repo.ÚdeleterV  rm   rž  N)r¤   r‹  rú  rþ  r/  r7   rk   r�  s        re   rƒ  zClient._delete_hub_directory£(  s�   € å!Ô6°zÑBÔB‰ˆˆt�QØ×,Ò,¨UÑ3Ô3ð 	>Ø×,Ò,¨X°uÑ=Ô=Ð=Ø×!Ò!ØÝ  ¤Ñ.Ô.ÐKÐK°ÐKÐK¸ÐKÐKÐKñ	
ô 	
ð 	
ð 	
ð 	
ri   c               óÆ   — ||||rdnddœ}|�	|rdnd|d<   |r
||d<   d|d<   |                       dt          |¬	¦  «        }t          j        d
i |                     ¦   «         ¤ŽS )uÀ   List hub repos filtered by type.

        Returns ``ListPromptsResponse`` because ``/repos`` is polymorphic â€” the
        list shape is shared across prompt, agent, and skill repos.
        r\  r(  )r‹  rŠ  r›  r!  Nr   rÿ  r)  r-  r†  rh   )r/  r4   r{  r*  rù  )	râ  r›  r‹  rŠ  r   r!  rÿ  r‡  r2  s	            re   r•  zClient._list_hub_repos­(  s”   € ð  ØØ"Ø%0Ð=˜6˜6°gð	"
ð "
ˆð Ð Ø,5Ð"B & &¸7ˆF�;ÑØð 	,Ø#ˆF�7‰OØ%+ˆF�>Ñ"Ø×,Ò,¨UµCÀÐ,ÑGÔGˆÝÔ-Ð@Ð@°·²±´Ð@Ð@Ð@ri   c                óz   — 	 |                       dt          › d|› d|› �¦  «         dS # t          j        $ r Y dS w xY w)zCheck if a hub repo exists.r-  rm   TF)r/  r4   r¤   rp  )râ  r  r†  s      re   rŒ  zClient._hub_repo_existsÊ(  s]   € ð	Ø×%Ò% eµÐ-DÐ-D°eÐ-DÐ-D¸dÐ-DÐ-DÑEÔEÐEØ�4øÝÔ.ð 	ð 	ð 	Ø�5�5ð	øøøs   ‚#' §:¹:c               ó´   — |||dœ}|�||d<   |�||d<   |�t          |¦  «        |d<   	 |                      dd|¬¦  «         dS # t          j        $ r Y dS w xY w)	z(Create a new hub repo of the given type.)r5  r›  r   Nrš  r1  r©  r�  r	  r  )r  r/  r¤   rq  )râ  r†  r›  rš  r1  r©  r   rÅ  s           re   r¤  zClient._create_hub_repoÒ(  sš   € ð  Ø"Ø"ð 
ð  
ˆð
 Ð"Ø"-ˆD�ÑØÐØ#ˆD�‰NØÐÝ ™:œ:ˆD�‰Lð	Ø×%Ò% f¨i¸dÐ%ÑCÔCÐCÐCÐCøÝÔ.ð 	ð 	ð 	ØˆDˆDð	øøøs   ªA ÁAÁAc               ó®   — i }|�||d<   |�||d<   |�t          |¦  «        |d<   |�||d<   |r'|                      dt          › d|› d|› �|¬¦  «         dS dS )	z=Patch hub repo metadata fields that were explicitly provided.Nrš  r1  r©  r   rº  rm   r  )r  r/  r4   )râ  r  r†  rš  r1  r©  r   rÅ  s           re   r¡  z Client._update_hub_repo_metadataí(  s™   € ð  "ˆØÐ"Ø"-ˆD�ÑØÐØ#ˆD�‰NØÐÝ ™:œ:ˆD�‰LØÐ Ø )ˆD�ÑØð 	SØ×%Ò% gµ#Ð/FÐ/F¸Ð/FÐ/FÀÐ/FÐ/FÈTÐ%ÑRÔRÐRÐRÐRð	Sð 	Sri   c                óì   — 	 |                       |¬¦  «         n2# t          $ r%}t                               d|¦  «         Y d}~nd}~ww xY wd| _        | j        �| j                             ¦   «          dS dS )a¹  Manually trigger cleanup of background threads.

        Drains pending traces via ``flush()`` before stopping the background
        threads. Pass ``timeout=0`` to skip the drain entirely (e.g. in error
        paths or signal handlers where blocking on network I/O is
        unacceptable).

        Args:
            timeout: Maximum seconds to wait for pending traces to flush.
                None (default) waits indefinitely.
        r¾  z(Error flushing traces during cleanup: %sNT)rÍ  r@  ra   rb   r  r-  Úshutdown)râ  rº  rM  s      re   ÚcleanupzClient.cleanup)  s˜   € ð	JØ�JŠJ˜wˆJÑ'Ô'Ð'Ð'øÝð 	Jð 	Jð 	JÝ�NŠNÐEÀqÑIÔIÐIÐIÐIÐIÐIÐIøøøøð	Jøøøà#ˆÔØŒ;Ð"ØŒK× Ò Ñ"Ô"Ð"Ð"Ð"ð #Ð"s   ‚ ™
A£AÁAc                óæ  — 	 |                       |¬¦  «         n2# t          $ r%}t                               d|¦  «         Y d}~nd}~ww xY w| j        }|�O	 t          j        |¦  «         n2# t          $ r%}t                               d|¦  «         Y d}~nd}~ww xY wd| _        | j        }|�E	 t          |¦  «         dS # t          $ r&}t                               d|¦  «         Y d}~dS d}~ww xY wdS )aV  Release resources held by this client.

        Calls :meth:`cleanup` to drain pending traces and stop background
        threads, then closes the underlying ``requests.Session`` and
        unregisters the ``atexit`` handler so the session is not pinned in
        memory for the remainder of the process lifetime.

        Safe to call multiple times.

        Args:
            timeout: Forwarded to :meth:`cleanup` / :meth:`flush`. Maximum
                seconds to wait for pending traces to flush. ``None``
                (default) waits indefinitely. Pass ``0`` to skip the drain.
        r¾  z-Error during cleanup while closing client: %sNz&Error unregistering atexit handler: %sz Error closing client session: %s)
r¯  r@  ra   rb   r  r€  Ú
unregisterrñ   rs   r…  )râ  rº  rM  Úhandlerrs   s        re   r„  zClient.close)  sV  € ð	OØ�LŠL ˆLÑ)Ô)Ð)Ð)øÝð 	Oð 	Oð 	OÝ�NŠNÐJÈAÑNÔNÐNÐNÐNÐNÐNÐNøøøøð	OøøøàÔ&ˆØÐðJÝÔ! 'Ñ*Ô*Ð*Ð*øÝð Jð Jð JÝ—’ÐEÀqÑIÔIÐIÐIÐIÐIÐIÐIøøøøðJøøøà#'ˆDÔ Ø”,ˆØÐðFÝ˜gÑ&Ô&Ð&Ð&Ð&øÝð Fð Fð FÝ—’ÐAÀ1ÑEÔEÐEÐEÐEÐEÐEÐEÐEøøøøðFøøøð ÐsD   ‚ ™
A£AÁAÁA* Á*
BÁ4BÂBÂ-B> Â>
C.ÃC)Ã)C.rL  úOptional[DATA_T]rË  úOptional[Sequence[EVALUATOR_T]]Úsummary_evaluatorsú'Optional[Sequence[SUMMARY_EVALUATOR_T]]Úexperiment_prefixÚblockingÚ
experimentúOptional[EXPERIMENT_T]Úupload_resultsr`  ú'Union[TARGET_T, Runnable, EXPERIMENT_T]râ   c               ó   — d S ry   rh   ©râ  r`  rL  rË  rµ  rC  r·  rš  r�  rŒ  r¸  r¹  r»  r�   s                 re   ÚevaluatezClient.evaluate9)  s	   € ð"  ˜Cri   ú+Optional[Sequence[COMPARATIVE_EVALUATOR_T]]ú(Union[tuple[EXPERIMENT_T, EXPERIMENT_T]]rá   c               ó   — d S ry   rh   r¾  s                 re   r¿  zClient.evaluateL)  s	   € ð" (+ sri   r  úIOptional[Union[Sequence[EVALUATOR_T], Sequence[COMPARATIVE_EVALUATOR_T]]]Úerror_handlingúLiteral['log', 'ignore']úJUnion[TARGET_T, Runnable, EXPERIMENT_T, tuple[EXPERIMENT_T, EXPERIMENT_T]]ú6Union[ExperimentResults, ComparativeExperimentResults]c               ó<   — ddl m}  ||f||||||||	| |
|||dœ|¤ŽS )aÎ  Evaluate a target system on a given dataset.

        Args:
            target (Union[TARGET_T, Runnable, EXPERIMENT_T, Tuple[EXPERIMENT_T, EXPERIMENT_T]]):
                The target system or experiment(s) to evaluate.

                Can be a function that takes a `dict` and returns a `dict`, a langchain `Runnable`, an
                existing experiment ID, or a two-tuple of experiment IDs.
            data (DATA_T): The dataset to evaluate on.

                Can be a dataset name, a list of examples, or a generator of examples.
            evaluators (Optional[Union[Sequence[EVALUATOR_T], Sequence[COMPARATIVE_EVALUATOR_T]]]):
                A list of evaluators to run on each example. The evaluator signature
                depends on the target type. Default to None.
            summary_evaluators (Optional[Sequence[SUMMARY_EVALUATOR_T]]): A list of summary
                evaluators to run on the entire dataset. Should not be specified if
                comparing two existing experiments.
            metadata (Optional[dict]): Metadata to attach to the experiment.
            experiment_prefix (Optional[str]): A prefix to provide for your experiment name.
            description (Optional[str]): A free-form text description for the experiment.
            max_concurrency (Optional[int], default=0): The maximum number of concurrent
                evaluations to run.

                If `None` then no limit is set. If `0` then no concurrency.
            blocking (bool, default=True): Whether to block until the evaluation is complete.
            num_repetitions (int, default=1): The number of times to run the evaluation.
                Each item in the dataset will be run and evaluated this many times.
                Defaults to 1.
            experiment (Optional[EXPERIMENT_T]): An existing experiment to
                extend.

                If provided, `experiment_prefix` is ignored.

                For advanced usage only. Should not be specified if target is an existing experiment or
                two-tuple fo experiments.
            upload_results (bool, default=True): Whether to upload the results to LangSmith.
            error_handling (str, default="log"): How to handle individual run errors.

                `'log'` will trace the runs with the error message as part of the
                experiment, `'ignore'` will not count the run as part of the experiment at
                all.
            **kwargs (Any): Additional keyword arguments to pass to the evaluator.

        Returns:
            ExperimentResults: If target is a function, Runnable, or existing experiment.
            ComparativeExperimentResults: If target is a two-tuple of existing experiments.

        Examples:
            Prepare the dataset:

            ```python
            from langsmith import Client

            client = Client()
            dataset = client.clone_public_dataset(
                "https://smith.langchain.com/public/419dcab2-1d66-4b94-8901-0357ead390df/d"
            )
            dataset_name = "Evaluate Examples"
            ```

            Basic usage:

            ```python
            def accuracy(outputs: dict, reference_outputs: dict) -> dict:
                # Row-level evaluator for accuracy.
                pred = outputs["response"]
                expected = reference_outputs["answer"]
                return {"score": expected.lower() == pred.lower()}
            ```

            ```python
            def precision(outputs: list[dict], reference_outputs: list[dict]) -> dict:
                # Experiment-level evaluator for precision.
                # TP / (TP + FP)
                predictions = [out["response"].lower() for out in outputs]
                expected = [ref["answer"].lower() for ref in reference_outputs]
                # yes and no are the only possible answers
                tp = sum([p == e for p, e in zip(predictions, expected) if p == "yes"])
                fp = sum([p == "yes" and e == "no" for p, e in zip(predictions, expected)])
                return {"score": tp / (tp + fp)}


            def predict(inputs: dict) -> dict:
                # This can be any function or just an API call to your app.
                return {"response": "Yes"}


            results = client.evaluate(
                predict,
                data=dataset_name,
                evaluators=[accuracy],
                summary_evaluators=[precision],
                experiment_prefix="My Experiment",
                description="Evaluating the accuracy of a simple prediction model.",
                metadata={
                    "my-prompt-version": "abcd-1234",
                },
            )
            ```

            Evaluating over only a subset of the examples

            ```python
            experiment_name = results.experiment_name
            examples = client.list_examples(dataset_name=dataset_name, limit=5)
            results = client.evaluate(
                predict,
                data=examples,
                evaluators=[accuracy],
                summary_evaluators=[precision],
                experiment_prefix="My Experiment",
                description="Just testing a subset synchronously.",
            )
            ```

            Streaming each prediction to more easily + eagerly debug.

            ```python
            results = client.evaluate(
                predict,
                data=dataset_name,
                evaluators=[accuracy],
                summary_evaluators=[precision],
                description="I don't even have to block!",
                blocking=False,
            )
            for i, result in enumerate(results):  # doctest: +ELLIPSIS
                pass
            ```


            View the evaluation results for experiment:...
            Evaluating a LangChain object:

            ```python
            from langchain_core.runnables import chain as as_runnable


            @as_runnable
            def nested_predict(inputs):
                return {"response": "Yes"}


            @as_runnable
            def lc_predict(inputs):
                return nested_predict.invoke(inputs)


            results = client.evaluate(
                lc_predict,
                data=dataset_name,
                evaluators=[accuracy],
                description="This time we're evaluating a LangChain object.",
                summary_evaluators=[precision],
            )
            ```

            Comparative evaluation:

            ```python
            results = client.evaluate(
                # The target is a tuple of the experiment IDs to compare
                target=(
                    "12345678-1234-1234-1234-123456789012",
                    "98765432-1234-1234-1234-123456789012",
                ),
                evaluators=[accuracy],
                summary_evaluators=[precision],
            )
            ```

            Evaluate an existing experiment:

            ```python
            results = client.evaluate(
                # The target is the ID of the experiment we are evaluating
                target="12345678-1234-1234-1234-123456789012",
                evaluators=[accuracy],
                summary_evaluators=[precision],
            )
            ```

        !!! version-added "Added in `langsmith` 0.2.0"
        r   )r¿  ©rL  rË  rµ  rC  r·  rš  r�  rŒ  Úclientr¸  r¹  r»  rÄ  )Úlangsmith.evaluation._runnerr¿  )râ  r`  rL  rË  rµ  rC  r·  rš  r�  rŒ  r¸  r¹  r»  rÄ  r�   Ú	evaluate_s                   re   r¿  zClient.evaluate_)  sl   € ð\ 	GÐFÐFÐFÐFÐFð ˆyØð
àØ!Ø1ØØ/Ø#Ø+Ø+ØØØ!Ø)Ø)ð
ð 
ð ð
ð 
ð 	
ri   úNUnion[DATA_T, AsyncIterable[schemas.Example], Iterable[schemas.Example], None]ú4Optional[Sequence[Union[EVALUATOR_T, AEVALUATOR_T]]]ú6Optional[Union[schemas.TracerSession, str, uuid.UUID]]úVUnion[ATARGET_T, AsyncIterable[dict], Runnable, str, uuid.UUID, schemas.TracerSession]rÚ   c             ‹  óL   K  — ddl m}  ||f||||||||	| |
|||dœ|¤Žƒ d{V —†S )ai  Evaluate an async target system on a given dataset.

        Args:
            target (Union[ATARGET_T, AsyncIterable[dict], Runnable, str, uuid.UUID, TracerSession]):
                The target system or experiment(s) to evaluate.

                Can be an async function that takes a `dict` and returns a `dict`, a langchain `Runnable`, an
                existing experiment ID, or a two-tuple of experiment IDs.
            data (Union[DATA_T, AsyncIterable[Example]]): The dataset to evaluate on.

                Can be a dataset name, a list of examples, an async generator of examples, or an async iterable of examples.
            evaluators (Optional[Sequence[EVALUATOR_T]]): A list of evaluators to run
                on each example.
            summary_evaluators (Optional[Sequence[SUMMARY_EVALUATOR_T]]): A list of summary
                evaluators to run on the entire dataset.
            metadata (Optional[dict]): Metadata to attach to the experiment.
            experiment_prefix (Optional[str]): A prefix to provide for your experiment name.
            description (Optional[str]): A description of the experiment.
            max_concurrency (Optional[int], default=0): The maximum number of concurrent
                evaluations to run.

                If `None` then no limit is set. If `0` then no concurrency.
            num_repetitions (int, default=1): The number of times to run the evaluation.
                Each item in the dataset will be run and evaluated this many times.
                Defaults to 1.
            blocking (bool, default=True): Whether to block until the evaluation is complete.
            experiment (Optional[TracerSession]): An existing experiment to
                extend.

                If provided, `experiment_prefix` is ignored.

                For advanced usage only.
            upload_results (bool, default=True): Whether to upload the results to LangSmith.
            error_handling (str, default="log"): How to handle individual run errors.

                `'log'` will trace the runs with the error message as part of the
                experiment, `'ignore'` will not count the run as part of the experiment at
                all.
            **kwargs (Any): Additional keyword arguments to pass to the evaluator.

        Returns:
            An async iterator over the experiment results.

        Environment:
            - `LANGSMITH_TEST_CACHE`: If set, API calls will be cached to disk to save time and
                cost during testing.

                Recommended to commit the cache files to your repository for faster CI/CD runs.

                Requires the `'langsmith[vcr]'` package to be installed.

        Examples:
            Prepare the dataset:

            ```python
            import asyncio
            from langsmith import Client

            client = Client()
            dataset = client.clone_public_dataset(
                "https://smith.langchain.com/public/419dcab2-1d66-4b94-8901-0357ead390df/d"
            )
            dataset_name = "Evaluate Examples"
            ```

            Basic usage:

            ```python
            def accuracy(outputs: dict, reference_outputs: dict) -> dict:
                # Row-level evaluator for accuracy.
                pred = outputs["resposen"]
                expected = reference_outputs["answer"]
                return {"score": expected.lower() == pred.lower()}


            def precision(outputs: list[dict], reference_outputs: list[dict]) -> dict:
                # Experiment-level evaluator for precision.
                # TP / (TP + FP)
                predictions = [out["response"].lower() for out in outputs]
                expected = [ref["answer"].lower() for ref in reference_outputs]
                # yes and no are the only possible answers
                tp = sum([p == e for p, e in zip(predictions, expected) if p == "yes"])
                fp = sum([p == "yes" and e == "no" for p, e in zip(predictions, expected)])
                return {"score": tp / (tp + fp)}


            async def apredict(inputs: dict) -> dict:
                # This can be any async function or just an API call to your app.
                await asyncio.sleep(0.1)
                return {"response": "Yes"}


            results = asyncio.run(
                client.aevaluate(
                    apredict,
                    data=dataset_name,
                    evaluators=[accuracy],
                    summary_evaluators=[precision],
                    experiment_prefix="My Experiment",
                    description="Evaluate the accuracy of the model asynchronously.",
                    metadata={
                        "my-prompt-version": "abcd-1234",
                    },
                )
            )
            ```

            Evaluating over only a subset of the examples using an async generator:

            ```python
            async def example_generator():
                examples = client.list_examples(dataset_name=dataset_name, limit=5)
                for example in examples:
                    yield example


            results = asyncio.run(
                client.aevaluate(
                    apredict,
                    data=example_generator(),
                    evaluators=[accuracy],
                    summary_evaluators=[precision],
                    experiment_prefix="My Subset Experiment",
                    description="Evaluate a subset of examples asynchronously.",
                )
            )
            ```

            Streaming each prediction to more easily + eagerly debug.

            ```python
            results = asyncio.run(
                client.aevaluate(
                    apredict,
                    data=dataset_name,
                    evaluators=[accuracy],
                    summary_evaluators=[precision],
                    experiment_prefix="My Streaming Experiment",
                    description="Streaming predictions for debugging.",
                    blocking=False,
                )
            )


            async def aenumerate(iterable):
                async for elem in iterable:
                    print(elem)


            asyncio.run(aenumerate(results))
            ```

            Running without concurrency:

            ```python
            results = asyncio.run(
                client.aevaluate(
                    apredict,
                    data=dataset_name,
                    evaluators=[accuracy],
                    summary_evaluators=[precision],
                    experiment_prefix="My Experiment Without Concurrency",
                    description="This was run without concurrency.",
                    max_concurrency=0,
                )
            )
            ```

            Using Async evaluators:

            ```python
            async def helpfulness(outputs: dict) -> dict:
                # Row-level evaluator for helpfulness.
                await asyncio.sleep(5)  # Replace with your LLM API call
                return {"score": outputs["output"] == "Yes"}


            results = asyncio.run(
                client.aevaluate(
                    apredict,
                    data=dataset_name,
                    evaluators=[helpfulness],
                    summary_evaluators=[precision],
                    experiment_prefix="My Helpful Experiment",
                    description="Applying async evaluators example.",
                )
            )
            ```

            Evaluate an existing experiment:

            ```python
            results = asyncio.run(
                client.aevaluate(
                    # The target is the ID of the experiment we are evaluating
                    target="419dcab2-1d66-4b94-8901-0357ead390df",
                    evaluators=[accuracy, helpfulness],
                    summary_evaluators=[precision],
                )
            )
            ```

        !!! version-added "Added in `langsmith` 0.2.0"
        r   )Ú	aevaluaterÉ  N)Úlangsmith.evaluation._arunnerrÒ  )râ  r`  rL  rË  rµ  rC  r·  rš  r�  rŒ  r¸  r¹  r»  rÄ  r�   Ú
aevaluate_s                   re   rÒ  zClient.aevaluateC*  sŒ   è è € ðN 	JÐIÐIÐIÐIÐIà�ZØð
àØ!Ø1ØØ/Ø#Ø+Ø+ØØØ!Ø)Ø)ð
ð 
ð ð
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 	
ri   ÚpreviewÚfiltersú!dict[uuid.UUID, list[str]] | NoneúIterator[list[ExampleWithRuns]]c              #  óˆ  K  — d}d}	 |r||z
  nd}	|	rt          d|	¦  «        nd}
|g||
|||dœ}|                      dd|› d�d	t          |¦  «        i¬
¦  «        }|                     ¦   «         }|sdS d„ |D ¦   «         }|V — |t	          |¦  «        z  }t	          |¦  «        |
k     s|r||k    rdS |t	          |¦  «        z  }Œ¼)a%  Paginate through examples with runs and yield batches.

        Args:
            dataset_id: Dataset UUID to fetch examples with runs
            session_id: Session UUID to filter runs by, same as project_id
            preview: Whether to return preview data only
            comparative_experiment_id: Optional comparative experiment UUID
            filters: Optional filters to apply
            limit: Maximum total number of results to return

        Yields:
            Batches of run results as lists of ExampleWithRuns instances
        r   TNrj  )Úsession_idsrŠ  r‹  rÕ  rP  rÖ  r�  rk  r  rL  r”  c                ó0   — g | ]}t          j        d i |¤Ž‘ŒS r—  )r{  rO   )r|   r¹  s     re   rZ  z7Client._paginate_examples_with_runs.<locals>.<listcomp>o+  s)   € ÐWÐWÐWÀv�jÔ8ÐBÐB¸6ÐBÐBÐWÐWÐWri   )r0  r/  r—  rù  rp   )râ  rg  rÁ  rÕ  rP  rÖ  r‹  rŠ  Úresults_countrÌ  Úbatch_limitrÅ  r2  r½  Úexamples_batchs                  re   Ú_paginate_examples_with_runsz#Client._paginate_examples_with_runs>+  s,  è è € ð, ˆØˆð	!Ø38ÐB˜ Ñ.Ð.¸dˆIØ1:ÐC�#˜c 9Ñ-Ô-Ð-ÀˆKð !+˜|Ø Ø$Ø"Ø-FØ"ðð ˆDð ×0Ò0ØØ.˜ZÐ.Ð.Ð.Ø &­°DÑ(9Ô(9Ð:ð 1ñ ô ˆHð —M’M‘O”OˆEØð Ø�ð XÐWÐQVÐWÑWÔWˆNØ Ð Ð Ð Ø�S ™ZœZÑ'ˆMå�5‰zŒz˜KÒ'Ð'¨EÐ'°mÀuÒ6LÐ6LØ�à•c˜%‘j”jÑ ˆFð?	!ri   zùget_experiment_results() is deprecated and will be removed after Jan 31, 2027. Use client.datasets.experiment_runs.query() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#dataset-experiment-runs-query for the migration guide.úls_schemas.ExperimentResultsc                ó�  ‡ ‡‡‡‡‡
— ‰                       ||d¬¦  «        Š
‰
st          d|› d�¦  «        ‚ˆˆˆˆˆ
ˆ fd„}‰
j        ‰
j        ‰
j        ‰
j        ‰
j        ‰
j        ‰
j        ‰
j	        ‰
j
        ‰
j        ‰
j        ‰
j        ‰
j        ‰
j        dœ}i ‰
j        pi ¥‰
j        pi ¥}	t%          j        |	| |¦   «         ¬¦  «        S )aë  Get results for an experiment, including experiment session aggregated stats and experiment runs for each dataset example.

        .. admonition:: Deprecated

            Use :meth:`langsmith.Client.datasets.experiment_runs.query` instead.
            See https://docs.langchain.com/langsmith/smithdb-sdk-migration#dataset-experiment-runs-query for the migration guide.
            Will be removed after Jan 31, 2027.

        Experiment results may not be available immediately after the experiment is created.

        Args:
            name: The experiment name.
            project_id: Experiment's tracing project id, also called session_id, can be found in the url of the LS experiment page
            preview: Whether to return lightweight preview data only. When True,
                fetches inputs_preview/outputs_preview summaries instead of full inputs/outputs from S3 storage.
                Faster and less bandwidth.
            comparative_experiment_id: Optional comparative experiment UUID for pairwise comparison experiment results.
            filters: Optional filters to apply to results
            limit: Maximum number of results to return

        Returns:
            ExperimentResults with:
                - feedback_stats: Combined feedback statistics including session-level feedback
                - run_stats: Aggregated run statistics (latency, tokens, cost, etc.)
                - examples_with_runs: Iterator of ExampleWithRuns

        Raises:
            ValueError: If project not found for the given session_id

        Example:
            ```python
            client = Client()
            results = client.get_experiment_results(
                project_id="037ae90f-f297-4926-b93c-37d8abf6899f",
            )
            for example_with_runs in results["examples_with_runs"]:
                print(example_with_runs.model_dump())

            # Access aggregated experiment statistics
            print(f"Total runs: {results['run_stats']['run_count']}")
            print(f"Total cost: {results['run_stats']['total_cost']}")
            print(f"P50 latency: {results['run_stats']['latency_p50']}")

            # Access feedback statistics
            print(f"Feedback stats: {results['feedback_stats']}")
            ```
        T)rô  rå  r›  z&No experiment found with project_id: 'r³  c               3  ól   •K  — ‰                      ‰j        ‰j        ‰‰‰‰¬¦  «        D ]
} | E d{V —† ŒdS )z2Yield examples with corresponding experiment runs.)rg  rÁ  rÕ  rP  rÖ  r‹  N)rß  rŠ  rÿ   )r½  rP  rÖ  r‹  rÕ  r†  râ  s    €€€€€€re   Ú _get_examples_with_runs_iteratorzGClient.get_experiment_results.<locals>._get_examples_with_runs_iterator½+  si   øè è € à×:Ò:Ø"Ô7Ø"œ:ØØ*CØØð ;ñ ô ð !ð !�ð !Ð Ð Ð Ð Ð Ð Ð Ð ð!ð !ri   )Ú	run_countÚlatency_p50Úlatency_p99r  r  r  Úlast_run_start_timeÚ
run_facetsr  r  r
  Úfirst_token_p50Úfirst_token_p99Ú
error_rate)r  Ú	run_statsÚexamples_with_runs)r  rï   rä  rå  ræ  r  r  r  rç  rè  r  r  r
  ré  rê  rë  r  Úsession_feedback_statsr{  râ   )râ  r†  rå  rÕ  rP  rÖ  r‹  rã  rì  r  r†  s   `  ````   @re   Úget_experiment_resultszClient.get_experiment_resultsx+  s:  øøøøøø€ ð| ×#Ò#Ø¨*ÀDð $ñ 
ô 
ˆð ð 	UÝÐSÀjÐSÐSÐSÑTÔTÐTð
	!ð 
	!ð 
	!ð 
	!ð 
	!ð 
	!ð 
	!ð 
	!ð 
	!ð 
	!ð !Ô*Ø"Ô.Ø"Ô.Ø#Ô0Ø$Ô2Ø!(Ô!:Ø#*Ô#>Ø!Ô,Ø!Ô,Ø"Ô.Ø&Ô6Ø&Ô6Ø&Ô6Ø!Ô,ð4
ð 4
ˆ	ð 
ØÔ%Ð+¨ð
àÔ-Ð3°ð
ˆõ Ô+Ø)ØØ?Ð?ÑAÔAð
ñ 
ô 
ð 	
ri   )Úinstructionsr†  ÚmodelÚopenai_api_keyÚanthropic_api_keyÚchat_historiesúlist[list[dict]]rð  rñ  ú%Literal['openai', 'anthropic'] | Nonerò  ró  úls_schemas.InsightsReportc               óœ  — |                       |||¬¦  «        }|                      ||¦  «        }|d|dœd|dœ}|                      dd|j        › d�|¬	¦  «        }	t	          j        |	¦  «         |	                     ¦   «         }
t          j        di |
¤|j        |  	                    ¦   «         | j
        d
œ¤Ž}t          d|j        › �¦  «         |S )aÚ	  Generate Insights over your agent chat histories.

        !!! note

            - Only available to Plus and higher tier LangSmith users.
            - Insights Agent uses user's model API key. The cost of the report
                grows linearly with the number of chat histories you upload and the
                size of each history. For more see [insights](https://docs.langchain.com/langsmith/insights).
            - This method will upload your chat histories as traces to LangSmith.
            - If you pass in a model API key this will be set as a workspace secret
                meaning it will be usedin for evaluators and the playground.

        Args:
            chat_histories: A list of chat histories. Each chat history should be a
                list of messages. We recommend formatting these as OpenAI messages with
                a "role" and "content" key. Max length 1000 items.
            instructions: Instructions for the Insights agent. Should focus on what
                your agent does and what types of insights you
                want to generate.
            name: Name for the generated Insights report.
            model: Whether to use OpenAI or Anthropic models. This will impact the
                cost of generating the Insights Report.
            openai_api_key: OpenAI API key to use. Only needed if you have not already
                stored this in LangSmith as a workspace secret.
            anthropic_api_key: Anthropic API key to use. Only needed if you have not
                already stored this in LangSmith as a workspace secret.

        Example:
            ```python
            import os
            from langsmith import Client

            client = client()

            chat_histories = [
                [
                    {"role": "user", "content": "how are you"},
                    {"role": "assistant", "content": "good!"},
                ],
                [
                    {"role": "user", "content": "do you like art"},
                    {"role": "assistant", "content": "only Tarkovsky"},
                ],
            ]

            report = client.generate_insights(
                chat_histories=chat_histories,
                name="Conversation Topics",
                instructions="What are the high-level topics of conversations users are having with the assistant?",
                openai_api_key=os.environ["OPENAI_API_KEY"],
            )

            # client.poll_insights(report=report)
            ```
        ©rò  ró  rñ  zxThe run.outputs.messages field contains a chat history between the user and the agent. This is all the context you need.)z%How are your agent traces structured?z.What would you like to learn about your agent?r[   )r†  Úuser_contextÚlast_n_hoursrñ  r�  r”  z	/insightsr  ©rå  r»  Úhost_urlz�The Insights Agent is running! This can take up to 30 minutes to complete. Once the report is completed, you'll be able to see results here: rh   )Ú_ensure_insights_api_keyÚ_ingest_insights_runsr/  rÿ   r¤   r0  rù  r{  ÚInsightsReportrJ  r  Úprintr  )râ  rô  rð  r†  rñ  rò  ró  r†  rÖ  r2  rJ  Úreports               re   Úgenerate_insightszClient.generate_insightsã+  s0  € ðD ×-Ò-Ø)Ø/Øð .ñ 
ô 
ˆð
 ×,Ò,¨^¸TÑBÔBˆàð :tØBNðð ð Øð
ð 
ˆð ×,Ò,ØÐ6 ¤Ð6Ð6Ð6¸Vð -ñ 
ô 
ˆõ 	Ô+¨HÑ5Ô5Ð5Ø�mŠm‰oŒoˆÝÔ*ð 
ð 
Øð
à”zØ×)Ò)Ñ+Ô+Ø”^ð	
ð 
ð 
ð 
ˆõ 	ðàŒ{ðð ñ	
ô 	
ð 	
ð
 ˆri   r\  i  )r	  rÿ   rå  Úraterº  Úverboser	  ú ls_schemas.InsightsReport | Noner	  r	  c          	     óª  — |r|s|st          d¦  «        ‚|s|r|rt          d¦  «        ‚|r|j        }|j        }t          d||z  ¦  «        }t	          |¦  «        D ]è}|                      dd|› d|› �¦  «        }	t          j        |	¦  «         |	                     ¦   «         }
|
d         dk    rGt          j
        di |
¤||                      ¦   «         | j        d	œ¤Ž}t          d
|j        ¦  «         |c S |
d         dk    rt          d|
d         › �¦  «        ‚|rt          d||z  › �¦  «         t          j        |¦  «         Œét#          d¦  «        ‚)a"  Poll the status of an Insights report.

        Args:
            report: THe InsightsReport.
            id: The Insights report ID. Should only specify if 'report' is not specified.
            project_id: The Tracing project ID. Should only specify if 'report' is not specified.
        ú1Must specify ('id' and 'project_id') or 'report'.ú@Must specify exactly one of ('id' and 'project_id') or 'report'.r[   r-  r”  ú
/insights/r  Úsuccessrü  z1Insights report completed! View the results at %srý  zFailed to generate insights: zPolling time: zInsights still pendingNrh   )rï   rÿ   rå  rt  rc  r/  r¤   r0  rù  r{  r 	  rJ  r  r	  r  r^   rk  ÚTimeoutError)râ  r	  rÿ   rå  r	  rº  r	  Ú	max_triesr   r2  Ú	resp_jsonÚjobs               re   Úpoll_insightszClient.poll_insightsF,  sÏ  € ð$ ð 	+˜
ð 	+ vð 	+ÝÐPÑQÔQÐQØð 	+�Jð 	+ Fð 	+ÝØRñô ð ð ð 	+Ø”ˆBØÔ*ˆJå˜˜7 d™?Ñ+Ô+ˆ	Ý�yÑ!Ô!ð 	ð 	ˆAØ×0Ò0ØÐ> JÐ>Ð>¸"Ð>Ð>ñô ˆHõ Ô/°Ñ9Ô9Ð9Ø Ÿš™œˆIØ˜Ô" iÒ/Ð/Ý Ô/ð ð Øðà)Ø"×1Ò1Ñ3Ô3Ø!œ^ð	ð ð ð �õ ØGØ”Hñô ð ð �
�
�
Ø˜8Ô$¨Ò/Ð/Ý Ð!UÀÈ7ÔASÐ!UÐ!UÑVÔVÐVØð 3ÝÐ1 q¨4¡xÐ1Ð1Ñ2Ô2Ð2ÝŒJ�tÑÔÐÐÝÐ3Ñ4Ô4Ð4ri   )rÿ   r	  rå  Úinclude_runsr	  úls_schemas.InsightsReportResultc               óà  — |�"|€|�t          d¦  «        ‚|j        }|j        }n|�|€t          d¦  «        ‚|}|}|                      dd|› d|› �¦  «        }t	          j        |¦  «         |                     ¦   «         }|s*t          j        d	i |¤Ž}	|	 	                    | ||¦  «         |	S t          j
        | ||¬¦  «        |d<   t          j        d	i |¤Ž}	|	 	                    | ||¦  «         |	S )
aG  Fetch an Insights report by ID or from a prior report object.

        Args:
            id: The Insights report ID (aka clustering job ID). Provide with
                ``project_id`` if ``report`` is not provided.
            report: An ``InsightsReport`` object returned by ``generate_insights`` or
                ``poll_insights``. If provided, ``id`` and ``project_id`` must be omitted.
            project_id: The tracing project (session) ID associated with the report.
                Required if ``report`` is not provided.
            include_runs: Whether to include all runs for the report.

        Returns:
            An ``InsightsReportResult`` with job metadata, clusters, summary report,
            and optionally ``runs``.

        Raises:
            ValueError: If the required identifiers are not provided.
        Nr		  r	  r-  r”  r
	  )rÊ  rÁ  Újob_idrö  rh   )rï   rÿ   rå  r/  r¤   r0  rù  r{  ÚInsightsReportResultÚ_attach_clientÚ_fetch_insights_runs)
râ  rÿ   r	  rå  r	  r	  rÁ  ÚrespÚreport_jsonr¹  s
             re   Úget_insights_reportzClient.get_insights_report|,  s?  € ð6 ÐØˆ~ Ð!7Ý ØVñô ð ð ”YˆFØÔ*ˆJˆJàˆz˜ZÐ/Ý Ð!TÑUÔUÐUØˆFØ#ˆJà×(Ò(ØÐ> 
Ð>Ð>°fÐ>Ð>ñ
ô 
ˆõ 	Ô+¨DÑ1Ô1Ð1Ø—i’i‘k”kˆàð 	ÝÔ4ÐCÐC°{ÐCÐCˆFØ×!Ò! $¨
°FÑ;Ô;Ð;ØˆMå(Ô=ØØ!Øð
ñ 
ô 
ˆ�FÑõ
 Ô0Ð?Ð?°;Ð?Ð?ˆØ×Ò˜d J°Ñ7Ô7Ð7Øˆri   )r  Úpriorityr	  ú
list[dict]c               ó¨   — d|i}|�||d<   |�||d<   t          | j        d¦  «        }|                      d||¬¦  «        }|                     ¦   «         S )aÂ  List issues associated with a tracing project (forge issues board).

        Retrieves all issues from the forge issues board that are linked to the
        given tracing project (identified by its session name).

        Args:
            project_name (str): The name of the tracing project (session) whose
                issues you want to list.
            status (Optional[str]): Filter issues by status (e.g. ``"open"``,
                ``"resolved"``). If ``None``, issues of all statuses are returned.
            priority (Optional[str]): Filter issues by priority (e.g.
                ``"high"``, ``"medium"``, ``"low"``). If ``None``, issues of all
                priorities are returned.

        Returns:
            List[dict]: A list of issue objects. Each dict contains the following
            keys:

            - ``id`` (str): Issue UUID.
            - ``tenant_id`` (str): Workspace/tenant UUID.
            - ``issue_board_id`` (str): UUID of the issue board this issue belongs to.
            - ``title`` (str): Issue title.
            - ``description`` (str): Issue description.
            - ``priority`` (str): Issue priority.
            - ``status`` (str): Issue status.
            - ``category`` (str | None): Optional category label.
            - ``trace_ids`` (List[str]): Run/trace IDs associated with the issue.
            - ``github_issue_url`` (str | None): URL of the linked GitHub issue.
            - ``github_issue_number`` (int | None): Number of the linked GitHub issue.
            - ``created_at`` (str): ISO-8601 creation timestamp.
            - ``updated_at`` (str): ISO-8601 last-updated timestamp.
            - ``resolved_at`` (str | None): ISO-8601 resolution timestamp, or ``None``.

        Example:
            ```python
            from langsmith import Client

            client = Client()

            # List all issues for a project
            issues = client.list_project_issues("my-project")

            # Filter by status and priority
            open_high = client.list_project_issues(
                "my-project", status="open", priority="high"
            )
            for issue in open_high:
                print(issue["id"], issue["title"])
            ```
        rû  Nr  r	  Úissuesr-  r†  )r  rk   r/  rù  )râ  rô  r  r	  r‡  r_  r2  s          re   Úlist_project_issueszClient.list_project_issues¸,  sh   € ðr #1°,Ð!?ˆØÐØ%ˆF�8ÑØÐØ!)ˆF�:ÑÝ˜dœl¨HÑ5Ô5ˆØ×,Ò,¨U°DÀÐ,ÑHÔHˆØ�}Š}‰ŒÐri   rù  úLiteral['openai', 'anthropic']c               ó|  — |                       dd¦  «        }t          j        |¦  «         d„ |                     ¦   «         D ¦   «         }t	          ¦   «         }|dv r|                     t          ¦  «         |dv r|                     t          ¦  «         |                     |¦  «        x}rt          |v rdndS |dk    r
|}t          }	n8|dk    r
|}t          }	n(|s|r|p|}|rt          nt          }	nt          d¦  «        ‚|                       d	d|	|d
œg¬¦  «        }t          j        |¦  «         |	t          k    rdndS )Nr-  z/workspaces/current/secretsc                ó8   — h | ]}|                      d ¦  «        ’ŒS rÔ  rz   )r|   Úss     re   rØ  z2Client._ensure_insights_api_key.<locals>.<setcomp>-  s"   € Ð@Ð@Ð@¨1˜!Ÿ%š% ™,œ,Ð@Ð@Ð@ri   )NÚopenai)NÚ	anthropicr$	  r%	  z1Must specify openai_api_key or anthropic_api_key.r�  )r}   r~   r  )
r/  r¤   r0  rù  r  rô  Ú_OPENAI_API_KEYÚ_ANTHROPIC_API_KEYÚintersectionrï   )
râ  rò  ró  rñ  r2  Úworkspace_keysÚtarget_keysÚexisting_keysr’  Úapi_vars
             re   rþ  zClient._ensure_insights_api_keyú,  s|  € ð ×,Ò,¨UÐ4QÑRÔRˆÝÔ+¨HÑ5Ô5Ð5Ø@Ð@°·²±´Ð@Ñ@Ô@ˆÝ‘e”eˆØÐ$Ð$Ð$Ø�OŠO�OÑ,Ô,Ð,ØÐ'Ð'Ð'Ø�OŠOÕ.Ñ/Ô/Ð/à*×7Ò7¸ÑDÔDÐDˆ=ð 	RÝ.°-Ð?Ð?�8�8À[ÐPØ�hÒÐØ$ˆGÝ%ˆGˆGØ�kÒ!Ð!Ø'ˆGÝ(ˆGˆGØð 	RÐ0ð 	RØ$Ð9Ð(9ˆGØ)7ÐO•o�oÕ=OˆGˆGåÐPÑQÔQÐQØ×,Ò,ØØ)Ø!¨GÐ4Ð4Ð5ð -ñ 
ô 
ˆõ
 	Ô+¨HÑ5Ô5Ð5Ø"¥oÒ5Ð5ˆxˆx¸;ÐFri   c                ó4  ‡‡— t          |¦  «        dk    rt          j        d¦  «         |d d…         }t          j                             t          j        j        ¦  «        Š|                      |p3dt          j                             ¦   «                              d¦  «        z   ¦  «        Šd„ t          t          |¦  «        ¦  «        D ¦   «         }ˆˆfd„t          ||¦  «        D ¦   «         }|                      |¬¦  «         |                      ¦   «          ‰S )NrZ  zDCan only generate insights over 1000 data. Truncating to first 1000.z	insights z%Y-%m-%d %H:%M:%Sc                óN   — g | ]"}t          t          j        ¦   «         ¦  «        ‘Œ#S rh   )rW   r[  rð  r£  s     re   rZ  z0Client._ingest_insights_runs.<locals>.<listcomp>*-  s&   € Ð?Ð?Ð?¨•3•t”z‘|”|Ñ$Ô$Ð?Ð?Ð?ri   c                óÆ   •— g | ]]\  }}d |dd…         id |i||‰                      d¦  «        › t          |¦  «        › �‰t          j        d¬¦  «        z
  ‰d‰j        ddœ
‘Œ^S )r5  Nr[   z%Y%m%dT%H%M%S%fZ)r†  rm  r·   )
r¾  r¿  rÿ   rê  r  r¿  r¨  rÃ  rÁ  r†  )ÚstrftimerW   rÃ  r.  rÿ   )r|   rÀ  r  rc   r†  s      €€re   rZ  z0Client._ingest_insights_runs.<locals>.<listcomp>+-  s˜   ø€ ð 
ð 
ð 
ñ �˜ð & q¨¨!¨¤uÐ-Ø&¨˜?ØØ"Ø#&§<¢<Ð0BÑ#CÔ#CÐ RÅSÈÁ[Ä[Ð RÐ RØ!¥HÔ$6¸qÐ$AÑ$AÔ$AÑAØØ#Ø%œjØðð ð
ð 
ð 
ri   )rY  )rp   rª   r«   rÃ  rc   rÍ  rÎ  r’  r0	  rc  rª  ri  rÍ  )râ  rL  r†  r  rö  rc   r†  s        @@re   rÿ  zClient._ingest_insights_runs-  s#  øø€ Ýˆt‰9Œ9�tÒÐÝŒMØVñô ð ð ˜˜˜”;ˆDÝÔ×#Ò#¥HÔ$5Ô$9Ñ:Ô:ˆØ×%Ò%Øð UØ�hÔ/×3Ò3Ñ5Ô5×>Ò>Ð?RÑSÔSÑSñ
ô 
ˆð @Ð?­eµC¸±I´IÑ.>Ô.>Ð?Ñ?Ô?ˆð
ð 
ð 
ð 
ð 
õ ! ¨$Ñ/Ô/ð
ñ 
ô 
ˆð 	×Ò dÐÑ+Ô+Ð+Ø�
Š
‰ŒˆØˆri   ry   )8rk   r‡  r’  r‡  r
  rG  r  rH  r6  r‡  rs   rI  r7  ré   r8  rJ  r9  rK  r:  rK  r;  rK  r<  ré   r=  rL  r>  rM  r?  r§  rž  rN  r@  r¯  rA  rO  r™   rš   r˜   r›   r¦  r§  rB  r‡  rC  rM  r�   r¯  rD  rP  rE  ré   rF  rQ  rX   rY   )rX   r­  )rX   r¶  )rX   rÀ  )rX   rÑ   )rX   rÈ  )rX   rÒ   )rX   rÎ   )rX   rÍ   )rX   rÓ   )rX   rÔ   )rX   rÐ   )rÙ  rÚ  r�   r  rX   rY   )rá  rW   rÅ  rü  rÜ  rW   r�   r  rÝ  rM  rX   rY   )rX   rW   )rý  r@  rX   rY   )rX   r°  )r  rW   r~   r   rX   rY   ©rX   rY   )rX   r‡  )r~   r‡  rX   rY   )r~   r¯  rX   rY   )rX   rŸ  )rX   r3  )r7  rM  rX   r‡  )rD  rE  rF  rW   r>  rG  r?  rý   r@  rH  rA  rH  rB  rI  rC  rW   r�   r   rX   rJ  )r_  rW   r‡  rÿ  rX   rˆ  )
r_  rW   rÅ  rÿ  r�  r’  r‘  rW   rX   rˆ  )rœ  r�  r†  rW   rž  rŸ  r   rŸ  rš  r‡  r›  r¡  rX   r¢  )r©  r«  rž  rŸ  r   rŸ  r†  r‡  rš  r‡  r›  r¡  rX   r¢  )FF)r»  r»  rD  ré   rŒ  ré   rX   r  )rö  rÑ  rX   rY   ©rX   ré   )rö  rä  rã  ré   rX   r  )rX   rœ   )rð  r*   rX   rY   )r†  rW   r¾  ru   rÃ  rö  rô  r‡  rõ  r‡  r   ré   r’  r‡  rk   r‡  r�   r   rX   rY   )rÏ  r  r’  r‡  rk   r‡  rø  r‡  r»  r‡  rù  r‡  rú  r‡  rX   rY   )rÏ  r  r’  r‡  rk   r‡  rø  r‡  r»  r‡  rù  r‡  rú  r‡  )r¾  r  )r¿  r  )rý  r   )rC  r  rX   r  )rÀ  r/  rX   r0  )rB  rC  rk   r‡  r’  r‡  rø  r‡  r»  r‡  rù  r‡  rú  r‡  rX   rY   rŽ  )rY  rZ  rD  rZ  rX   rY   )rÅ  rü  rC  rW   rk   r‡  r’  r‡  rø  r‡  r»  r‡  rù  r‡  rú  r‡  )rB  rv  rk   r‡  r’  r‡  rø  r‡  r»  r‡  rù  r‡  rú  r‡  rX   rY   )rY  rZ  rD  rZ  r   ré   rX   rY   )r‹  r:   rŠ  rý   rk   r‡  r’  r‡  rø  r‡  r»  r‡  rù  r‡  rú  r‡  )r   r¡  r¢  r£  rŠ  rý   ),rÀ  r¸  r†  r‡  rÃ  r«  r¿  r¬  r¨  r¬  rý  r‡  r¾  rÿ  r¿  rÿ  rÀ  r/  rÁ  rÿ  r©  r­  rþ  r®  r   ré   rª  r¯  r’  r‡  rk   r‡  rø  r‡  r»  r‡  rù  r‡  rú  r‡  r�   r   rX   rY   )rµ  r  r’  r‡  rk   r‡  rø  r‡  r»  r‡  rù  r‡  rú  r‡  )rµ  r  r’  r‡  rk   r‡  rø  r‡  r»  r‡  rù  r‡  rú  r‡  rX   rY   )r“   N)rŠ  rý   rº  r§  rX   rY   )rº  r§  rX   rY   )r»  rÎ  rX   rÎ  rë  )
rÀ  r¸  ræ  ré   rå  rç  r¿  r¬  rX   rÎ  )rõ  rW   rå  rõ  rô  rö  rÐ  ré   r‹  rM  rò  r÷  ró  r‡  rô  rø  r�   r   rX   rù  )$rå  rõ  rô  rö  rÃ  r‡  rê  rç  rª  rç  rÿ  r‡  ró  r‡  r   r‡  r  r‡  rÐ  r›   r±  rç  r¿  r¬  rý  r›   r  r  rò  r÷  r‹  rM  r�   r   rX   rù  )rå  rç  rô  r‡  r‹  rM  rŠ  rý   ró  r‡  r¿  r¬  rX   r!  )"rÿ   r;  r·   rç  r  rç  rÃ  r‡  r8  r­  r  r;  r9  r;  r¿  r‡  r¨  r‡  rý  r›   rÿ  r‡  ró  r‡  r   r‡  r  r‡  rÐ  r›   r:  r‡  rX   ru   )r»  rE  rô  r‡  rå  rç  rX   rW   )rÀ  r¸  rL  rç  rX   rW   )rÀ  r¸  rX   rY   )rÀ  r¸  rX   r‡  )rÀ  r¸  rX   ré   )rN  r^  rÀ  rç  rX   rÎ  )rN  r^  r  r­  rX   rù  )rg  rç  rf  r‡  rX   rh  )rg  r¸  rX   rY   )rN  rW   rX   r¢  )rN  rW   ry  r;  r‹  rM  rX   rz  )r‚  rW   r  r;  r†  r‡  r�  r‡  r‹  rM  rX   rƒ  )rô  rW   rš  r‡  rC  rÿ  rˆ  ré   r‰  rÿ  rŠ  rç  r‹  rM  rŒ  rM  r�  r­  rX   rŽ  )rå  r¸  r†  r‡  rš  r‡  rC  rÿ  r‰  rÿ  r¨  r¬  rX   rŽ  )rX   rÌ  )rX   r¹  )rå  r‡  rô  r‡  r›  ré   rX   rœ  )rô  rW   rå  r‡  rX   ré   )rå  rç  rô  r‡  rX   r�  )
NNNNNNNNNN)r  r;  r†  r‡  r�  r‡  rŠ  rç  rß  r‡  rà  r›   r›  r›   rá  r‡  r‹  rM  rC  râ  rX   rƒ  )rô  r‡  rå  r‡  rX   rY   )rf  rW   rš  r‡  r›  rë  rè  râ  ré  râ  rê  rì  rC  rÿ  rX   r¢  )rf  r‡  rg  rç  rX   ré   )rf  r‡  rg  rç  rX   r¢  )
rg  rç  rf  r‡  rù  rú  rû  rú  rX   rü  )rg  rç  rf  r‡  rX   r  )r  r;  r›  r‡  rf  r‡  r	  r‡  rC  râ  r‹  rM  rX   r
  )rg  rç  rf  r‡  rX   rY   )
rg  rç  rf  r‡  r  r  r  rW   rX   rY   )
rg  rç  rf  r‡  r  r‡  r‹  rM  rX   r  )
rg  rç  rf  r‡  r  r¬  r  r‡  rX   r  )r   rW   r  r‡  rf  r‡  rX   r¢  )rg  r¸  rX   rë  )NNNN)rL  rW   r-  r‡  rg  rç  rf  r‡  r.  r¬  rX   r/  )r5  r6  r7  r8  rg  rç  rf  r‡  r.  r¬  rX   r/  rM  )
r»  rÎ  rg  rç  rf  r‡  r.  r¬  rX   r/  )r¾  rI  rJ  ré   r   ré   rX   rK  )rg  r¸  r`  ra  r   ré   rX   rb  )rg  r¸  rn  ro  r   ré   rX   rb  )r  rt  rX   rý   )r�  )r¾  rz  rC  rý   rX   r{  )r…  r†  r   ré   rX   rb  )rf  r‡  rg  rç  r¾  rŽ  r   ré   r�  r�  r�   r   rX   r�  )NNNNNNNNNFNN)r¾  rÆ  rg  rç  rf  r‡  r.  r¬  r¿  rÆ  rC  rÆ  r`  rÇ  r¹  rç  rP  rç  rN  ré   rO  r­  rþ  r®  rX   r/  )r¹  r¸  r  r¬  rX   r/  )NNNNNT)rg  rç  rf  r‡  ry  r  r  rÒ  r”  r÷  rÓ  ré   rŠ  rý   r‹  rM  rC  rÿ  ró  r‡  rÑ  ré   r�   r   rX   rz  )r¹  r¸  r¾  râ  r¿  rÆ  rC  rÿ  r`  rÇ  rg  rç  rW  rÖ  rþ  r®  rX   ru   )rf  rÝ  rg  rÞ  r`  rß  r   ré   r�   r   rX   ru   )r¹  r¸  rX   rY   )ry  rø  r÷  ré   rX   rY   )rg  rç  rf  r‡  r  r  rX   r  )rg  rç  rf  r‡  r
  rW   ry  r  rì  ré   rX   rY   )
r»  r  ræ  ré   rå  rç  r¿  r¬  rX   r  )r  r  r»  r  rX   r  )rØ  r  r  r‡  rX   r  )r»  r  r×   r1  rå  rç  r¿  r¬  r0  râ  r  r2  ræ  ré   rX   r!  )r9  r  r»  r;  r0  râ  rå  rç  r:  r<  rX   r  )NrN  ).rÀ  rç  r}   rW   r—  r˜  r~   rS  rê  rç  rA  rT  r$  rU  r0  râ  rC  rV  rP  rç  rO  rç  rB  rW  r?  rý   rå  rç  rP  rç  rQ  rç  rÁ  rÿ  rý  r›   rÁ  rç  r¿  r¬  rR  ré   r�   r   rX   rX  )rO  r¸  r—  r˜  r~   rS  rA  rT  r$  rU  rX   rY   )rO  r¸  rX   rX  )r  r  rp  r÷  rC  rq  r‹  rM  r�   r   rX   rr  )rO  r¸  rX   rY   )r   rT  r—  r˜  r~   rS  rA  rT  r$  rU  rC  rÿ  rX   rY   )rÀ  r¸  rp  rW   ry  rz  rB  rW  rO  rç  rX   r{  )
rÀ  r¸  rŠ  rŸ  ry  rz  r‰  r‹  rX   rŒ  )rÀ  r¸  r‹  rM  rX   r™  )
rg  rç  rÁ  rç  r‹  rM  rŠ  rý   rX   r�  )r£  r¸  rX   r¤  )rp  rW   r¨  r©  rª  r«  rg  rç  rÁ  rç  rX   r¤  )
r£  r¸  rp  rW   r¨  r©  rª  r«  rX   r¤  )r£  r¸  rX   rY   )rp  rW   rB  r³  r²  r›   rX   r´  )
rp  r÷  r�  r‡  r‹  rM  rŠ  rý   rX   r»  )rp  rW   rB  rW  r²  r›   rX   r´  )rp  rW   rX   rY   )
rÄ  r;  r†  r‡  r�  r‡  r‹  rM  rX   rÅ  )r†  rW   rš  r‡  rÌ  rç  rÍ  r‡  rÎ  rÏ  rX   rÐ  )rÌ  r¸  rX   rÕ  )rÌ  r¸  r†  r‡  rš  r‡  rÍ  r‡  rÎ  rÏ  rX   rY   )rÌ  r¸  rX   rY   )rÌ  r¸  r  r;  rö  rÞ  rX   rY   )rÌ  r¸  rÀ  r¸  rX   rY   )rÌ  r¸  r½  rý   rX   ræ  )rÌ  r¸  r  rê  r‹  rM  rX   rë  )r†  rW   rî  rø  rä  rç  rš  r‡  r.  r¬  rC  râ  rÿ   rç  rX   rï  )r  rW   rX   ré   )rû  rW   r  rW   rX   rü  )r[   r   )rÿ  rW   r‹  rý   rŠ  rý   rX   r‡  )rÿ  rW   r  rW   r©  r  rX   rY   )r  rW   r  ré   rX   r  )r  rW   rX   rW   )r  rW   rX   ré   )r  rW   rX   r  )r‹  rý   rŠ  rý   r   r›   r!  r›   r"  r$  r#  r%  rÿ  r‡  rX   r&  )r  rW   rX   r,  )r  rW   rš  r‡  r1  r‡  r©  r÷  r   ré   rX   r2  )r  rW   r  r   r8  r‡  r©  rÇ  rš  r‡  rX   rW   )r  rW   rš  r‡  r1  r‡  r©  r÷  r   r›   r!  r›   rX   ru   )r  rW   rX   rY   )r  rW   r  r›   rX   rW   )r  rW   r  r›   rX   rL  )
r  rW   r  r›   rR  ré   r  ré   rX   rL  )
r  rW   r‹  rM  rŠ  rý   r  ré   rX   rY  )r  rW   r  r  r   r!  r"  ré   rR  ré   r  ré   rX   r   )r  rW   r  rc  r8  rW   r   r›   rš  r‡  r1  r‡  r©  r÷  ra  rÇ  rb  r‡  rX   rW   )ri  rW   rî   r‡  rX   rj  )ri  rW   rM  rr  r<  r‡  rš  r‡  r1  r‡  r©  r÷  r   r›   rX   rW   )ri  rW   rî   r‡  rX   rz  )ri  rW   rX   rY   )ri  rW   rX   ré   )r‹  rý   rŠ  rý   r   r›   r!  r›   rÿ  r‡  rX   r&  )ri  rW   r›  rœ  rî   r‡  rX   ru   )ri  rW   r›  rœ  rM  ru   r<  r‡  rš  r‡  r1  r‡  r©  r÷  r   r›   rX   rW   )r›  rœ  r‹  rý   rŠ  rý   r   r›   r!  r›   rÿ  r‡  rX   r&  )r  rW   r†  rW   rX   ré   )r†  rW   r›  rœ  rš  r‡  r1  r‡  r©  r÷  r   ré   rX   rY   )r  rW   r†  rW   rš  r‡  r1  r‡  r©  r÷  r   r›   rX   rY   )NNNNNNr   r[   TNT)rL  r³  rË  r´  rµ  r¶  rC  rÿ  r·  r‡  rš  r‡  r�  rM  rŒ  rý   r¸  ré   r¹  rº  r»  ré   r`  r¼  r�   r   rX   râ   )rL  r³  rË  rÀ  rµ  r¶  rC  rÿ  r·  r‡  rš  r‡  r�  rM  rŒ  rý   r¸  ré   r¹  rº  r»  ré   r`  rÁ  r�   r   rX   rá   )NNNNNNr   r[   TNTr  )rL  r³  rË  rÃ  rµ  r¶  rC  rÿ  r·  r‡  rš  r‡  r�  rM  rŒ  rý   r¸  ré   r¹  rº  r»  ré   rÄ  rÅ  r`  rÆ  r�   r   rX   rÇ  )rL  rÍ  rË  rÎ  rµ  r¶  rC  rÿ  r·  r‡  rš  r‡  r�  rM  rŒ  rý   r¸  ré   r¹  rÏ  r»  ré   rÄ  rÅ  r`  rÐ  r�   r   rX   rÚ   )FNNN)rg  r¸  rÁ  r¹  rÕ  ré   rP  rÌ  rÖ  r×  r‹  rM  rX   rØ  )NNFNNN)r†  r‡  rå  rÌ  rÕ  ré   rP  rÌ  rÖ  r×  r‹  rM  rX   rà  )rô  rõ  rð  rW   r†  rÝ  rñ  rö  rò  rÝ  ró  rÝ  rX   r÷  )r	  r	  rÿ   r¯  rå  r¯  r	  rý   rº  rý   r	  ré   rX   r÷  )
rÿ   r¯  r	  r	  rå  r¯  r	  ré   rX   r	  )rô  rW   r  r‡  r	  r‡  rX   r	  )rò  rÝ  ró  rÝ  rñ  rö  rX   r 	  )rL  r  r†  rÝ  )êrÆ   rÇ   rÈ   rÉ   Ú	__slots__rù  rŽ   rµ  r¿  rÃ  Úpropertyrö  rË  rÍ  rÏ  rÑ  rÓ  rÕ  rØ  rà  Ústaticmethodrß  r  r  r  r  r  r  r  r"  r’  ÚsetterrB  r�   rž  r6  r=  r/  rŽ  r™  r{  r&  r'  rª  r¨  rÐ  rß  rá  rî  r™   ró  r  r  r  rÈ  rÉ  rË  rÌ  rÊ  r  r  rX  ri  rM  r  r‰  ry  r§  r´  r²  r¸  rÅ  rÍ  rã  Ú_deprecatedrï  rþ  rÛ  r7  rD  rH  rG  rT  rY  r[  r]  rb  rd  rp  rr  rt  rx  r€  r‡  r’  r–  r¶  rJ  r¤   Úxor_argsr  r¥  r¨  rÞ  rå  rç  ró  rö  rm  r  r  r  r  r  r  r  r+  r�  r4  r@  rH  r_  rf  re  rs  ry  r‚  rr  rŒ  r(  r¬  r¸  r3  rÊ  r¼  rÜ  rô  rö  r  r	  r  r  r  r/  r6  r7  rM  rG  r_  r?  rl  ro  rt  rv  rx  rˆ  r˜  rœ  r¡  r   r¢  r§  r­  r¯  r±  rº  r¾  rÀ  rÃ  rË  rÔ  rØ  rÛ  rÝ  rã  rå  ré  rí  rö  rú  rþ  r  r  r  r  r  r  r  ÚPromptSortFieldÚ
updated_atr+  r  r6  rE  rG  rI  rK  rP  rW  r^  r`  rg  rq  rx  r~  r€  r…  rˆ  rŽ  r‘  r—  rš  rm  rv  rƒ  r•  rŒ  r¤  r¡  r¯  r„  r   r¿  rÒ  rß  rï  r-   ÚDEFAULT_INSTRUCTIONSr	  r	  r	  r	  rþ  rÿ  rh   ri   re   r�   r�   À  sŸ$  € € € € € € Ø8Ð8ð6ð 6ð 6€Iðp ÐÐÑØ&Ð&Ð&Ñ&ØÐÐÑØ#Ð#Ð#Ñ#Ø!Ð!Ð!Ñ!ØÐÐÑØ2Ð2Ð2Ñ2Ø)Ð)Ð)Ñ)Ø4Ð4Ð4Ñ4Ø=Ð=Ð=Ñ=ØÐÐÑð "&ñd(ð "&Ø(,Ø<@Ø!%Ø.2Ø#'Ø7;ØEIØFJØGKØ).ð Ø-1Ø59Ø@DØ-1Ø9=Ø.2Ø'+Ø15Ø&*Ø.2Ø,0ØHLØ%*Ø48ð?d(ð d(ñ d(ð d(ð d(ð d(ñZ
ð 
ð 
ð 
ñ#ð #ð #ð #ñ*(ð (ð (ð (ð* ñ.ð .ð .ñ „Xð.ð
 ñ;ð ;ð ;ñ „Xð;ð
 ñ3ð 3ð 3ñ „Xð3ð
 ñ2ð 2ð 2ñ „Xð2ð
 ñ;ð ;ð ;ñ „Xð;ð ñ1ð 1ð 1ñ „Xð1ð
 ñ0ð 0ð 0ñ „Xð0ð
 ñ0ð 0ð 0ñ „Xð0ñ
ð ð ð ð4 ð $(ðAð Añ Að Að Añ „\ðAñFXð Xð Xð Xñð ð ð ñ3ð 3ð 3ð 3ð ñ(ð (ð (ñ „Xð(ð ñBð Bð Bñ „XðBñð ð ð ñ"Fð Fð Fð Fñ
Fð Fð Fð Fð ñð ð ñ „Xðð „^ñ;ð ;ð ;ñ „^ð;ð ñ"ð "ð "ñ „Xð"ð Ôñ@ð @ð @ñ Ôð@ð ñ$ð $ð $ñ „Xð$ð „^ñHð Hð Hñ „^ðHð ñð ð ñ „Xðñ@ð ð ð ñð ð ð ð. -1Ø"#Ø<@Ø=AØMQØðn
ð n
ñ n
ð n
ð n
ð n
ðb 6:ð!ð !ñ !ð !ð !ð !ðH  $Ø17Øð'0ð '0ñ '0ð '0ð '0ð '0ð` &*Ø3=Ô3FÔ3Ið:
ð :
ñ :
ð :
ð :
ð :
ðD #Ø%)Ø3=Ô3FÔ3Ið_
ð _
ñ _
ð _
ð _
ð _
ðH Øñ	7ñ 7ð 7ð 7ð 7ñr@ð @ð @ð @ñ :ð :ð :ð :ð ð	,ð ,ñ ,ð ,ð ,ð ,ð\ ñ"ð "ð "ñ „Xð"ñð ð ð ð  '+Ø%)Ø-2Ø!%Ø!%ðsð sñ sð sð sð sðr "&Ø!%Ø%)Ø#'Ø'+Ø $ðpð pñ pð pð pð pðl "&Ø!%Ø%)Ø#'Ø'+Ø $ðE ð E ñ E ð E ð E ð E ñN)ð )ð )ð )ñ+ð +ð +ð +ñð ð ð ñ,-ð -ð -ð -ð ñ
ð 
ð 
ñ „\ð
ñ,ð ð ð ñ(Dð Dð Dð Dð> "&Ø!%Ø%)Ø#'Ø'+Ø $ð_ð _ñ _ð _ð _ð _ðJ ð ñL3ñ L3ð L3ð L3ð L3ðf "&Ø!%Ø%)Ø#'Ø'+Ø $ðD7ð D7ñ D7ð D7ð D7ð D7ðT "&Ø!%Ø%)Ø#'Ø'+Ø $ð8?ð 8?ñ 8?ð 8?ð 8?ð 8?ð| ð ñ`3ð .3ð`3ð `3ñ `3ð `3ð `3ð `3ðL Ø!%Ø!%Ø%)Ø#'Ø'+Ø $ðjð jñ jð jð jð jðb ðVð Vñ Vð Vð Vð Vðx #Ø)-Ø26Ø04Ø#Ø!%Ø"&Ø+/Ø $Ø$(Ø8<Ø-2Ø7;Ø!%Ø!%Ø%)Ø#'Ø'+Ø $ð-bð bñ bñ bð bð bðP "&Ø!%Ø%)Ø#'Ø'+Ø $ðdð dñ dñ dð dð dðT "&Ø!%Ø%)Ø#'Ø'+Ø $ð5ð 5ñ 5ñ 5ð 5ð 5ðp =Añ72ñ 72ñ 72ð 72ð 72ñr<ñ <ñ <ð <ð <ñB5ñ 5ð 5ð 5ðn €[ñ	2ñô ð !&ñQ
ð
 )-Ø26ñQ
ð Q
ñ Q
ñ Q
ð Q
ñô ðQ
ðf €[ñ	8ñô ð CGØ<@ØØ#Ø*.Ø $Ù(-ñ?ð ?ñ ?ñ ?ð ?ñô ð?ðB €[ñ	/ñô ð CGØ<@Ø"&Ø&*Ø26Ø#Ø $Ø&*Ø%)Ø"&Ø+/Ø26Ø $Ø/3Ø*.Ø#ñ%Fð Fñ Fñ Fð Fñô ðFðP €[ñ	2ñô ð )-Ø&*Ø#ÙØ $Ø26ñ@ð @ñ @ñ @ð @ñô ð@ðJ '+Ø#'Ø(,Ø"&Ø-1Ø/3Ø9=Ø$(Ø"&Ø $Ø#Ø $Ø&*Ø%)Ø"&Ø*.ñ%Zð Zñ Zñ Zð Zð Zðx €[ñ	1ñô ð '+Ø(,ñ
ð 
ñ 
ñ 
ð 
ñô ð
ðF '+Ø(,ñ
ð 
ñ 
ñ 
ð 
ð 
ð8 €[ñ	?ñô ð KOñ :ð :ñ :ñ :ð :ñô ð:ð@ €[ñ	?ñô ñ6ñ 6ð 6ñô ð6ð, €[ñ	?ñô ñDñ Dð Dñô ðDñ6 ñ  ð  ð  ð €[ñ	?ñô ð MQñKñ Kñ Kð Kñô ðKð> €[ñ	?ñô ð PTñBñ Bñ Bð Bñô ðBð6 )-ñ&
ð '+ñ	&
ð &
ñ &
ñ &
ð &
ð &
ðT )-ñ&
ð '+ñ	&
ð &
ñ &
ñ &
ð &
ð &
ñP6ñ 6ð 6ð 6ñ 
ñ 
ð 
ð 
ð: 04Ø#ñð ñ ñ ð ð ðD 04Ø"Ø'+Ø#ñð ñ ñ ð ð ðJ &*Ø#'ØØ(,Ø26Ø&*Ø)-Ø.2ñBUð BUñ BUñ BUð BUð BUðP #Ø%)Ø#'Ø(,Ø04ñ/Uð /Uñ /Uñ /Uð /Uð /Uñbñ ð ð ñ(ñ ð ð ð €XÔÑ5Ñ6Ô6ð %)Ø&*Ø#ñ'
ð '
ñ '
ñ '
ð '
ñ 7Ô6ð'
ðX %)Ø&*Ø#ñ
ð 
ñ 
ñ 
ð 
ð 
ð: AEñð ñ ñ ð ð ð. )-Ø&*ñ	R
ð R
ñ R
ñ R
ð R
ð R
ðl 04Ø"Ø'+Ø26Ø04Ø)-Ø(,Ø)-Ø#Ø-1ñIñ Iñ Ið Ið IðV €XÔÑ5Ñ6Ô6à/3ÐQUñ6ð 6ñ 6ñ 6ð 6ñ 7Ô6ð6ð@ &*Ø)3Ô)<Ô)?Ø26Ø37ØLPØ#'ñG
ð G
ñ G
ñ G
ð G
ð G
ðX '+Ø(,ñ	ð ñ ñ ð ð ð. €XÔÑ5Ñ6Ô6ð '+Ø(,ñ	-
ð -
ñ -
ñ -
ð -
ñ 7Ô6ð-
ðb )-ñC=ð '+ñ	C=ð C=ñ C=ñ C=ð C=ð C=ðN )-ñ ð '+ñ	 ð  ñ  ñ  ð  ð  ðJ 04Ø#'Ø&*Ø/3Ø-1Ø#ñ3ð 3ñ 3ñ 3ð 3ð 3ðj €XÔÑ5Ñ6Ô6ð )-Ø&*ñ	6ð 6ñ 6ñ 6ð 6ñ 7Ô6ð6ð> )-Ø&*ñ	:6ð :6ñ :6ñ :6ð :6ð :6ð~ )-Ø&*Ø $Ø#ñ!ð !ñ !ñ !ð !ð !ðL )-Ø&*Ø-1Ø!ñ/<ð /<ñ /<ñ /<ð /<ð /<ðj )-Ø&*ñHð Hñ Hñ Hð Hð HñT!ñ !ð !ð !ð €XÔÑ5Ñ6Ô6ð %)Ø(,Ø&*Ø26ñ
ñ 
ñ 
ð 
ñ 7Ô6ð
ðB €XÔÑ5Ñ6Ô6ð Ø(,Ø&*Ø26ñ5
ñ 5
ñ 5
ð 5
ñ 7Ô6ð5
ðt )-Ø&*Ø26ñW
ñ W
ñ W
ð W
ð W
ð@ $)Ø-2ñ{0ñ {0ñ {0ð {0ð {0ðB =AØ-2ñ
ð 
ñ 
ñ 
ð 
ð 
ð. =AØ-2ñ0ð 0ñ 0ñ 0ð 0ð 0ðl =AØ-2ñ
ð 
ñ 
ñ 
ð 
ð 
ñ&ñ ð ð ðB %/ñ'ñ 'ñ 'ð 'ð 'ðZ =AØ-2ñ1ð 1ñ 1ñ 1ð 1ð 1ðl LPØ-2ñ	/ð /ñ /ñ /ð /ð /ðb €XÔÑ5Ñ6Ô6ð '+Ø(,ØHLØ-2Ø=>ñ[
ð [
ñ [
ñ [
ð [
ñ 7Ô6ð[
ñz 
ð  
ð  
ñD(ð (ð (ðT €XÔÑ5Ñ6Ô6ð /3Ø(,Ø&*Ø26Ø/3Ø04Ø+/Ø(,Ø+/Ø"'Ø:>Ø8<ñjñ jñ jð jñ 7Ô6ðjðZ LPñ!
ð !
ñ !
ñ !
ð !
ð !
ðJ )-Ø&*Ø37Ø9=Ø*.Ø#ñ{ñ Ø#Ø#'Ø $Ø$)ñ{ð {ñ {ñ {ð {ð {ðB ,0Ø/3Ø#'Ø+/Ø(,ØMQØ8<ñU#ð U#ñ U#ñ U#ð U#ð U#ðt $(Ø%)ØGKØ-2ñW#ð W#ñ W#ñ W#ð W#ð W#ñr6ñ 6ð 6ð 6ð$ FKñ06ð 06ñ 06ñ 06ð 06ð 06ðj )-Ø&*Ø9=ñ#ð #ñ #ñ #ð #ð #ðP )-Ø&*ð ñ'6ð '6ñ '6ñ '6ð '6ð '6ð\ )-Ø26ñ?ð ?ñ ?ñ ?ð ?ð ?ñB"ñ "ð "ð "ðL "&ñ%ð %ñ %ñ %ð %ð %ðN €[ñ	)ñô ð )-Ø26Ø04ð Ø %ñBð Bñ Bñ Bð Bñô ð
BðR KOØ04Ø(,ñ9ð 6:ñ9ð 9ñ 9ñ 9ð 9ð 9ðv €[ñ	)ñô ð )-Ø26Ø04ð Ø %ñBð Bñ Bñ Bð Bñô ð
BðN %)Øñ	Oð 04Ø:>Ø&*Ø(,Ø$(Ø04ð Ô)Ô-Ø+/Ø)-Ø?CÙ"$Ø(,Ø7;Ø/3Ø $Ø $Ø(,Ø26Ø'+ñ5Oð Oñ Oñ Oð Oð Oðj 04Ø:>Ø(,Ø$(ñ)6ð )6ñ )6ñ )6ð )6ð )6ñV6ñ 6ð 6ð 6ð& 04Ø04ØRVØ#ñ)ð )ñ )ñ )ð )ð )ñV6ñ 6ð 6ð 6ð( 04ñ06ð
 ;?Ø(,Ø$(Ø#'ñ06ð 06ñ 06ñ 06ð 06ð 06ðn HLØ?CØ)-ñ?Að ?Añ ?Añ ?Að ?Að ?AðL HLð ñdð dñ dñ dð dð dðT  $ñ	ð ñ ñ ð ð ñB	Fð &ð
 €Zñ	Fñô ð )-Ø(,Ø#ÙñJð Jñ Jñ Jð Jñ	ô ðJð$ €Zñ	Fñô ñJñ Jð Jñ	ô ðJð €Zñ	Fñô ð )-Ø(,ñJð Jñ Jñ Jð Jñ	ô ðJð* €Zñ	Fñô ñJñ Jð Jñ	ô ðJð( €Zñ	Fñô ñ	Jñ 	Jð 	Jñ	ô ð	Jð$ 16ñ9Bð 9Bñ 9Bñ 9Bð 9Bð 9Bð| 15Ø'+Ø#Ùñ-ð -ñ -ñ -ð -ð -ðf @DØ04ñ2Bð 2Bñ 2Bñ 2Bð 2Bð 2Bñh6ñ 6ð 6ð 6ð< .2Ø"Ø'+Ø#ñ(ð (ñ (ñ (ð (ð (ð\ &*Ø&*Ø-1ØMQñ,
ð ,
ñ ,
ñ ,
ð ,
ð ,
ñ\Hñ Hð Hð Hð, #Ø%)Ø-1ØMQñ&6ð &6ñ &6ñ &6ð &6ð &6ñP6ñ 6ð 6ð 6ð( ,0Ø6:ñ66ð 66ñ 66ñ 66ð 66ð 66ñp6ñ 6ð 6ð 6ñ&Hñ Hð Hð Hð> Ø#ñð ñ ñ ð ð ðL 04Ø%)Ø26Ø-1Ø $ñ9>ð 9>ñ 9>ñ 9>ð 9>ð 9>ñv
?ñ 
?ð 
?ð 
?ñ
ñ 
ð 
ð 
ð IJñ>ñ >ñ >ð >ð >ñ*  ñ   ð   ð   ñDñ ð ð ñ.
ñ 
ð 
ð 
ñ.
)ñ 
)ð 
)ð 
)ñ
Iñ 
Ið 
Ið 
Iñ
Jñ 
Jð 
Jð 
Jñ ÙØ$(Ø&+Ø1;Ô1KÔ1VÙ17Ø#ñ*Að *Añ *Añ *Að *Að *AñXñ ð ð ð8 &*Ø $Ø(,Øñ3<ð 3<ñ 3<ñ 3<ð 3<ð 3<ðt -1Ø*.Ø%)ñFNð FNñ FNñ FNð FNð FNðX &*Ø $Ø(,Ø$(Ø&*ñ8ð 8ñ 8ñ 8ð 8ð 8ñt$ñ $ð $ð $ð( GLñ.ñ .ñ .ð .ð .ð$ ).ñ
ñ 
ñ 
ð 
ð 
ð@ ).Ø Ø/4ñ>ð >ñ >ñ >ð >ð >ðH  $ÙØ#ñ7ð 7ñ 7ñ 7ð 7ð 7ðz &+Ø)-Ø!&Ø Ø/4ñO
ð O
ñ O
ñ O
ð O
ð O
ðj !%Ù"*Ø$(Ø%)Ø $Ø(,Ø15Ø,0ñKð Kñ Kñ Kð Kð Kðb "&ñ	<ð <ñ <ñ <ð <ð <ð. (,Ø%)Ø $Ø(,Ø$(ñ
ð 
ñ 
ñ 
ð 
ð 
ð6 "&ñ	<ð <ñ <ñ <ð <ð <ð (,Ø%)Ø $Ø(,Ø$(ñ
ð 
ñ 
ñ 
ð 
ð 
ñ./ñ /ð /ð /ñ/ñ /ð /ð /ñ2ñ 2ð 2ð 2ñ
2ñ 2ð 2ð 2ñ ÙØ$(Ø&+Ø#ñ
ð 
ñ 
ñ 
ð 
ð 
ñ, ÙØ$(Ø&+Ø#ñ
ð 
ñ 
ñ 
ð 
ð 
ñ&ñ ð ð ñ,>Pñ >Pð >Pð >Pñ@
ñ 
ð 
ð 
ñAñ Að Að Añ:ñ ð ð ññ ð ð ñ6Sñ Sð Sð Sñ.#ñ #ñ #ð #ð #ñ(Fñ Fñ Fð Fð FðB ð
 "&Ø6:ØFJØ#'Ø+/Ø%)Ø)*Ø ØØ-1Ø#ñ ñ  ñ  ð  ñ „Xð ð$ ð
 "&ØBFØFJØ#'Ø+/Ø%)Ø)*Ø ØØ-1Ø#ñ+ñ +ñ +ð +ñ „Xð+ð0 "&ð ØFJØ#'Ø+/Ø%)Ø)*Ø ØØ-1Ø#Ø38ñ'b
ñ b
ñ b
ð b
ð b
ðb ØKOØFJØ#'Ø+/Ø%)Ø)*Ø ØØMQØ#Ø38ñ1y
ñ y
ñ y
ð y
ð y
ð~ Ø9=Ø59Ø#ñ8!ñ 8!ñ 8!ð 8!ð 8!ðt €[ñ	Bñô ð #Ø*.ØØ9=Ø59Ø#ñc
ñ c
ñ c
ð c
ñô ðc
ðJ ð
 1ØØ7;Ø%)Ø(,ñ`ð `ñ `ñ `ð `ñ „Yð`ðD ð 48Ø%)Ø-1ÙÙØñ35ð 35ñ 35ñ 35ð 35ñ „Yð35ðj ð &*Ø37Ø-1Ø!ñ9ð 9ñ 9ñ 9ð 9ñ „Yð9ð~ !%Ø"&ñ@ð @ñ @ñ @ð @ð @ðJ &*Ø(,Ø7;ñ#Gð #Gñ #Gñ #Gð #Gð #GñJñ ð ð ð ð ri   r�   r5  Úmodel_kwargsrâ  r  c                ó  — 	 ddl m} n# t          $ r t          d¦  «        ‚w xY w |¦   «         }|pi }|                     dd¦  «        }	  |j        | fd|i|¤ŽS # t
          $ r}t          j        d|› �¦  «        ‚d}~ww xY w)a  Convert a prompt to OpenAI format.

    Requires the `langchain_openai` package to be installed.

    Args:
        messages (Any): The messages to convert.
        model_kwargs (Optional[Dict[str, Any]]): Model configuration arguments including
            `stop` and any other required arguments.

    Returns:
        The prompt in OpenAI format.

    Raises:
        ImportError: If the `langchain_openai` package is not installed.
        ls_utils.LangSmithError: If there is an error during the conversion process.
    r   )Ú
ChatOpenAIz…The convert_prompt_to_openai_format function requires the langchain_openaipackage to run.
Install with `pip install langchain_openai`ÚstopNz#Error converting to OpenAI format: )Úlangchain_openair>	  rÀ   rç  Ú_get_request_payloadr@  r¤   rB  )r5  r<	  r>	  r$	  r?	  rM  s         re   Úconvert_prompt_to_openai_formatrB	  ?-  sÞ   € ð(
Ø/Ð/Ð/Ð/Ð/Ð/Ð/øÝð 
ð 
ð 
ÝðKñ
ô 
ð 	
ð
øøøð ˆZ‰\Œ\€FàÐ% 2€LØ×Ò˜F DÑ)Ô)€DðQØ*ˆvÔ*¨8ÐOÐO¸$ÐOÀ,ÐOÐOÐOøÝð Qð Qð QÝÔ%Ð&OÈAÐ&OÐ&OÑPÔPÐPøøøøðQøøøs    ‚	 ‰#ÁA Á
BÁ%A<Á<Bc                ór  — 	 ddl m} n# t          $ r t          d¦  «        ‚w xY w|pi }|                     dd¦  «        }|                     dd¦  «        }|                     dd¦  «        } |d|||d	œ|¤Ž}	 |                     | |¬
¦  «        S # t
          $ r}t          j        d|› �¦  «        ‚d}~ww xY w)a[  Convert a prompt to Anthropic format.

    Requires the `langchain_anthropic` package to be installed.

    Args:
        messages (Any): The messages to convert.
        model_kwargs (Optional[Dict[str, Any]]):
            Model configuration arguments including `model_name` and `stop`.

    Returns:
        The prompt in Anthropic format.
    r   )ÚChatAnthropicz�The convert_prompt_to_anthropic_format function requires the langchain_anthropic package to run.
Install with `pip install langchain_anthropic`Ú
model_namezclaude-3-haiku-20240307r?	  Nrº  )rE	  rº  r?	  )r?	  z&Error converting to Anthropic format: rh   )Úlangchain_anthropicrD	  rÀ   rç  rA	  r@  r¤   rB  )r5  r<	  rD	  rE	  r?	  rº  r%	  rM  s           re   Ú"convert_prompt_to_anthropic_formatrG	  f-  s   € ð 
Ø5Ð5Ð5Ð5Ð5Ð5Ð5øÝð 
ð 
ð 
Ýð=ñ
ô 
ð 	
ð
øøøð  Ð% 2€LØ×!Ò! ,Ð0IÑJÔJ€JØ×Ò˜F DÑ)Ô)€DØ×Ò˜y¨$Ñ/Ô/€Gà�ð Ø w°Tðð Ø=Iðð €IðTØ×-Ò-¨h¸TÐ-ÑBÔBÐBøÝð Tð Tð TÝÔ%Ð&RÈqÐ&RÐ&RÑSÔSÐSøøøøðTøøøs    ‚	 ‰#Á9B Â
B6ÂB1Â1B6c                  ó.   ‡ — e Zd ZdZdˆ fd„Zddd
„Zˆ xZS )Ú_FailedAttachmentReaderzHBytesIO that raises an error when read, for failed attachment downloads.rý  r@  c                óV   •— t          ¦   «                              ¦   «          || _        d S ry   )rá  rŽ   Ú_error)râ  rý  rã  s     €re   rŽ   z _FailedAttachmentReader.__init__‘-  s$   ø€ Ý‰Œ×ÒÑÔÐØˆŒˆˆri   r°  rx  rM  rX   rü  c                óF   — t          j        d| j        › �¦  «        | j        ‚)NzFailed to download attachment: )r¤   rB  rK	  )râ  rx  s     re   r°  z_FailedAttachmentReader.read•-  s)   € ÝÔ%Ø;¨d¬kÐ;Ð;ñ
ô 
àŒ{ð	ri   )rý  r@  )r°  )rx  rM  rX   rü  )rÆ   rÇ   rÈ   rÉ   rŽ   r°  rñ  rò  s   @re   rI	  rI	  Ž-  s\   ø€ € € € € ØRÐRðð ð ð ð ð ðð ð ð ð ð ð ð ð ri   rI	  r  rL  rë  údict[str, AttachmentInfo]c          
     ól  — i }|| v �r,| |         �r#| |                               ¦   «         D �]\  }}|                     d¦  «        sŒ|�t          ||d         ¦  «        }n|d         }	 t          j        |d¬¦  «        }|                     ¦   «          t          j        |j        ¦  «        }nF# t          $ r9}	t                               d|› d|	› �¦  «         t          |	¦  «        }Y d}	~	nd}	~	ww xY wt          d
i |d         ||                     d¦  «        d	œ¤Ž||                     d¦  «        <   �Œ	|S )zOConvert attachments from the backend database format to the user facing format.zattachment.NÚpresigned_urlT)rO  zError downloading attachment r.  rQ  )rO	  ÚreaderrQ  rh   )r‹   Ú
startswithrg  r‰   r{   r  r¤  r¥  Úcontentr@  ra   rb   rI	  rN   Úremoveprefix)
rL  rë  rk   Úattachments_dictr}   r~   r  r2  rP	  rM  s
             re   rì  rì  ›-  s|  € ð ÐØ˜$ÐÑ 4¨Ô#8ÑØ˜Ô/×5Ò5Ñ7Ô7ð 	ñ 	‰JˆC�Ø—>’> -Ñ0Ô0ð ØØÐ"Ý)¨'°5¸Ô3IÑJÔJ��à  Ô1�ð4Ý#œ<¨¸Ð>Ñ>Ô>�Ø×)Ò)Ñ+Ô+Ð+Ýœ HÔ$4Ñ5Ô5��øÝð 4ð 4ð 4Ý—’ÐI¸sÐIÐIÀaÐIÐIÑJÔJÐJÝ0°Ñ3Ô3������øøøøð4øøøõ AOð Að Aà%*¨?Ô%;Ø$Ø!&§¢¨;Ñ!7Ô!7ðð ðAð AÐ˜S×-Ò-¨mÑ<Ô<Ñ=Ñ=ð Ðs   Á)AB-Â-
C0Â7/C+Ã+C0rM  úlist[io.BufferedReader]c                óš   — | D ]G}	 |                      ¦   «          Œ# t          $ r# t                               d|j        ¦  «         Y ŒDw xY wdS )z2Close all opened files used in multipart requests.zCould not close file: %sN)r„  r@  ra   rñ   r†  )rM  r®  s     re   r  r  ¹-  sf   € àð ð ˆð	Ø�JŠJ‰LŒLˆLˆLøÝð 	ð 	ð 	Ý�LŠLÐ3°T´YÑ?Ô?Ð?ØˆDð	øøøðð s   †›*AÁArg  c                ój   — |                       d¦  «                             d¦  «        rd|› d�S d|› d�S )Nrm   rŠ  z/platform/datasets/r}  z/v1/platform/datasets/©rn   ro   )rk   rg  s     re   rl  rl  Ã-  sF   € Ø‡~‚~�cÑÔ×#Ò# EÑ*Ô*ð >Ø: ZÐ:Ð:Ð:Ð:à=¨
Ð=Ð=Ð=Ð=ri   r_  c                óf   — |                       d¦  «                             d¦  «        rd|› �S d|› �S )z=Construct a platform API path based on the API URL structure.rm   rŠ  z
/platform/z/v1/platform/rX	  )rk   r_  s     re   r  r  Ê-  s@   € à‡~‚~�cÑÔ×#Ò# EÑ*Ô*ð &Ø"˜DÐ"Ð"Ð"à%˜tÐ%Ð%Ð%ri   rF  c                ó®  — |                      d¦  «        r|S |                       d¦  «        rd}| t          d¦  «        d …         } nA|                       d¦  «        rd}| t          d¦  «        d …         } nt          d| ›�¦  «        ‚|                      d¦  «                             d¦  «        }|                     d¦  «                             d¦  «        }|st          d| ›d|›�¦  «        ‚|s| S |d         d	k    r1|d
         d	k    r|d d
…         }n|dd …         d	dgk    r
|d d…         }||z   }|d                     d„ |D ¦   «         ¦  «        z   S )Nr†   rd  rc  zBapi_url must start with 'http://' or 'https://'. Received api_url=rm   zPMust specify non-empty api_url or pathname must be a full url. Received api_url=z, pathname=r   Úapir°  rS  Úv1c              3  ó   K  — | ]}|¯|V — Œ	d S ry   rh   )r|   Úps     re   r	  z!_construct_url.<locals>.<genexpr>ñ-  s'   è è € Ð1Ð1 ¨qÐ1˜1Ð1Ð1Ð1Ð1Ð1Ð1ri   )rQ	  rp   rï   rn   r`  Úlstripr¨   )rk   rF  r†   Ú	api_partsrd  rz  s         re   rg  rg  Ò-  s©  € Ø×Ò˜6Ñ"Ô"ð ØˆØ×Ò˜*Ñ%Ô%ð 	
ØˆØ�#˜j™/œ/Ð+Ð+Ô,ˆˆØ	×	Ò	˜IÑ	&Ô	&ð 
ØˆØ�#˜i™.œ.Ð*Ð*Ô+ˆˆåØSÈÐSÐSñ
ô 
ð 	
ð —’˜sÑ#Ô#×)Ò)¨#Ñ.Ô.€IØ—’ Ñ%Ô%×+Ò+¨CÑ0Ô0€Jàð 
Ýð0Øð0ð 0Ø$,ð0ð 0ñ
ô 
ð 	
ð ð Øˆà�!„}˜ÒÐØ�RŒ=˜EÒ!Ð!Ø! # 2 #œˆIˆIØ�r�s�sŒ^  t˜}Ò,Ð,Ø! # 2 #œˆIØ˜
Ñ"€EØ�#—(’(Ð1Ð1 eÐ1Ñ1Ô1Ñ1Ô1Ñ1Ð1ri   rÀ  rÁ  c               ó¸   — t          | d¦  «        r|                      |¬¦  «        S t          | d¦  «        r|                      |¬¦  «        S t          d¦  «        ‚)z)Dump model depending on pydantic version.r½  rÀ  r  zUnsupported model type)r‡  r½  r  rð   )rñ  rÁ  s     re   rÂ  rÂ  ô-  s`   € åˆu�lÑ#Ô#ð 2Ø×Ò¨\ÐÑ:Ô:Ð:Ý	�˜Ñ	Ô	ð 2Ø�zŠz |ˆzÑ4Ô4Ð4åÐ0Ñ1Ô1Ð1ri   Úobjc                ó�  ‡— 	 ddl m} ddlm} ddlm}m} n# t          $ r t          d¦  «        ‚w xY w| }t          | |¦  «        rÿt          | j	        |¦  «        rêt          | j
        d         |¦  «        rÏdt          | j
        ¦  «        cxk    rdk    r°n n­| j	        }| j
        d         }|j        }|j        }	t          ||¦  «        s%d	|j        v r|j        d	         }
 |dd
|j        i|
¤Ž}t          ||¦  «        rF||z  j
        d         j        Šˆfd„|	                     ¦   «         D ¦   «         |_         |||¦  «        }|S )z/Format the object so its Prompt Hub compatible.r   )ÚChatPromptTemplater(  r*  r:  r[   r6  r“   Úls_structured_output_formatr5  c                ó$   •— i | ]\  }}|‰v¯	||“ŒS rh   rh   )r|   rÕ  rÖ  Ústructured_kwargss      €re   r€   z%prep_obj_for_push.<locals>.<dictcomp>%.  s1   ø€ ð "ð "ð "Ù˜˜A¸ÐBSÐ9SÐ9S��1Ð9SÐ9SÐ9Sri   rh   )r:  rd	  r;  r)  Úlangchain_core.runnablesr+  r,  rÀ   r  rA  rG  rp   rI  r�   r5  r‹   )rb	  rd	  r)  r+  r,  Úchain_to_pushrL  Úbound_modelrñ  r<	  Úoutput_formatrg	  s              @re   r>  r>  þ-  sß  ø€ ð
Ø=Ð=Ð=Ð=Ð=Ð=ØFÐFÐFÐFÐFÐFØNÐNÐNÐNÐNÐNÐNÐNÐNøÝð 
ð 
ð 
ÝðIñ
ô 
ð 	
ð
øøøð €Må�3Ð(Ñ)Ô)ðBå�s”yÐ"4Ñ5Ô5ðBõ �s”y ”| _Ñ5Ô5ðBð •�S”Y‘”Ð$Ð$Ò$Ð$ 1Ò$Ð$Ð$Ð$Ð$à”ˆØ”i ”lˆØÔ!ˆØ"Ô)ˆõ
 ˜6Ð#3Ñ4Ô4ð	Qà-°Ô1CÐCÐCà'Ô.Ð/LÔMˆMØ%Ð%ÐPÐP¨v¬ÐPÀ-ÐPÐPˆFõ �fÐ.Ñ/Ô/ð 		BØ!'¨%¡Ô 6°qÔ 9Ô @Ðð"ð "ð "ð "Ø!-×!3Ò!3Ñ!5Ô!5ð"ñ "ô "ˆKÔð -Ð,¨V°[ÑAÔAˆMØÐs   ƒ ˜2r�   úMapping[str, str]rø  r»  rù  rú  r  c               óÌ   — i | ¥} t          |||g¦  «        }|rt          | d ¦  «        } |�|| t          <   n|st          | |¦  «        } |�|| d<   |�|| d<   |�|| d<   |�|| d<   | S )NzX-Service-Keyr  r  ÚCookie)r  Ú_apply_optional_api_keyrv  )r�   r’  rø  r»  rù  rú  r  Úhas_non_api_keys           re   r  r  /.  s©   € ð �ˆk€GÝ˜;¨°vÐ>Ñ?Ô?€OØð 9Ý)¨'°4Ñ8Ô8ˆØÐØ$ˆ•	ÑÐØð EÝ)¨'Ð3CÑDÔDˆØÐØ#.ˆ�Ñ ØÐØ!*ˆ�ÑØÐ Ø#0ˆ�Ñ ØÐØ"ˆ�ÑØ€Nri   c                ó°   — |r|| t           <   nH|                      t           d ¦  «         |                      t                                ¦   «         d ¦  «         | S ry   )rv  rç  Úupper)r�   r’  s     re   ro	  ro	  L.  sP   € ð ð -Ø$ˆ•	ÑÐà�Š•I˜tÑ$Ô$Ð$Ø�Š•I—O’OÑ%Ô% tÑ,Ô,Ð,Ø€Nri   )rV   rW   rX   rY   r1	  )rk   rW   rX   rW   )rs   rt   rX   ru   )r™   rš   r˜   r›   rX   rœ   r2	  )
rû   rü   rø   rý   rù   rý   rú   rý   rX   ré   )r  rW   r  ré   rX   rY   )
r  r   r  r  r   r!  r"  ré   rX   r   )r6  rR  )
rS  rT  rk   rW   rU  rý   rV  rW   rX   rW  )rg  rW   rX   ré   )rX   r!   )rs   rt   rX   rY   )r†  rW   rX   r‡  )rk   rW   r’  r‡  r™   rœ   rX   rY   )r—  r˜  )rž  rŸ  rX   rY   ry   )r¦  r§  rX   r¨  )r®  r¯  rX   r°  )r~   r¸  rY  r‡  rX   r¹  )r»  r¼  r½  rý   rX   r°  )r~   rÇ  rX   r¹  )r~   rÇ  rË  ré   rX   rÌ  )r~   rÇ  rË  ré   )rú  r   rX   ré   )rþ  rÿ  r   ré   rX   rY   )r5  r   r<	  râ  rX   r  )rL  r  rë  rW   rk   r‡  rX   rM	  )rM  rU	  rX   rY   )rk   rW   rg  r¸  rX   rW   )rk   rW   r_  rW   rX   rW   )rk   rW   rF  rW   rX   rW   )rÁ  ré   rX   ru   )rb	  r   rX   r   )r�   rl	  r’  r‡  rø  r‡  r»  r‡  rù  r‡  rú  r‡  r  r‡  rX   r°  )r�   r°  r’  r‡  rX   r°  (  rÉ   Ú
__future__r   r€  rí  rJ  rC  rÃ  r¿  r>  r£  rÃ  r  r}  Úimportlib.metadatar¤  r  rù  ÚloggingrŒ  rj  r‚  r^   rq  Útypingr[  rª   r}  Úcollections.abcr   r   r   r   r   r	   r
   Úinspectr   Úpathlibr   rÊ  r   r   r   r   r   r   r   r   r   r   r   r   Úurllibr   r]  ÚhttpxrŒ   Úpackaging.versionrí   r‰   Úpydanticr   r   rí  Úrequests_toolbeltr   r•  Útyping_extensionsr   r   r   Úurllib3.poolmanagerr    Úurllib3.utilr!   rR   r"   r×  r#   r{  r$   r¤   Úlangsmith._internalr%   r¡  r&   r'   r(   Ú$langsmith._internal._backend_versionr)   r=  r*   r+   rŒ  Ú#langsmith._internal._beta_decoratorr7	  r,   rÚ  r-   Ú&langsmith._internal._compressed_tracesr.   Úlangsmith._internal._constantsr/   r0   r1   r2   r3   Úlangsmith._internal._hubr4   r5   r6   r7   r8   Úlangsmith._internal._multipartr9   r:   r;   Úlangsmith._internal._operationsr<   r=   r>   r?   r@   rA   rB   rC   Úlangsmith._internal._serderD   r—  Úlangsmith._internal._uuidrE   Ú'langsmith._internal._v2_migration_utilsrF   rG   Úlangsmith._openapi_clientrH   r¶  rI   rÀ  Ú&langsmith._openapi_client._base_clientrJ   r½  rK   rÂ  Úlangsmith.prompt_cacherL   rM   Úlangsmith.schemasrN   rO   Ú	getLoggerrÆ   ra   r`   r]   r_   rƒ  r\   rœ   Ú	frozensetrU   rù  rf   rj   rr   r’   r›  r&	  r'	  r´   rÂ   ÚzoneinforÃ   rÀ   Úopentelemetry.sdk.tracerÊ   rÏ  rÖ  rh	  rÌ   ÚGlangsmith._openapi_client.resources.annotation_queues.annotation_queuesrÍ   Ú5langsmith._openapi_client.resources.datasets.datasetsrÎ   Ú5langsmith._openapi_client.resources.online_evaluatorsrÏ   rÈ  Ú1langsmith._openapi_client.resources.public.publicrÐ   Ú(langsmith._openapi_client.resources.runsrÑ   Ú7langsmith._openapi_client.resources.sandboxes.sandboxesrÒ   Ú+langsmith._openapi_client.resources.threadsrÓ   Ú*langsmith._openapi_client.resources.tracesrÔ   Ú#langsmith._openapi_client.types.runrÕ   ÚV2Runr¼   r·   rÁ   r¿   r»   r-  r×   r'  rÓ  rØ   rÙ   rÚ   rË  rÛ   rÜ   rÝ   rÞ   rß   rà   rá   râ   re  rv  rä   r  rè  r�   rå  r;	  r  ræ   rõ   r  r  rQ  rf  rk  r\  rW   r¸  rö  r‚  r…  r�  r–  r�  r¥  r­  r·  ra  rÆ  rÉ  rÒ  ÚHTTPAdapterrÔ  rô  rý  r  r�   rB	  rG	  r¥  rI	  rì  r  rl  r  rg  rÂ  r>  r  ro	  rh   ri   re   ú<module>r 	     sÈ  ðð
ð 
ð 
ð #Ð "Ð "Ð "Ð "Ð "à €€€Ø €€€Ø Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ø Ð Ð Ð Ø €€€Ø Ð Ð Ð Ø Ð Ð Ð Ø Ð Ð Ð Ø 	€	€	€	Ø Ð Ð Ð Ø €€€Ø €€€Ø 	€	€	€	Ø €€€Ø Ð Ð Ð Ø €€€Ø Ð Ð Ð Ø €€€Ø €€€Ø €€€Ø €€€Ø PÐ PÐ PÐ PÐ PÐ PÐ PÐ PÐ PÐ PÐ PÐ PÐ PÐ PØ (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø %Ð %Ð %Ð %Ð %Ð %Ð %Ð %ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð )Ð (Ð (Ð (Ð (Ð (à Ð Ð Ð Ø Ð Ð Ð Ø €€€Ø Ð Ð Ð Ð Ð Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2ðð ð ð ð ð ð >Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø Ð Ð Ð Ð Ð à Ð Ð Ð Ø #Ð #Ð #Ð #Ð #Ð #Ø +Ð +Ð +Ð +Ð +Ð +Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GØ GÐ GÐ GÐ GÐ GÐ Gðð ð ð ð ð ðð ð ð ð ð ð JÐ IÐ IÐ IÐ IÐ Iðð ð ð ð ð ð :Ð 9Ð 9Ð 9Ð 9Ð 9Ø CÐ CÐ CÐ CÐ CÐ Cðð ð ð ð ð ð ð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð ð
	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð AÐ @Ð @Ð @Ð @Ð @Ø +Ð +Ð +Ð +Ð +Ð +Ø SÐ SÐ SÐ SÐ SÐ SÐ SÐ SØ NÐ NÐ NÐ NÐ NÐ NØ MÐ MÐ MÐ MÐ MÐ Mðð ð ð ð ð ðð ð ð ð ð ð GÐ FÐ FÐ FÐ FÐ FÐ FÐ FØ =Ð =Ð =Ð =Ð =Ð =Ð =Ð =à	ˆÔ	˜8Ñ	$Ô	$€à!Ð ØÐ Ø"Ð Ø$�i”nÑ&Ô&Ð ØÐ3Ô4€Ø'0 y°°¸+Ñ1FÔ1FÑ'GÔ'GÐ Ð GÐ GÐ GÑ Gðð ð ð ð$+ð +ð +ð +ðð ð ð ð0ð 0ð 0ð 0ðf  Ð à"€Ø(Ð ð $(ðBð Bð Bð Bð Bð BðJ
ð 
ð 
ð$(Ø!Ð!Ð!Ð!Ð!Ð!Ð!øØð (ð (ð (ð(ð (ð (ð (ð (ñ (ô (ð (ð (ð (ð(øøøð.Ø6Ð6Ð6Ð6Ð6Ð6Ð6øØð .ð .ð .ð.ð .ð .ð .ð .ñ .ô .ð .ð .ð .ð.øøøð ð 0ØÐÐÐØ1Ð1Ð1Ð1Ð1Ð1à!Ð!Ð!Ð!Ð!Ð!ðð ð ð ð ð ðð ð ð ð ð ðð ð ð ð ð ðð ð ð ð ð ð KÐJÐJÐJÐJÐJðð ð ð ð ð ð QÐPÐPÐPÐPÐPØNÐNÐNÐNÐNÐNØ@Ð@Ð@Ð@Ð@Ð@ðØ5Ð5Ð5Ð5Ð5Ð5àHÐHÐHÐHÐHÐHÐHøØð ð ð Øˆ
Øˆˆˆðøøøð ?Ð>Ð>Ð>Ð>Ð>ðð ð ð ð ð ð ð ð ð ð
	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 
ˆÔ	˜8Ñ	$Ô	$€Ø#�'Ô#Ð$<Ñ=Ô=€à€	Ø €	Ð  Ð  Ð  Ñ  Ø	ˆ‰Œ€Ø,°	°	¸'Ñ0BÔ0BÔ0MÐMÐ ØSÐ à#& 3¡5¤5Ð Ð (Ð (Ð (Ñ (ð €�1ÐÑÔð%ð %ð %ñ Ôð%ð4 ,-¸rÐTVð!ð !ð !ð !ð !ð !ðH

ð 

ð 

ð 

ðFð Fð Fð FðX Øð	ð ð ð ð ð:ð ð ð ð  �”	˜3�Ô
€ØØHô€
ð
 €Ô˜QÐÑÔð3ð 3ð 3ñ  Ôð3ð>ð ð ð ðð ð ð ð !,ð	ð ð ð ð ð ð:ð ð ð ðð ð ð ð( .2ðð ð ð ð ð.$ð $ð $ð $ð ð ð ð ð ðð ð ð ð2 „Ø JÐ JÐ Jñ „Ø Jð „àCGðð ð ð ð ñ „ðð
 QVð ð ð ð ð ð ð €Ô˜QÐÑÔðð ñ  Ôðð%ð %ð %ð %ð %Ð-Ô9ñ %ô %ð %ðP"ð "ð "ð "ð "�iñ "ô "ñ "ðð ð ñ ð ð ð ñ ð(|eð |eð |eð |eð |eñ |eô |eñ |eðBL .2ð$Qð $Qð $Qð $Qñ $QðR .2ð%Tð %Tð %Tð %Tñ %TðP
ð 
ð 
ð 
ð 
˜b�jñ 
ô 
ñ 
ð CGðð ñ ð ð ñ ñ<ð ð ñ ñ>ð >ð >ñ >ñ&ð &ð &ñ &ñ2ð 2ð 2ñ 2ðD /4ð 2ð 2ñ 2ð 2ð 2ñ 2ñ.ð .ð .ñ .ñbð ð ñ ñ:ð ð ñ ð ð s6   ÈH ÈH-È,H-È1H8 È8IÉIÊJ& Ê&	J2Ê1J2