o
    Zh                     @  s4  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 ddlmZ ddlmZmZ zdd	lmZmZmZmZmZmZ W n eyg   dd	lmZmZmZmZmZmZ Y nw 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 deZ&e#e$ee'e$e(f e&e'e$e f f f Z)	 eG dd deZ*G dd deZ+G dd deZ,ee&e,e'e$e(f e'e$e f f Z-G dd deZ.e.Z/G dd de.Z0G dd deZ1G dd de+Z2G dd de+Z3G dd  d eZ4G d!d" d"eZ5e5Z6G d#d$ d$e$e	Z7G d%d& d&eZ8e!d' Z9G d(d) d)ed*d+Z:G d,d- d-e8Z;G d.d/ d/eZ<d0d1 Z=G d2d3 d3eZ>G d4d5 d5e>Z?G d6d7 d7e$e	Z@G d8d9 d9ed*d+ZAG d:d; d;e>ZBG d<d= d=eZCG d>d? d?eCZDG d@dA dAeCZEG dBdC dCe	ZFG dDdE dEeZGG dFdG dGed*d+ZHG dHdI dIed*d+ZIG dJdK dKeGZJG dLdM dMeGZKG dNdO dOeZLG dPdQ dQeLZMeG dRdS dSeZNG dTdU dUed*d+ZOG dVdW dWeZPG dXdY dYePZQG dZd[ d[ed*d+ZRG d\d] d]eZSe2T  G d^d_ d_eZUG d`da daeZVG dbdc dced*d+ZWG ddde deed*d+ZXG dfdg dgeZYG dhdi dieZZG djdk dkeZ[G dldm dmeZ\G dndo doeZ]G dpdq dqeZ^G drds dse$e	Z_G dtdu dued*d+Z`G dvdw dwed*d+ZaG dxdy dyed*d+ZbG dzd{ d{ed*d+ZcG d|d} d}eZdG d~d ded*d+ZeG dd deZfdS )zSchemas for the LangSmith API.    )annotations)datetime	timedeltatimezone)Decimal)Enum)Any
NamedTupleOptionalProtocol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< dS )
Attachmenta  Annotated type that will be stored as an attachment if used.

    Examples:

        .. code-block:: python

            from langsmith import traceable
            from langsmith.schemas import Attachment


            @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_typeUnion[bytes, Path]dataN__name__
__module____qualname____doc____annotations__ r%   r%   H/var/www/html/lang_env/lib/python3.10/site-packages/langsmith/schemas.pyr   /   s   
 r   c                   @  s2   e Zd ZdZddddZddddZdddZdS )BinaryIOLikez$Protocol for binary IO-like objects.sizeintreturnbytesc                 C     dS )zRead function.Nr%   )selfr)   r%   r%   r&   readN      zBinaryIOLike.readr   offsetwhencec                 C  r-   )zSeek function.Nr%   )r.   r1   r2   r%   r%   r&   seekR   r0   zBinaryIOLike.seekc                 C  r-   )zGet value function.Nr%   r.   r%   r%   r&   getvalueV   r0   zBinaryIOLike.getvalueN)r(   )r)   r*   r+   r,   )r   )r1   r*   r2   r*   r+   r*   )r+   r,   )r    r!   r"   r#   r/   r3   r5   r%   r%   r%   r&   r'   J   s
    r'   c                   @  s^   e Zd ZU dZded< eddZded< eddZded< eddZded	< G d
d dZ	dS )ExampleBasezExample base model.r   
dataset_idNdefaultOptional[dict[str, Any]]inputsoutputsmetadatac                   @  s   e Zd ZdZdZdZdS )zExampleBase.Config#Configuration class for the schema.TN)r    r!   r"   r#   frozenarbitrary_types_allowedr%   r%   r%   r&   Configc   s    rA   )
r    r!   r"   r#   r$   r   r;   r<   r=   rA   r%   r%   r%   r&   r6   [   s   
 r6   c                   @  s   e Zd ZU ded< ded< dS )_AttachmentDictr   r   r   r   N)r    r!   r"   r$   r%   r%   r%   r&   rB   j   s   
 rB   c                      s   e Zd ZU dZded< edd dZded< ed	d
Zded< ed	d
Zde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<  fddZ  ZS )ExampleCreatez Example upload with attachments.Optional[UUID]idc                   C     t tjS Nr   nowr   utcr%   r%   r%   r&   <lambda>x       zExampleCreate.<lambda>default_factoryr   
created_atNr8   r:   r;   r<   r=   Optional[Union[str, list[str]]]splitz$Optional[dict[str, _AttachmentLike]]attachmentsFbooluse_source_run_ioOptional[list[str]]use_source_run_attachmentssource_run_idc                      t  jdi | dS zInitialize from dict.Nr%   super__init__r.   r   	__class__r%   r&   r\         zExampleCreate.__init__)r    r!   r"   r#   r$   r   rO   r;   r<   r=   rQ   rR   rT   rV   rW   r\   __classcell__r%   r%   r^   r&   rC   t   s   
 rC   c                   @     e Zd ZU dZded< dS )ExampleUpsertWithAttachmentsz Example create with attachments.r   r7   Nr   r%   r%   r%   r&   rc         
 rc   c                   @  s*   e Zd ZU dZded< ded< ded< dS )	AttachmentInfozInfo for an attachment.r   Zpresigned_urlr'   readerOptional[str]r   Nr   r%   r%   r%   r&   re      s
   
 re   c                      s   e Zd ZU dZded< edd dZded< eed	d
Zded< edd
Z	ded< ee
dZded< dZded< edd
Zded< 	 edd
Zded< edd
Zded< 		d"d# fddZed$ddZd d! Z  ZS )%ExamplezExample model.r   rE   c                   C  s   t jdtjdS )Nr   )tz)r   fromtimestampr   rJ   r%   r%   r%   r&   rK      s    zExample.<lambda>rM   r   rO   z$00000000-0000-0000-0000-000000000000r8   r7   NOptional[datetime]modified_atz	list[Run]runsrD   rW   z#Optional[dict[str, AttachmentInfo]]rR   rg   	_host_url
_tenant_idkwargsr   r+   Nonec                   s"   t  jdi | || _|| _dS )Initialize a Dataset object.Nr%   )r[   r\   rn   ro   )r.   rn   ro   rp   r^   r%   r&   r\      s   
zExample.__init__c                 C  sL   | j r$d| j d| j }| jr| j  dt| j | S | j  | S dS )URL of this run within the app.
/datasets/z/e//o/N)rn   r7   rE   ro   r   )r.   pathr%   r%   r&   url   s   zExample.urlc                 C  $   | j  d| j d| j d| j dS )5Return a string representation of the RunBase object.(id=z, dataset_id=z, link=''))r_   rE   r7   rw   r4   r%   r%   r&   __repr__      $zExample.__repr__)NN)rn   rg   ro   rD   rp   r   r+   rq   r+   rg   )r    r!   r"   r#   r$   r   rO   r   r7   rl   listrm   rW   rR   r   rn   ro   r\   propertyrw   r|   ra   r%   r%   r^   r&   rh      s(   
 	rh   c                   @  rb   )ExampleSearchzExample returned via search.r   rE   Nr   r%   r%   r%   r&   r      rd   r   c                   @  s:   e Zd ZU dZeeddZded< eeddZ	ded< d	S )
AttachmentsOperationsz%Operations to perform on attachments.z,Mapping of old attachment names to new names)rN   descriptionzdict[str, str]renamez List of attachment names to keep	list[str]retainN)
r    r!   r"   r#   r   dictr   r$   r   r   r%   r%   r%   r&   r      s   
 r   c                      s   e Zd ZU dZded< dZded< eddZded	< eddZde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 dZ fddZ  ZS )ExampleUpdatez Example update with attachments.r   rE   NrD   r7   r8   r:   r;   r<   r=   rP   rQ   zOptional[Attachments]rR   zOptional[AttachmentsOperations]attachments_operationsc                   @     e Zd ZdZdZdS )zExampleUpdate.Configr>   TNr    r!   r"   r#   r?   r%   r%   r%   r&   rA          rA   c                   rX   rY   rZ   r]   r^   r%   r&   r\      r`   zExampleUpdate.__init__)r    r!   r"   r#   r$   r7   r   r;   r<   r=   rQ   rR   r   rA   r\   ra   r%   r%   r^   r&   r      s   
 r   c                   @  s   e Zd ZdZdZdZdZdS )DataTypezEnum for dataset data types.kvllmchatN)r    r!   r"   r#   r   r   r   r%   r%   r%   r&   r      s
    r   c                   @  s@   e Zd ZU dZded< dZded< dZded< G d	d
 d
ZdS )DatasetBasezDataset base model.r   nameNrg   r   zOptional[DataType]	data_typec                   @  r   )zDatasetBase.Configr>   TNr   r%   r%   r%   r&   rA      r   rA   )r    r!   r"   r#   r$   r   r   rA   r%   r%   r%   r&   r      s   
 r   )Zremove_system_messagesZconvert_to_openai_messageZconvert_to_openai_toolZremove_extra_fieldsZextract_tools_from_runc                   @  r   )DatasetTransformationz#Schema for dataset transformations.r   rv   z%Union[DatasetTransformationType, str]Ztransformation_typeNr   r%   r%   r%   r&   r     s   
 r   F)totalc                      s   e Zd ZU dZded< de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< eddZded< eddZded< eddZded< 			d d! fddZed"ddZ  ZS )#DatasetzDataset ORM model.r   rE   r   rO   Nr8   rk   rl   Optional[int]example_countsession_countlast_session_start_timer:   inputs_schemaoutputs_schemaz%Optional[list[DatasetTransformation]]transformationsrg   rn   rD   ro   _public_pathrp   r   r+   rq   c                   sT   d|v r| d|d< d|v r| d|d< t jdi | || _|| _|| _dS )rr   Zinputs_schema_definitionr   Zoutputs_schema_definitionr   Nr%   )popr[   r\   rn   ro   r   )r.   rn   ro   r   rp   r^   r%   r&   r\   "  s   
zDataset.__init__c                 C  sV   | j r)| jr| j  | j S | jr | j  dt| j d| j S | j  d| j S dS )rs   ru   rt   N)rn   r   ro   r   rE   r4   r%   r%   r&   rw   5  s   zDataset.url)NNN)
rn   rg   ro   rD   r   rg   rp   r   r+   rq   r~   )r    r!   r"   r#   r$   r   rl   r   r   r   r   r   r   r   rn   ro   r   r\   r   rw   ra   r%   r%   r^   r&   r     s(   
 r   c                   @  s&   e Zd ZU dZdZded< ded< dS )DatasetVersionz%Class representing a dataset version.NrU   tagsr   Zas_of)r    r!   r"   r#   r   r$   r%   r%   r%   r&   r   A  s   
 r   c                   C  s   di iS )Nr=   r%   r%   r%   r%   r&   _default_extraH  s   r   c                   @  s  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dZded< 	 d	Z	ded< 	 d	Z
ded< 	 d	Zded< 	 e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< 	 eedZded< 	 ed(d d!Zed)d"d#Zd$d% ZG d&d' d'Zd	S )*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   rE   r   r   r   
start_timerun_typeNrk   end_timerM   Optional[dict]extrarg   error
serializedOptional[list[dict]]eventsr   r;   r<   rD   reference_example_idparent_run_idrU   r   z-Union[Attachments, dict[str, AttachmentInfo]]rR   r+   dict[str, Any]c                 C  s   | j du ri | _ | j di S zRetrieve the metadata (if any).Nr=   )r   
setdefaultr4   r%   r%   r&   r=     s   
zRunBase.metadatac                 C  s   | j dS )z"Retrieve the revision ID (if any).revision_id)r=   getr4   r%   r%   r&   r     s   zRunBase.revision_idc                 C  rx   )ry   rz   z, name='z', run_type='r{   )r_   rE   r   r   r4   r%   r%   r&   r|     r}   zRunBase.__repr__c                   @  r   )zRunBase.Configr>   TN)r    r!   r"   r#   r@   r%   r%   r%   r&   rA     r   rA   r+   r   )r+   rD   )r    r!   r"   r#   r$   r   r   r   r   r   r   r   r   r;   r<   r   r   r   rR   r   r=   r   r|   rA   r%   r%   r%   r&   r   L  sP   
 r   c                      s  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Zded< 	 dZded< 	 dZded< 	 dZded< 	 d ed!< 	 ed"d#Zd$ed%< 	 dZd&ed'< 	 edd#Zded(< dEdF fd-d.ZedGd/d0ZedHd2d3Z edHd4d5Z!edId7d8Z"edId9d:Z#edJd<d=Z$edJd>d?Z%edKdAdBZ&edKdCdDZ'  Z(S )LRunz$Run schema when loading from the DB.NrD   
session_idOptional[list[UUID]]child_run_idszOptional[list[Run]]
child_runsr:   feedback_statsrg   app_pathmanifest_idstatusr   prompt_tokenscompletion_tokenstotal_tokenszOptional[dict[str, int]]prompt_token_detailscompletion_token_detailsrk   first_token_timeOptional[Decimal]
total_costprompt_costcompletion_costzOptional[dict[str, Decimal]]prompt_cost_detailscompletion_cost_detailsparent_run_idsr   trace_id r8   r   dotted_orderOptional[bool]
in_datasetrn   rp   r   r+   rq   c                   s~   | dsd| di|}|ddpi }t jdi |d|i || _| j s;| js=| j	  | j
 | _dS dS dS )Initialize a Run object.r   rE   r;   Nr%   )r   r   r[   r\   rn   r   stripr   r   	isoformatrE   )r.   rn   rp   r;   r^   r%   r&   r\     s   
zRun.__init__c                 C  s    | j r| jr| j  | j S dS )rs   N)rn   r   r4   r%   r%   r&   rw     s   zRun.url
int | Nonec                 C     | j S )zAlias for prompt_tokens.)r   r4   r%   r%   r&   input_tokens     zRun.input_tokensc                 C  r   )zAlias for completion_tokens.)r   r4   r%   r%   r&   output_tokens  r   zRun.output_tokensDecimal | Nonec                 C  r   )zAlias for prompt_cost.)r   r4   r%   r%   r&   
input_cost   r   zRun.input_costc                 C  r   )zAlias for completion_cost.)r   r4   r%   r%   r&   output_cost  r   zRun.output_costdict[str, int] | Nonec                 C  r   )zAlias for prompt_token_details.)r   r4   r%   r%   r&   input_token_details
  r   zRun.input_token_detailsc                 C  r   )zAlias for output_token_details.)r   r4   r%   r%   r&   output_token_details  r   zRun.output_token_detailsdict[str, Decimal] | Nonec                 C  r   )zAlias for prompt_cost_details.)r   r4   r%   r%   r&   input_cost_details  r   zRun.input_cost_detailsc                 C  r   )z"Alias for completion_cost_details.)r   r4   r%   r%   r&   output_cost_details  r   zRun.output_cost_detailsrG   rn   rg   rp   r   r+   rq   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   rn   r\   r   rw   r   r   r   r   r   r   r   r   ra   r%   r%   r^   r&   r     s   
 
r   c                   @  s,   e Zd ZdZdZdZdZdZdZdZ	dZ
d	S )
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    r   c                   @  s   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$< d%S )&RunLikeDictz&Run-like dictionary, for type-hinting.r   r   r   r   r   r   r   r;   r<   rk   r   r   rg   r   r   rD   r   r   r   r   rU   r   Zinputs_s3_urlsZoutputs_s3_urlsrE   r   Zsession_namer   Zinput_attachmentsZoutput_attachmentsr   r   r   AttachmentsrR   Nr   r%   r%   r%   r&   r   +  s4   
 r   c                   @  s,   e Zd ZU dZdZded< 	 dZded< dS )RunWithAnnotationQueueInfoz&Run schema with annotation queue info.Nrk   last_reviewed_timeadded_at)r    r!   r"   r#   r   r$   r   r%   r%   r%   r&   r   H  s   
 r   c                   @  sJ   e Zd ZU dZded< 	 eedZded< 	 dZded	< 	 dZ	d
ed< dS )FeedbackSourceBasezBase class for feedback sources.

    This represents whether feedback is submitted from the API, model, human labeler,
        etc.
    r   typerM   r:   r=   NzOptional[Union[UUID, str]]user_idrg   	user_name)
r    r!   r"   r#   r$   r   r   r=   r   r   r%   r%   r%   r&   r   Q  s   
 r   c                   @     e Zd ZU dZdZded< dS )APIFeedbackSourcezAPI feedback source.apizLiteral['api']r   Nr    r!   r"   r#   r   r$   r%   r%   r%   r&   r   b     
 r   c                   @  r   )ModelFeedbackSourcezModel feedback source.modelzLiteral['model']r   Nr   r%   r%   r%   r&   r   h  r   r   c                   @  s   e Zd ZdZdZ	 dZdS )FeedbackSourceTypezFeedback source type.r   r   N)r    r!   r"   r#   ZAPIZMODELr%   r%   r%   r&   r   n  s    r   c                   @  s   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 dZdS )FeedbackBasezFeedback schema.r   rE   Nrk   rO   rl   rD   Zrun_idr   r   key
SCORE_TYPEscore
VALUE_TYPEvaluerg   commentzUnion[str, dict, None]
correctionOptional[FeedbackSourceBase]feedback_sourcer   comparative_experiment_idfeedback_group_idr   r   c                   @  r   )zFeedbackBase.Configr>   TNr   r%   r%   r%   r&   rA     r   rA   )r    r!   r"   r#   r$   rO   rl   r   r   r   r  r  r   r  r  r   rA   r%   r%   r%   r&   r   w  sB   
 r   c                   @  $   e Zd ZU dZded< 	 ded< dS )FeedbackCategoryz+Specific value and label pair for feedback.floatr   rg   labelNr   r%   r%   r%   r&   r       
 r  c                   @  s8   e Zd ZU dZded< 	 ded< 	 ded< 	 ded< d	S )
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%   r&   r    s   
 r  c                   @  s6   e Zd ZU dZded< 	 dZded< 	 dZded< dS )	FeedbackCreatez"Schema used for creating feedback.r   r  NzOptional[FeedbackConfig]feedback_configr   r   )r    r!   r"   r#   r$   r  r   r%   r%   r%   r&   r    s   
 r  c                   @  s:   e Zd ZU dZded< ded< 	 ded< 	 dZded	< dS )
FeedbackzSchema for getting feedback.r   rE   r   rO   rl   Nr  r  )r    r!   r"   r#   r$   r  r%   r%   r%   r&   r    s   
 r  c                      s   e Zd ZU dZded< 	 ed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< 	 ded< 	 ed	dZded< d$d% fddZed&ddZed'dd Zed(d"d#Z  ZS ))TracerSessionzbTracerSession schema for the API.

    Sessions are also referred to as "Projects" in the UI.
    r   rE   c                   C  rF   rG   rH   r%   r%   r%   r&   rK     rL   zTracerSession.<lambda>rM   r   r   Nrk   r   rg   r   r   r:   r   	tenant_idrD   reference_dataset_idr8   rn   rp   r   r+   rq   c                   s>   t  jdi | || _| jjdu r| jjtjd| _dS dS )r   N)tzinfor%   )r[   r\   rn   r   r  replacer   rJ   )r.   rn   rp   r^   r%   r&   r\     s
   zTracerSession.__init__c                 C  s$   | j r| j  d| j d| j S dS )rs   ru   z/projects/p/N)rn   r  rE   r4   r%   r%   r&   rw     s   zTracerSession.urlr   c                 C  "   | j du s
d| j vri S | j d S r   r   r4   r%   r%   r&   r=        
zTracerSession.metadatar   c                 C  s"   | j du s
d| j vrg S | j d S )zRetrieve the tags (if any).Nr   r  r4   r%   r%   r&   r     r  zTracerSession.tagsrG   r   r~   r   )r+   r   )r    r!   r"   r#   r$   r   r   r   r   r   r   r   rn   r\   r   rw   r=   r   ra   r%   r%   r^   r&   r    s4   
 r  c                   @  s   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S )TracerSessionResultzqA project, hydrated with additional information.

    Sessions are also referred to as "Projects" in the UI.
    r   Z	run_countzOptional[timedelta]Zlatency_p50Zlatency_p99r   r   r   rk   Zlast_run_start_timer:   r   zOptional[list[dict[str, Any]]]Z
run_facetsr   r   r   r   Zfirst_token_p50Zfirst_token_p99r  Z
error_rateNr   r%   r%   r%   r&   r    s@   
 r  c                   @  s4   e Zd ZU dZded< 	 ded< 	 ed
ddZd	S )BaseMessageLikez7A protocol representing objects similar to BaseMessage.r   contentzdict[Any, Any]Zadditional_kwargsr+   c                 C  r-   )z,Type of the Message, used for serialization.Nr%   r4   r%   r%   r&   r   3  s    zBaseMessageLike.typeN)r+   r   )r    r!   r"   r#   r$   r   r   r%   r%   r%   r&   r  *  s   
 r  c                   @  s.   e Zd ZU dZded< 	 ded< 	 ded< dS )DatasetShareSchemaz*Represents the schema for a dataset share.r   r7   Zshare_tokenr   rw   Nr   r%   r%   r%   r&   r  8     
 r  c                   @  sl   e Zd ZU dZded< 	 ded< 	 dZded< 	 ed	d
 dZded< 	 edd
 dZded< 	 ded< dS )AnnotationQueuezRepresents an annotation queue.r   rE   r   r   Nrg   r   c                   C  rF   rG   rH   r%   r%   r%   r&   rK   L  rL   zAnnotationQueue.<lambda>rM   r   rO   c                   C  rF   rG   rH   r%   r%   r%   r&   rK   N  rL   
updated_atr  )	r    r!   r"   r#   r$   r   r   rO   r!  r%   r%   r%   r&   r   C  s   
 r   c                   @  s   e Zd ZU dZdZded< dS )AnnotationQueueWithDetailsz,Represents an annotation queue with details.Nrg   rubric_instructions)r    r!   r"   r#   r#  r$   r%   r%   r%   r&   r"  T  s   
 r"  c                   @  sL   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S )BatchIngestConfigz"Configuration for batch ingestion.rS   Zuse_multipart_endpointr*   Zscale_up_qsize_triggerZscale_up_nthreads_limitZscale_down_nempty_triggerZ
size_limitr   Zsize_limit_bytesNr   r%   r%   r%   r&   r$  [  s   
 r$  c                   @  sH   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S )LangSmithInfoz'Information about the LangSmith server.r   r   versionNrk   license_expiration_timezOptional[BatchIngestConfig]batch_ingest_configr:   instance_flags)	r    r!   r"   r#   r&  r$   r'  r(  r)  r%   r%   r%   r&   r%  l  s   
 r%  c                   @  s<   e Zd ZU dZded< 	 ded< 	 ded< 	 dZded	< dS )
LangSmithSettingsz"Settings for the LangSmith tenant.r   rE   display_namer   rO   Nrg   tenant_handle)r    r!   r"   r#   r$   r,  r%   r%   r%   r&   r*  {  s   
 r*  c                   @  .   e Zd ZU dZded< 	 ded< 	 ded< dS )	FeedbackIngestTokenz2Represents the schema for a feedback ingest token.r   rE   r   rw   r   Z
expires_atNr   r%   r%   r%   r&   r.    r  r.  c                   @  r-  )	RunEventzRun event schema.r   r   zUnion[datetime, str]timer:   rp   Nr   r%   r%   r%   r&   r/    r  r/  c                   @  .   e Zd ZU dZded< 	 ded< 	 ded< dS )TimeDeltaInputzTimedelta input schema.r*   dayshoursminutesNr   r%   r%   r%   r&   r2    r  r2  c                   @  r1  )DatasetDiffInfoz;Represents the difference information between two datasets.z
list[UUID]Zexamples_modifiedZexamples_addedZexamples_removedNr   r%   r%   r%   r&   r6    r  r6  c                   @  s   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dZdS )ComparativeExperimentzRepresents a comparative experiment.

    This information summarizes evaluation results comparing
    two or more models on a given dataset.
    r   rE   Nrg   r   r   r  r   rO   rl   r  r:   r   r   experiments_infor   r+   r   c                 C  r  r   r  r4   r%   r%   r&   r=     r  zComparativeExperiment.metadatar   )r    r!   r"   r#   r$   r   r   r   r8  r   r   r=   r%   r%   r%   r&   r7    s0   
 r7  c                   @  sB   e Zd ZU dZded< 	 ded< 	 ded< 	 ded< 	 ded	< d
S )PromptCommitz$Represents a Prompt with a manifest.r   ownerrepocommit_hashr   manifestz
list[dict]ZexamplesNr   r%   r%   r%   r&   r9    s   
 r9  c                   @  s   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dZded< 	 dZded< 	 dZded< 	 dZded< dS )ListedPromptCommitz;Represents a listed prompt commit with associated metadata.r   rE   r   r:  r;  NrD   r   repo_id	parent_idrg   r<  rk   rO   r!  rM   r   example_run_idsr   r   num_downloads	num_viewsparent_commit_hash)r    r!   r"   r#   r$   r   r?  r@  r<  rO   r!  r   r   rA  rB  rC  rD  r%   r%   r%   r&   r>    s8   
 r>  c                   @  s  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< dS ) Promptz"Represents a Prompt with metadata.r   Zrepo_handleNrg   r   readmerE   r  r   rO   r!  rS   Z	is_publicZis_archivedr   r   original_repo_idupstream_repo_idr:  Z	full_namer*   	num_likesrB  rC  r   liked_by_auth_userlast_commit_hashZnum_commitsoriginal_repo_full_nameupstream_repo_full_name)r    r!   r"   r#   r$   r   rF  rG  rH  rJ  rK  rL  rM  r%   r%   r%   r&   rE    s\   
 rE  c                   @  r  )ListPromptsResponsez A list of prompts with metadata.zlist[Prompt]Zreposr*   r   Nr   r%   r%   r%   r&   rN  B  r
  rN  c                   @  s&   e Zd ZdZdZ	 dZ	 dZ	 dZdS )PromptSortFieldz$Enum for sorting fields for prompts.rB  rC  r!  rI  N)r    r!   r"   r#   rB  rC  r!  rI  r%   r%   r%   r&   rO  K  s    rO  c                   @  r1  )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&   rP  X     
 rP  c                   @  $   e Zd ZU dZded< 	 ded< dS )OutputTokenDetailszBreakdown of output token counts.

    Does *not* need to sum to full output token count. Does *not* need to have all keys.
    r*   rQ  	reasoningNr   r%   r%   r%   r&   rV  m     
 rV  c                   @  r1  )InputCostDetailszvBreakdown of input token costs.

    Does *not* need to sum to full input cost. Does *not* need to have all keys.
    r  rQ  rR  rS  Nr   r%   r%   r%   r&   rY  }  rT  rY  c                   @  rU  )OutputCostDetailszxBreakdown of output token costs.

    Does *not* need to sum to full output cost. Does *not* need to have all keys.
    r  rQ  rW  Nr   r%   r%   r%   r&   rZ    rX  rZ  c                   @  t   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S )UsageMetadatazUsage metadata for a message, such as token counts.

    This is a standard representation of token usage that is consistent across models.
    r*   r   r   r   zNotRequired[InputTokenDetails]r   zNotRequired[OutputTokenDetails]r   zNotRequired[float]r   r   r   zNotRequired[InputCostDetails]r   zNotRequired[OutputCostDetails]r   Nr   r%   r%   r%   r&   r\    s,   
 r\  c                   @  r[  )ExtractedUsageMetadatazUsage metadata dictionary extracted from a run.

    Should be the same as UsageMetadata, but does not require all
    keys to be present.
    r*   r   r   r   rP  r   rV  r   r  r   r   r   rY  r   rZ  r   Nr   r%   r%   r%   r&   r]    s,   
 r]  c                   @  r  )UpsertExamplesResponsezCResponse object returned from the upsert_examples_multipart method.r*   countr   Zexample_idsNr   r%   r%   r%   r&   r^    r
  r^  )gr#   
__future__r   r   r   r   decimalr   enumr   typingr   r	   r
   r   r   r   uuidr   typing_extensionsr   r   Zpydantic.v1r   r   r   r   r   r   ImportErrorZpydanticpathlibr   r   r   r   r   r   r   tupler,   r   r'   r6   rB   Z_AttachmentLikerC   ZExampleUploadWithAttachmentsrc   re   rh   r   r   r   ZExampleUpdateWithAttachmentsr   r   ZDatasetTransformationTyper   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%  Zupdate_forward_refsr*  r.  r/  r2  r6  r7  r9  r>  rE  rN  rO  rP  rV  rY  rZ  r\  r]  r^  r%   r%   r%   r&   <module>   s     $$
&+	/Q 		*	
6&$+1	"