
    6|h                    L   d Z ddlmZ ddlmZmZmZ ddlmZ ddlm	Z	 ddl
mZmZmZmZmZmZmZmZ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mZ dd
l"m#Z# ddlm$Z$ eeeedf   Z%eee&df   Z' G d de      Z(ee&eee&e)f   e(ee&e#f   f   f   Z*	 e G d de             Z+ G d de      Z, G d de,      Z- G d de      Z. G d de.      Z/ G d de      Z0 G d de,      Z1 G d de,      Z2 G d d e      Z3 G d! d"e      Z4 G d# d$e4      Z5 G d% d&e&e	      Z6 G d' d(e      Z7e$d)   Z8 G d* d+ed,-      Z9 G d. d/e7      Z: G d0 d1e      Z;d2 Z< G d3 d4e      Z= G d5 d6e=      Z> G d7 d8e&e	      Z? G d9 d:ed,-      Z@ G d; d<e=      ZA G d= d>e      ZB G d? d@eB      ZC G dA dBeB      ZD G dC dDe	      ZE G dE dFe      ZF G dG dHed,-      ZG G dI dJed,-      ZH G dK dLeF      ZI G dM dNeF      ZJ G dO dPe      ZK G dQ dReK      ZLe G dS dTe             ZM G dU dVed,-      ZN G dW dXe      ZO G dY dZed,-      ZP G d[ d\e      ZQe1j                           G d] d^e      ZS G d_ d`e      ZT G da dbed,-      ZU G dc dded,-      ZV G de dfe      ZW G dg dhe      ZX G di dje      ZY G dk dle      ZZ G dm dne      Z[ G do dpe      Z\ G dq dre&e	      Z] G ds dted,-      Z^ G du dved,-      Z_ G dw dxe      Z` G dy dze      Zay# e $ r dd	l!mZmZmZmZmZmZ Y w xY w){zSchemas for the LangSmith API.    )annotations)datetime	timedeltatimezone)Decimal)Enum)	AnyDictList
NamedTupleOptionalProtocolTupleUnionruntime_checkable)UUID)NotRequired	TypedDict)	BaseModelFieldPrivateAttr
StrictBoolStrictFloat	StrictInt)Path)LiteralNc                  &    e Zd ZU dZded<   ded<   y)
AttachmentaB  Annotated type that will be stored as an attachment if used.

    Examples:
        --------
        .. code-block:: python

        @traceable
        def my_function(bar: int, my_val: Attachment):
            # my_val will be stored as an attachment
            # bar will be stored as inputs
            return bar
    str	mime_typezUnion[bytes, Path]dataN__name__
__module____qualname____doc____annotations__     P/var/www/html/test/engine/venv/lib/python3.12/site-packages/langsmith/schemas.pyr   r   2   s     N
r)   r   c                  ,    e Zd ZdZdddZdd	dZd
dZy)BinaryIOLikez$Protocol for binary IO-like objects.c                     y)zRead function.Nr(   )selfsizes     r*   readzBinaryIOLike.readM       r)   c                     y)zSeek function.Nr(   )r.   offsetwhences      r*   seekzBinaryIOLike.seekQ   r1   r)   c                     y)zGet value function.Nr(   r.   s    r*   getvaluezBinaryIOLike.getvalueU   r1   r)   N))r/   intreturnbytes)r   )r3   r:   r4   r:   r;   r:   )r;   r<   )r#   r$   r%   r&   r0   r5   r8   r(   r)   r*   r,   r,   I   s    .r)   r,   c                      e Zd ZU dZded<    ee      Zded<    ed      Zd	ed
<    ed      Z	d	ed<    G d d      Z
y)ExampleBasezExample base model.r   
dataset_iddefault_factoryDict[str, Any]inputsNdefaultOptional[Dict[str, Any]]outputsmetadatac                      e Zd ZdZdZdZy)ExampleBase.Config#Configuration class for the schema.TN)r#   r$   r%   r&   frozenarbitrary_types_allowedr(   r)   r*   ConfigrJ   b   s    1"&r)   rN   )r#   r$   r%   r&   r'   r   dictrC   rG   rH   rN   r(   r)   r*   r>   r>   Z   sD    "48FN8(-d(;G%;).t)<H&<' 'r)   r>   c                  H    e Zd ZU dZded<    ed       Zded<   dZd	ed
<   y)ExampleCreatezExample create model.Optional[UUID]idc                 H    t        j                  t        j                        S Nr   nowr   utcr(   r)   r*   <lambda>zExampleCreate.<lambda>m       hll9S r)   r@   r   
created_atNOptional[Union[str, List[str]]]split)r#   r$   r%   r&   r'   r   r[   r]   r(   r)   r*   rQ   rQ   i   s&     1STJT-1E*1r)   rQ   c                      e Zd ZU dZded<    ed       Zded<    ee      Zded	<    ed
      Z	ded<    ed
      Z
ded<   d
Zded<   d
Zded<   y
)ExampleUploadWithAttachmentsz Example upload with attachments.rR   rS   c                 H    t        j                  t        j                        S rU   rV   r(   r)   r*   rY   z%ExampleUploadWithAttachments.<lambda>u   rZ   r)   r@   r   r[   rB   rC   NrD   rF   rG   rH   r\   r]   Optional[Attachments]attachments)r#   r$   r%   r&   r'   r   r[   rO   rC   rG   rH   r]   rb   r(   r)   r*   r_   r_   q   s`    * 1STJT"48FN8(-d(;G%;).t)<H&<-1E*1)-K&-r)   r_   c                      e Zd ZU dZded<   y)ExampleUpsertWithAttachmentsz Example create with attachments.r   r?   Nr"   r(   r)   r*   rd   rd   }   s    *r)   rd   c                  0    e Zd ZU dZded<   ded<   ded<   y)	AttachmentInfozInfo for an attachment.r   presigned_urlr,   readerOptional[str]r    Nr"   r(   r)   r*   rf   rf      s    !r)   rf   c                  >    e Zd ZU dZded<    ed       Zded<    e ed      	      Zded
<    ed	      Z	ded<    ee
      Zded<   dZded<    ed	      Zded<   	  ed	      Zded<    ed	      Zded<   	 	 d	 	 	 	 	 	 	 d fdZedd       Zd Z xZS )ExamplezExample model.r   rS   c                 L    t        j                  dt        j                        S )Nr   )tz)r   fromtimestampr   rX   r(   r)   r*   rY   zExample.<lambda>   s     6 6qX\\ J r)   r@   r   r[   z$00000000-0000-0000-0000-000000000000rD   r?   NOptional[datetime]modified_atz	List[Run]runsrR   source_run_idz#Optional[Dict[str, AttachmentInfo]]rb   ri   	_host_url
_tenant_idc                @    t        |   di | || _        || _        y)Initialize a Dataset object.Nr(   )super__init__rs   rt   )r.   rs   rt   kwargs	__class__s       r*   rx   zExample.__init__   s#     	"6""$r)   c                    | j                   r^d| j                   d| j                   }| j                  r&| j                    dt	        | j                         | S | j                    | S y)URL of this run within the app.
/datasets/z/e//o/N)rs   r?   rS   rt   r   )r.   paths     r*   urlzExample.url   sh     >>0DGG9=D..)S-A,B4&IInn%dV,,r)   c                n    | j                    d| j                   d| j                   d| j                   dS )5Return a string representation of the RunBase object.(id=z, dataset_id=z, link=''))rz   rS   r?   r   r7   s    r*   __repr__zExample.__repr__   s8    ..!dggYmDOO;LHUYU]U]T^^`aar)   )NN)rs   ri   rt   rR   ry   r	   r;   Noner;   ri   )r#   r$   r%   r&   r'   r   r[   r   r?   rp   listrq   rr   rb   r   rs   rt   rx   propertyr   r   __classcell__rz   s   @r*   rk   rk      s    H JJ  T*P%QRJR&+D&9K#9D1D)1$(M>(7<T7JK4J.*48I}8!,T!:J: $(%)	% 	% #	% 		%
 
	%  br)   rk   c                      e Zd ZU dZded<   y)ExampleSearchzExample returned via search.r   rS   Nr"   r(   r)   r*   r   r      s
    &Hr)   r   c                  N    e Zd ZU dZ eed      Zded<    eed      Z	ded<   y	)
AttachmentsOperationsz%Operations to perform on attachments.z,Mapping of old attachment names to new names)rA   descriptionzDict[str, str]renamez List of attachment names to keep	List[str]retainN)
r#   r$   r%   r&   r   rO   r   r'   r   r   r(   r)   r*   r   r      s5    /"*XFN  *LFI r)   r   c                  z    e Zd ZU dZdZded<   dZded<   dZded<   dZded	<   dZ	ded
<   dZ
ded<    G d d      Zy)ExampleUpdatezUpdate class for Example.NrR   r?   rF   rC   rG   Optional[AttachmentsOperations]attachments_operationsrH   r\   r]   c                      e Zd ZdZdZy)ExampleUpdate.ConfigrK   TNr#   r$   r%   r&   rL   r(   r)   r*   rN   r      
    1r)   rN   )r#   r$   r%   r&   r?   r'   rC   rG   r   rH   r]   rN   r(   r)   r*   r   r      sQ    #!%J%'+F$+(,G%,>B;B)-H&--1E*1 r)   r   c                      e Zd ZU dZded<    ee      Zded<    ed      Zd	ed
<    ed      Z	d	ed<   dZ
ded<   dZded<   dZded<   y)ExampleUpdateWithAttachmentsz Example update with attachments.r   rS   r@   rB   rC   NrD   rF   rG   rH   r\   r]   ra   rb   r   r   )r#   r$   r%   r&   r'   r   rO   rC   rG   rH   r]   rb   r   r(   r)   r*   r   r      s[    *H"48FN8(-d(;G%;).t)<H&<-1E*1)-K&->B;Br)   r   c                      e Zd ZdZdZdZdZy)DataTypezEnum for dataset data types.kvllmchatN)r#   r$   r%   r&   r   r   r   r(   r)   r*   r   r      s    &	B
CDr)   r   c                  L    e Zd ZU dZded<   dZded<   dZded<    G d	 d
      Zy)DatasetBasezDataset base model.r   nameNri   r   zOptional[DataType]	data_typec                      e Zd ZdZdZy)DatasetBase.ConfigrK   TNr   r(   r)   r*   rN   r      r   r)   rN   )r#   r$   r%   r&   r'   r   r   rN   r(   r)   r*   r   r      s)    
I!%K%$(I!( r)   r   )remove_system_messagesconvert_to_openai_messageconvert_to_openai_toolremove_extra_fieldsextract_tools_from_runc                  &    e Zd ZU dZded<   ded<   y)DatasetTransformationz#Schema for dataset transformations.r   r   z%Union[DatasetTransformationType, str]transformation_typeNr"   r(   r)   r*   r   r     s    -
O>>r)   r   F)totalc                  *    e Zd ZU dZded<   ded<    ed      Zded	<   dZd
ed<   dZd
ed<   dZ	ded<   dZ
ded<   dZded<   dZded<    ed      Zded<    ed      Zded<    ed      Zded<   	 	 	 d	 	 	 	 	 	 	 	 	 d fdZedd       Z xZS )DatasetzDataset ORM model.r   rS   r   r[   NrD   ro   rp   Optional[int]example_countsession_countlast_session_start_timerF   inputs_schemaoutputs_schemaz%Optional[List[DatasetTransformation]]transformationsri   rs   rR   rt   _public_pathc                    d|v r|j                  d      |d<   d|v r|j                  d      |d<   t        |   di | || _        || _        || _        y)rv   inputs_schema_definitionr   outputs_schema_definitionr   Nr(   )poprw   rx   rs   rt   r   )r.   rs   rt   r   ry   rz   s        r*   rx   zDataset.__init__  sd     &/&,jj1K&LF?#&&0'-zz2M'NF#$"6""$(r)   c                   | j                   r~| j                  r| j                    | j                   S | j                  r1| j                    dt        | j                         d| j                   S | j                    d| j                   S y)r|   r~   r}   N)rs   r   rt   r   rS   r7   s    r*   r   zDataset.url+  s}     >>  ..)$*;*;)<==..)S-A,B*TWWIVVnn%Zy99r)   )NNN)
rs   ri   rt   rR   r   ri   ry   r	   r;   r   r   )r#   r$   r%   r&   r'   r   rp   r   r   r   r   r   r   r   rs   rt   r   rx   r   r   r   r   s   @r*   r   r     s    H&+D&9K#9#'M='#'M='26/6.2M+2/3N,3=AO:A*48I}8!,T!:J:"-d";L-; $(%)&*	) ) #) $	)
 ) 
)&  r)   r   c                  *    e Zd ZU dZdZded<   ded<   y)DatasetVersionz%Class representing a dataset version.NOptional[List[str]]tagsr   as_of)r#   r$   r%   r&   r   r'   r(   r)   r*   r   r   7  s    / $D
$Or)   r   c                 
    di iS )NrH   r(   r(   r)   r*   _default_extrar   >  s    r)   c                  Z   e Zd ZU dZded<   	 ded<   	 ded<   	 ded<   	 d	Zd
ed<   	  ee      Zded<   	 d	Z	ded<   	 d	Z
ded<   	 d	Zded<   	  ee      Zded<   	 d	Zded<   	 d	Zded<   	 d	Zded<   	 d	Zded<   	  ee      Zded<   	 ed#d       Zed$d       Zd  Z G d! d"      Zy	)%RunBasea3  Base Run schema.

    A Run is a span representing a single unit of work or operation within your LLM app.
    This could be a single call to an LLM or chain, to a prompt formatting call,
    to a runnable lambda invocation. If you are familiar with OpenTelemetry,
    you can think of a run as a span.
    r   rS   r   r   r   
start_timerun_typeNro   end_timer@   Optional[dict]extrari   error
serializedzOptional[List[Dict]]eventsrO   rC   rG   rR   reference_example_idparent_run_idr   r   z-Union[Attachments, Dict[str, AttachmentInfo]]rb   c                `    | j                   i | _         | j                   j                  di       S zRetrieve the metadata (if any).rH   )r   
setdefaultr7   s    r*   rH   zRunBase.metadata}  s,     ::DJzz$$Z44r)   c                8    | j                   j                  d      S )z"Retrieve the revision ID (if any).revision_id)rH   getr7   s    r*   r   zRunBase.revision_id  s     }}  //r)   c                n    | j                    d| j                   d| j                   d| j                   dS )r   r   z, name='z', run_type='r   )rz   rS   r   r   r7   s    r*   r   zRunBase.__repr__  s3    ..!dggYhtyykt}}o]_``r)   c                      e Zd ZdZdZy)RunBase.ConfigrK   TN)r#   r$   r%   r&   rM   r(   r)   r*   rN   r     s    1"&r)   rN   r;   zdict[str, Any])r;   rR   )r#   r$   r%   r&   r'   r   r   r   r   r   r   r   rO   rC   rG   r   r   r   rb   r   rH   r   r   rN   r(   r)   r*   r   r   B  s    	H(
I* M" $(H '-!.AE>A=E=;!%J%F#'F ' .FD.""G^"/+/./@$(M>(@ $D
$6AFBK> 4 5 5 0 0a' 'r)   r   c                      e Zd ZU dZdZded<   	 dZded<   	 dZded<   	 dZd	ed
<   	 dZ	ded<   	 dZ
ded<   	 dZded<   	 dZded<   	 dZded<   	 dZded<   	 dZded<   	 dZded<   	 dZded<   	 dZded<   	 dZded<   	 ded<   	  ed      Zded<   	 dZd ed!<   	  ed      Zded"<   d%d& fd#Zed'd$       Z xZS )(Runz$Run schema when loading from the DB.NrR   
session_idOptional[List[UUID]]child_run_idszOptional[List[Run]]
child_runsrF   feedback_statsri   app_pathmanifest_idstatusr   prompt_tokenscompletion_tokenstotal_tokensro   first_token_timeOptional[Decimal]
total_costprompt_costcompletion_costparent_run_idsr   trace_id rD   r   dotted_orderOptional[bool]
in_datasetrs   c                \   |j                  d      sd|j                  d      i|}|j                  dd      xs i }t        |   di |d|i || _        | j
                  j                         s;| j                  s.| j                  j                          | j                   | _        yyy)Initialize a Run object.r   rS   rC   Nr(   )r   r   rw   rx   rs   r   stripr   r   	isoformatrS   )r.   rs   ry   rC   rz   s       r*   rx   zRun.__init__  s    zz*% &**T"2=f=FHd+1r161&1"  &&(1C1C#'??#<#<#>"?y ID 2D(r)   c                h    | j                   r&| j                  r| j                    | j                   S y)r|   N)rs   r   r7   s    r*   r   zRun.url  s,     >>dmmnn%dmm_55r)   rU   rs   ri   ry   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   rs   rx   r   r   r   r   s   @r*   r   r     s*   .!%J%-*.M'.(&*J#*M/3N,3&"Hm"7"&K&: FM .#'M='/'+}+/"&L-&1+/(/-$(J!(M%)K")G)-O&-C+/N(/!NCb)L#)
 "&J%+*48I}8J  r)   r   c                  ,    e Zd ZdZdZdZdZdZdZdZ	dZ
y	)
RunTypeEnumz5(Deprecated) Enum for run types. Use string directly.toolchainr   	retriever	embeddingpromptparserN)r#   r$   r%   r&   r   r   r   r   r  r  r  r(   r)   r*   r   r     s(    ?DE
CIIFFr)   r   c                     e Zd ZU 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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ed"<   d#ed$<   y%)&RunLikeDictz&Run-like dictionary, for type-hinting.r   r   r   r   r   r   r   rC   rG   ro   r   r   ri   r   r   rR   r   r   Optional[List[dict]]r   r   r   inputs_s3_urlsoutputs_s3_urlsrS   r   session_namer   input_attachmentsoutput_attachmentsr   r   r   Attachmentsrb   Nr"   r(   r)   r*   r  r    s    0
I  !!  
""##((%%&&Nr)   r  c                  0    e Zd ZU dZdZded<   	 dZded<   y)RunWithAnnotationQueueInfoz&Run schema with annotation queue info.Nro   last_reviewed_timeadded_at)r#   r$   r%   r&   r  r'   r  r(   r)   r*   r  r    s"    0-1*1.#'H '3r)   r  c                  Z    e Zd ZU dZded<   	  ee      Zded<   	 dZded	<   	 dZ	d
ed<   y)FeedbackSourceBasezBase class for feedback sources.

    This represents whether feedback is submitted from the API, model, human labeler,
        etc.
    r   typer@   rF   rH   NzOptional[Union[UUID, str]]user_idri   	user_name)
r#   r$   r%   r&   r'   r   rO   rH   r  r  r(   r)   r*   r  r    s?     I*).t)DH&D6*.G'.:#I}#<r)   r  c                       e Zd ZU dZdZded<   y)APIFeedbackSourcezAPI feedback source.apizLiteral['api']r  Nr#   r$   r%   r&   r  r'   r(   r)   r*   r  r    s     D. r)   r  c                       e Zd ZU dZdZded<   y)ModelFeedbackSourcezModel feedback source.modelzLiteral['model']r  Nr  r(   r)   r*   r  r  #  s     $D
$r)   r  c                      e Zd ZdZdZ	 dZy)FeedbackSourceTypezFeedback source type.r  r  N)r#   r$   r%   r&   APIMODELr(   r)   r*   r  r  )  s    
C2E"r)   r  c                     e Zd ZU dZded<   	 dZded<   	 dZded<   	 ded	<   	 ded
<   	 ded<   	 dZded<   	 dZded<   	 dZ	ded<   	 dZ
ded<   	 dZded<   	 dZded<   	 dZded<   	 dZded<   	 dZded<   	  G d d      Zy)FeedbackBasezFeedback schema.r   rS   Nro   r[   rp   rR   run_idr   r   key
SCORE_TYPEscore
VALUE_TYPEvalueri   commentzUnion[str, dict, None]
correctionOptional[FeedbackSourceBase]feedback_sourcer   comparative_experiment_idfeedback_group_idzOptional[Dict]r   c                      e Zd ZdZdZy)FeedbackBase.ConfigrK   TNr   r(   r)   r*   rN   r0  V  r   r)   rN   )r#   r$   r%   r&   r'   r[   rp   r&  r(  r)  r*  r,  r   r-  r.  r   rN   r(   r)   r*   r"  r"  2  s    H(%)J"),&*K#*2<>	HAE:+E:Q!G]!2)-J&-!48O18%!%J%T04~4X(,~,1 !E> ' r)   r"  c                  (    e Zd ZU dZded<   	 ded<   y)FeedbackCategoryz+Specific value and label pair for feedback.floatr(  ri   labelNr"   r(   r)   r*   r2  r2  \  s    5LCNr)   r2  c                  @    e Zd ZU dZded<   	 ded<   	 ded<   	 ded<   y	)
FeedbackConfigz:Represents _how_ a feedback value ought to be interpreted.z0Literal['continuous', 'categorical', 'freeform']r  Optional[float]minmaxz Optional[List[FeedbackCategory]]
categoriesNr"   r(   r)   r*   r6  r6  e  s,    D
::	4	400@r)   r6  c                  ,    e Zd ZU dZded<   	 dZded<   y)FeedbackCreatez"Schema used for creating feedback.r  r,  NzOptional[FeedbackConfig]feedback_config)r#   r$   r%   r&   r'   r=  r(   r)   r*   r<  r<  s  s    ,''%04O-4r)   r<  c                  B    e Zd ZU dZded<   ded<   	 ded<   	 dZded	<   y)
FeedbackzSchema for getting feedback.r   rS   r   r[   rp   Nr+  r,  )r#   r$   r%   r&   r'   r,  r(   r)   r*   r?  r?  {  s*    &H,248O182r)   r?  c                       e Zd ZU dZded<   	  ed       Zded<   	 dZd	ed
<   	 dZded<   	 dZ	ded<   	 dZ
ded<   	 ded<   	 ded<   	  ed      Zded<   dd fdZedd       Zedd       Zedd       Z xZS )TracerSessionzbTracerSession schema for the API.

    Sessions are also referred to as "Projects" in the UI.
    r   rS   c                 H    t        j                  t        j                        S rU   rV   r(   r)   r*   rY   zTracerSession.<lambda>  rZ   r)   r@   r   r   Nro   r   ri   r   r   rF   r   	tenant_idrR   reference_dataset_idrD   rs   c                    t        |   di | || _        | j                  j                  0| j                  j                  t        j                        | _        yy)r   N)tzinfor(   )rw   rx   rs   r   rF  replacer   rX   )r.   rs   ry   rz   s      r*   rx   zTracerSession.__init__  sL    "6""??!!)"oo55X\\5JDO *r)   c                l    | j                   r(| j                    d| j                   d| j                   S y)r|   r~   z/projects/p/N)rs   rC  rS   r7   s    r*   r   zTracerSession.url  s3     >>nn%S(8TWWINNr)   c                X    | j                   d| j                   vri S | j                   d   S r   r   r7   s    r*   rH   zTracerSession.metadata  -     ::4::!=Izz*%%r)   c                X    | j                   d| j                   vrg S | j                   d   S )zRetrieve the tags (if any).r   rJ  r7   s    r*   r   zTracerSession.tags  s-     ::tzz!9Izz&!!r)   rU   r   r   r   )r;   r   )r#   r$   r%   r&   r'   r   r   r   r   r   r   r   rs   rx   r   r   rH   r   r   r   s   @r*   rA  rA    s    
 	H  1STJT+#'H ')!%K%)D-"&*E#*)O0((J*48I}8K   & & " "r)   rA  c                      e Zd ZU 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ed<   	 ded<   	 ded<   	 ded<   y)TracerSessionResultzqA project, hydrated with additional information.

    Sessions are also referred to as "Projects" in the UI.
    r   	run_countzOptional[timedelta]latency_p50latency_p99r   r   r   ro   last_run_start_timerF   r   zOptional[List[Dict[str, Any]]]
run_facetsr   r   r   r   first_token_p50first_token_p99r7  
error_rateNr"   r(   r)   r*   rN  rN    s    
 ,$$?$$6=  D$$H++8,,)..-!!M""G&&C((G((>)r)   rN  c                  <    e Zd ZU dZded<   	 ded<   	 edd       Zy)	BaseMessageLikez7A protocol representing objects similar to BaseMessage.r   contentzDict[Any, Any]additional_kwargsc                     y)z,Type of the Message, used for serialization.Nr(   r7   s    r*   r  zBaseMessageLike.type  s    r)   N)r;   r   )r#   r$   r%   r&   r'   r   r  r(   r)   r*   rX  rX    s(    AL%%%C; ;r)   rX  c                  4    e Zd ZU dZded<   	 ded<   	 ded<   y)DatasetShareSchemaz*Represents the schema for a dataset share.r   r?   share_tokenr   r   Nr"   r(   r)   r*   r]  r]    s    4 ,	H(r)   r]  c                      e Zd ZU dZded<   	 ded<   	 dZded<   	  ed	 
      Zded<   	  ed 
      Zded<   	 ded<   y)AnnotationQueuezRepresents an annotation queue.r   rS   r   r   Nri   r   c                 H    t        j                  t        j                        S rU   rV   r(   r)   r*   rY   zAnnotationQueue.<lambda>  rZ   r)   r@   r   r[   c                 H    t        j                  t        j                        S rU   rV   r(   r)   r*   rY   zAnnotationQueue.<lambda>  rZ   r)   
updated_atrC  )	r#   r$   r%   r&   r'   r   r   r[   rc  r(   r)   r*   r`  r`    sP    )H8
I+!%K%: 1STJT> 1STJTCODr)   r`  c                  X    e Zd ZU dZded<   	 ded<   	 ded<   	 ded<   	 ded<   	 d	ed
<   y)BatchIngestConfigz"Configuration for batch ingestion.booluse_multipart_endpointr:   scale_up_qsize_triggerscale_up_nthreads_limitscale_down_nempty_trigger
size_limitr   size_limit_bytesNr"   r(   r)   r*   re  re    s:    ,  D<  7""AO/##8r)   re  c                  P    e Zd ZU dZdZded<   	 dZded<   	 dZded	<   	 dZd
ed<   y)LangSmithInfoz'Information about the LangSmith server.r   r   versionNro   license_expiration_timezOptional[BatchIngestConfig]batch_ingest_configrF   instance_flags)	r#   r$   r%   r&   ro  r'   rp  rq  rr  r(   r)   r*   rn  rn    s;    1GS.26/6+7;4;/3N,3r)   rn  c                  D    e Zd ZU dZded<   	 ded<   	 ded<   	 dZded	<   y)
LangSmithSettingsz"Settings for the LangSmith tenant.r   rS   display_namer   r[   Nri   tenant_handle)r#   r$   r%   r&   r'   rv  r(   r)   r*   rt  rt  -  s)    ,G)*#'M='r)   rt  c                  4    e Zd ZU dZded<   	 ded<   	 ded<   y)	FeedbackIngestTokenz2Represents the schema for a feedback ingest token.r   rS   r   r   r   
expires_atNr"   r(   r)   r*   rx  rx  9  s    <H.	H3+r)   rx  c                  4    e Zd ZU dZded<   	 ded<   	 ded<   y)	RunEventzRun event schema.r   r   zUnion[datetime, str]timerF   ry   Nr"   r(   r)   r*   r{  r{  D  s    
I
$$,r)   r{  c                  4    e Zd ZU dZded<   	 ded<   	 ded<   y)TimeDeltaInputzTimedelta input schema.r:   dayshoursminutesNr"   r(   r)   r*   r~  r~  O  s    !
IJLr)   r~  c                  4    e Zd ZU dZded<   	 ded<   	 ded<   y)DatasetDiffInfoz;Represents the difference information between two datasets.z
List[UUID]examples_modifiedexamples_addedexamples_removedNr"   r(   r)   r*   r  r  Z  s     E!!=:  <r)   r  c                      e Zd ZU dZded<   	 dZded<   	 dZded<   	 ded<   	 d	ed
<   	 d	ed<   	 ded<   	 dZded<   	 dZded<   	 dZ	ded<   	 e
dd       Zy)ComparativeExperimentzRepresents a comparative experiment.

    This information summarizes evaluation results comparing
    two or more models on a given dataset.
    r   rS   Nri   r   r   rC  r   r[   rp   rD  rF   r   r  experiments_infor   c                X    | j                   d| j                   vri S | j                   d   S r   rJ  r7   s    r*   rH   zComparativeExperiment.metadata  rK  r)   r   )r#   r$   r%   r&   r'   r   r   r   r  r   r   rH   r(   r)   r*   r  r  e  s     	H?D-:!%K%@OGDJJ&*E#*?-1*1\/3N,3P& &r)   r  c                  L    e Zd ZU dZded<   	 ded<   	 ded<   	 ded<   	 ded	<   y
)PromptCommitz$Represents a Prompt with a manifest.r   ownerrepocommit_hashrB   manifestz
List[dict]examplesNr"   r(   r)   r*   r  r    s0    .J0
I!(%r)   r  c                      e Zd ZU dZded<   	 ded<   	 ded<   	 dZded	<   	 dZded
<   	 dZded<   	 dZded<   	 dZ	ded<   	 dZ
ded<   	  ee      Zded<   	 dZded<   	 dZded<   	 dZded<   y)ListedPromptCommitz;Represents a listed prompt commit with associated metadata.r   rS   r   r  r  NrR   r   repo_id	parent_idri   r  ro   r[   rc  r@   r   example_run_idsr   r   num_downloads	num_viewsparent_commit_hash)r#   r$   r%   r&   r'   r   r  r  r  r[   rc  r   r   r  r  r  r  r(   r)   r*   r  r    s    EH6J)
I3"&K&O"G^"5 $I~$8!%K%*%)J")=%)J")B,1$,GO)GH#$M=$> I} :(,,1r)   r  c                  8   e Zd ZU dZded<   	 dZded<   	 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Zded<   	 dZded<   	 ded<   	 ded<   	 ded<   	 ded<   	 ded<   	 dZ	ded<   	 dZ
ded<   	 ded<   	 dZded<   	 dZded<   y) Promptz"Represents a Prompt with metadata.r   repo_handleNri   r   readmerS   rC  r   r[   rc  rf  	is_publicis_archivedr   r   original_repo_idupstream_repo_idr  	full_namer:   	num_likesr  r  r   liked_by_auth_userlast_commit_hashnum_commitsoriginal_repo_full_nameupstream_repo_full_name)r#   r$   r%   r&   r'   r   r  r  r  r  r  r  r  r(   r)   r*   r  r    s    ,!!%K%( FM #GN,*-O')
O.&*m*3&*m*30N<N"N)--@&*m*& -1]1:-1]1:r)   r  c                  (    e Zd ZU dZded<   	 ded<   y)ListPromptsResponsez A list of prompts with metadata.zList[Prompt]reposr:   r   Nr"   r(   r)   r*   r  r    s    *J&r)   r  c                  &    e Zd ZdZdZ	 dZ	 dZ	 dZy)PromptSortFieldz$Enum for sorting fields for prompts.r  r  rc  r  N)r#   r$   r%   r&   r  r  rc  r  r(   r)   r*   r  r    s%    .#MIJIr)   r  c                  4    e Zd ZU dZded<   	 ded<   	 ded<   y)InputTokenDetailsz~Breakdown of input token counts.

    Does *not* need to sum to full input token count. Does *not* need to have all keys.
    r:   audiocache_creation
cache_readNr"   r(   r)   r*   r  r  
  s(    
 J Or)   r  c                  (    e Zd ZU dZded<   	 ded<   y)OutputTokenDetailszBreakdown of output token counts.

    Does *not* need to sum to full output token count. Does *not* need to have all keys.
    r:   r  	reasoningNr"   r(   r)   r*   r  r    s    
 JNr)   r  c                  L    e Zd ZU dZded<   	 ded<   	 ded<   	 ded<   	 ded	<   y
)UsageMetadatazUsage metadata for a message, such as token counts.

    This is a standard representation of token usage that is consistent across models.
    r:   input_tokensoutput_tokensr   zNotRequired[InputTokenDetails]input_token_detailszNotRequired[OutputTokenDetails]output_token_detailsNr"   r(   r)   r*   r  r  /  s<    
 JPA77 :9r)   r  c                  (    e Zd ZU dZded<   	 ded<   y)UpsertExamplesResponsezCResponse object returned from the upsert_examples_multipart method.r:   countr   example_idsNr"   r(   r)   r*   r  r  G  s    MJ45r)   r  )br&   
__future__r   r   r   r   decimalr   enumr   typingr	   r
   r   r   r   r   r   r   r   uuidr   typing_extensionsr   r   pydantic.v1r   r   r   r   r   r   ImportErrorpydanticpathlibr   r   r%  r   r'  r   r<   r  r,   r>   rQ   r_   rd   rf   rk   r   r   r   r   r   r   DatasetTransformationTyper   r   r   r   r   r   r   r  r  r  r  r  r  r"  r2  r6  r<  r?  rA  rN  rX  r]  r`  re  rn  update_forward_refsrt  rx  r{  r~  r  r  r  r  r  r  r  r  r  r  r  r(   r)   r*   <module>r     s   $ " 2 2  
 
 
  4 $  %:y+t;<
4d?#
 $ 3eCJ/U39=MMNNOJ 8   ') '2K 2	.9 	.#? Y (bk (bVK I I  	C= 	CsD 
) 
 $ ?IU ?,k ,^Y N'i N'bD' DN	#t 	)5 :4 4= ="!* !%, %# #'9 'TOy O@Ye @5\ 5	3| 	33"I 3"l#*- #*L 
;h 
; 
;)% )Ei E"9	 9"	4I 	4    	(	 	(,) ,-y -Ye =i =!&I !&H 9  (2 (2V.;Y .;b') '
c4 
	 *%  I 06Y 6O!    s   L
 
L#"L#