a
    `g                     @  s  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 z$dd	lmZmZmZmZmZmZ W n2 e y   dd	l!mZmZmZmZmZmZ Y n0 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-G dd deZ.G dd d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$e4Z5G d%d& d&e&e	Z6G d'd( d(eZ7e$d) Z8G d*d+ d+ed,d-Z9G d.d/ d/e7Z:G d0d1 d1eZ;d2d3 Z<G d4d5 d5eZ=G d6d7 d7e=Z>G d8d9 d9e&e	Z?G d:d; d;ed,d-Z@G d<d= d=e=ZAG d>d? d?eZBG d@dA dAeBZCG dBdC dCeBZDG dDdE dEe	ZEG dFdG dGeZFG dHdI dIed,d-ZGG dJdK dKed,d-ZHG dLdM dMeFZIG dNdO dOeFZJG dPdQ dQeZKG dRdS dSeKZLeG dTdU dUeZMG dVdW dWed,d-ZNG dXdY dYeZOG dZd[ d[ed,d-ZPG d\d] d]eZQe1R  G d^d_ d_eZSG d`da daeZTG dbdc dced,d-ZUG ddde deed,d-ZVG dfdg dgeZWG dhdi dieZXG djdk dkeZYG dldm dmeZZG dndo doeZ[G dpdq dqeZ\G drds dse&e	Z]G dtdu dued,d-Z^G dvdw dwed,d-Z_G dxdy dyeZ`G dzd{ d{eZadS )|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                   @  s"   e Zd ZU dZded< ded< dS )
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__ r&   r&   _/var/www/html/cobodadashboardai.evdpl.com/venv/lib/python3.9/site-packages/langsmith/schemas.pyr   2   s   
r   c                   @  sD   e Zd ZdZddddddZddddd	d
dZddddZdS )BinaryIOLikez$Protocol for binary IO-like objects.intbytes)sizereturnc                 C  s   dS )zRead function.Nr&   )selfr,   r&   r&   r'   readM   s    zBinaryIOLike.readr   )offsetwhencer-   c                 C  s   dS )zSeek function.Nr&   )r.   r0   r1   r&   r&   r'   seekQ   s    zBinaryIOLike.seekr-   c                 C  s   dS )zGet value function.Nr&   r.   r&   r&   r'   getvalueU   s    zBinaryIOLike.getvalueN)r)   )r   )r!   r"   r#   r$   r/   r2   r5   r&   r&   r&   r'   r(   I   s   r(   c                   @  s^   e Zd ZU dZded< ee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_iddefault_factoryDict[str, Any]inputsNdefaultOptional[Dict[str, Any]]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'   Configb   s   rD   )r!   r"   r#   r$   r%   r   dictr;   r?   r@   rD   r&   r&   r&   r'   r6   Z   s   
r6   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	S )ExampleCreatezExample create model.Optional[UUID]idc                   C  s   t tjS Nr   nowr   utcr&   r&   r&   r'   <lambda>m       zExampleCreate.<lambda>r8   r   
created_atNOptional[Union[str, List[str]]]split)r!   r"   r#   r$   r%   r   rO   rQ   r&   r&   r&   r'   rF   i   s   
rF   c                   @  s~   e Zd ZU dZded< edd dZded< ee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S )ExampleUploadWithAttachmentsz Example upload with attachments.rG   rH   c                   C  s   t tjS rI   rJ   r&   r&   r&   r'   rM   u   rN   z%ExampleUploadWithAttachments.<lambda>r8   r   rO   r:   r;   Nr<   r>   r?   r@   rP   rQ   Optional[Attachments]attachments)r!   r"   r#   r$   r%   r   rO   rE   r;   r?   r@   rQ   rT   r&   r&   r&   r'   rR   q   s   
rR   c                   @  s   e Zd ZU dZded< dS )ExampleUpsertWithAttachmentsz Example create with attachments.r   r7   Nr    r&   r&   r&   r'   rU   }   s   
rU   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'   rV      s   
rV   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dddd fddZeddddZd d! Z  ZS )#ExamplezExample model.r   rH   c                   C  s   t jdtjdS )Nr   )tz)r   fromtimestampr   rL   r&   r&   r&   r'   rM      rN   zExample.<lambda>r8   r   rO   z$00000000-0000-0000-0000-000000000000r<   r7   NOptional[datetime]modified_atz	List[Run]runsrG   source_run_idz#Optional[Dict[str, AttachmentInfo]]rT   rX   	_host_url
_tenant_idr   None)r`   ra   kwargsr-   c                   s"   t  jf i | || _|| _dS )Initialize a Dataset object.N)super__init__r`   ra   )r.   r`   ra   rc   	__class__r&   r'   rf      s    zExample.__init__r3   c                 C  sL   | j rHd| 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)r`   r7   rH   ra   r   )r.   pathr&   r&   r'   url   s    zExample.urlc                 C  s$   | j  d| j d| j d| j dS )5Return a string representation of the RunBase object.(id=z, dataset_id=z, link=''))rh   rH   r7   rm   r4   r&   r&   r'   __repr__   s    zExample.__repr__)NN)r!   r"   r#   r$   r%   r   rO   r   r7   r]   listr^   r_   rT   r   r`   ra   rf   propertyrm   rq   __classcell__r&   r&   rg   r'   rY      s$   
  	rY   c                   @  s   e Zd ZU dZded< dS )ExampleSearchzExample returned via search.r   rH   Nr    r&   r&   r&   r'   ru      s   
ru   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)r9   descriptionzDict[str, str]renamez List of attachment names to keep	List[str]retainN)
r!   r"   r#   r$   r   rE   rx   r%   rr   rz   r&   r&   r&   r'   rv      s   
rv   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Z	ded
< dZ
ded< G dd dZdS )ExampleUpdatezUpdate class for Example.NrG   r7   r>   r;   r?   Optional[AttachmentsOperations]attachments_operationsr@   rP   rQ   c                   @  s   e Zd ZdZdZdS )zExampleUpdate.ConfigrA   TNr!   r"   r#   r$   rB   r&   r&   r&   r'   rD      s   rD   )r!   r"   r#   r$   r7   r%   r;   r?   r}   r@   rQ   rD   r&   r&   r&   r'   r{      s   
r{   c                   @  st   e Zd ZU dZded< ee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S )ExampleUpdateWithAttachmentsz Example update with attachments.r   rH   r8   r:   r;   Nr<   r>   r?   r@   rP   rQ   rS   rT   r|   r}   )r!   r"   r#   r$   r%   r   rE   r;   r?   r@   rQ   rT   r}   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   nameNrX   rw   zOptional[DataType]	data_typec                   @  s   e Zd ZdZdZdS )zDatasetBase.ConfigrA   TNr~   r&   r&   r&   r'   rD      s   rD   )r!   r"   r#   r$   r%   rw   r   rD   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                   @  s"   e Zd ZU dZded< ded< dS )DatasetTransformationz#Schema for dataset transformations.ry   rl   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ddddd fddZeddddZ  ZS )!DatasetzDataset ORM model.r   rH   r   rO   Nr<   r\   r]   Optional[int]example_countsession_countlast_session_start_timer>   inputs_schemaoutputs_schemaz%Optional[List[DatasetTransformation]]transformationsrX   r`   rG   ra   _public_pathr   rb   )r`   ra   r   rc   r-   c                   sT   d|v r| d|d< d|v r,| d|d< t jf i | || _|| _|| _dS )rd   Zinputs_schema_definitionr   Zoutputs_schema_definitionr   N)popre   rf   r`   ra   r   )r.   r`   ra   r   rc   rg   r&   r'   rf     s    zDataset.__init__r3   c                 C  sV   | j rR| jr| j  | j S | jr@| j  dt| j d| j S | j  d| j S dS )ri   rk   rj   N)r`   r   ra   r   rH   r4   r&   r&   r'   rm   +  s    zDataset.url)NNN)r!   r"   r#   r$   r%   r   r]   r   r   r   r   r   r   r   r`   ra   r   rf   rs   rm   rt   r&   r&   rg   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.NOptional[List[str]]tagsr   Zas_of)r!   r"   r#   r$   r   r%   r&   r&   r&   r'   r   7  s   
r   c                   C  s   di iS )Nr@   r&   r&   r&   r&   r'   _default_extra>  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 d!Zed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   rH   r   r   r   
start_timerun_typeNr\   end_timer8   Optional[dict]extrarX   error
serializedzOptional[List[Dict]]eventsrE   r;   r?   rG   reference_example_idparent_run_idr   r   z-Union[Attachments, Dict[str, AttachmentInfo]]rT   dict[str, Any]r3   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  s$   | j  d| j d| j d| j dS )rn   ro   z, name='z', run_type='rp   )rh   rH   r   r   r4   r&   r&   r'   rq     s    zRunBase.__repr__c                   @  s   e Zd ZdZdZdS )zRunBase.ConfigrA   TN)r!   r"   r#   r$   rC   r&   r&   r&   r'   rD     s   rD   )r!   r"   r#   r$   r%   r   r   r   r   r   r   r   rE   r;   r?   r   r   r   rT   rs   r@   r   rq   rD   r&   r&   r&   r'   r   B  s0   
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ed< eddZded< dZd ed!< eddZded"< d+dd#d$d% fd&d'Zedd(d)d*Z  ZS ),Runz$Run schema when loading from the DB.NrG   
session_idOptional[List[UUID]]child_run_idszOptional[List[Run]]
child_runsr>   feedback_statsrX   app_pathmanifest_idstatusr   prompt_tokenscompletion_tokenstotal_tokensr\   first_token_timeOptional[Decimal]
total_costprompt_costcompletion_costparent_run_idsr   trace_id r<   r   dotted_orderOptional[bool]
in_datasetr`   r   rb   r`   rc   r-   c                   sv   | dsd| di|}|ddp*i }t jf i |d|i || _| j sr| jsr| j	  | j
 | _dS )Initialize a Run object.r   rH   r;   N)r   r   re   rf   r`   r   stripr   r   	isoformatrH   )r.   r`   rc   r;   rg   r&   r'   rf     s    
zRun.__init__r3   c                 C  s    | j r| jr| j  | j S dS )ri   N)r`   r   r4   r&   r&   r'   rm     s    zRun.url)N)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`   rf   rs   rm   rt   r&   r&   rg   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?   r\   r   r   rX   r   r   rG   r   r   Optional[List[dict]]r   r   r   Zinputs_s3_urlsZoutputs_s3_urlsrH   r   Zsession_namer   Zinput_attachmentsZoutput_attachmentsr   r   r   AttachmentsrT   Nr    r&   r&   r&   r'   r     s2   
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.Nr\   last_reviewed_timeadded_at)r!   r"   r#   r$   r   r%   r   r&   r&   r&   r'   r     s   
r   c                   @  sD   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   typer8   r>   r@   NzOptional[Union[UUID, str]]user_idrX   	user_name)
r!   r"   r#   r$   r%   r   rE   r@   r   r   r&   r&   r&   r'   r     s   
r   c                   @  s   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     s   
r   c                   @  s   e Zd ZU dZdZded< dS )ModelFeedbackSourcezModel feedback source.modelzLiteral['model']r   Nr   r&   r&   r&   r'   r   #  s   
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   )  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   rH   Nr\   rO   r]   rG   Zrun_idr   r   key
SCORE_TYPEscore
VALUE_TYPEvaluerX   commentzUnion[str, dict, None]
correctionOptional[FeedbackSourceBase]feedback_sourcer   comparative_experiment_idfeedback_group_idzOptional[Dict]r   c                   @  s   e Zd ZdZdZdS )zFeedbackBase.ConfigrA   TNr~   r&   r&   r&   r'   rD   V  s   rD   )r!   r"   r#   r$   r%   rO   r]   r   r   r   r   r   r   r   r   r   rD   r&   r&   r&   r'   r   2  s"   
r   c                   @  s"   e Zd ZU dZded< ded< dS )FeedbackCategoryz+Specific value and label pair for feedback.floatr   rX   labelNr    r&   r&   r&   r'   r   \  s   
r   c                   @  s2   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   e  s   
r   c                   @  s&   e Zd ZU dZded< dZded< dS )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   
r   c                   @  s6   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   rH   r   rO   r]   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ddd fddZeddddZedddd Zed!dd"d#Z  ZS )%TracerSessionzbTracerSession schema for the API.

    Sessions are also referred to as "Projects" in the UI.
    r   rH   c                   C  s   t tjS rI   rJ   r&   r&   r&   r'   rM     rN   zTracerSession.<lambda>r8   r   r   Nr\   r   rX   rw   r   r>   r   	tenant_idrG   reference_dataset_idr<   r`   r   rb   r   c                   s:   t  jf i | || _| jjdu r6| jjtjd| _dS )r   N)tzinfo)re   rf   r`   r   r   replacer   rL   )r.   r`   rc   rg   r&   r'   rf     s    zTracerSession.__init__r3   c                 C  s$   | j r | j  d| j d| j S dS )ri   rk   z/projects/p/N)r`   r   rH   r4   r&   r&   r'   rm     s    zTracerSession.urlr   c                 C  s"   | j du sd| j vri S | j d S r   r   r4   r&   r&   r'   r@     s    zTracerSession.metadatary   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     s    zTracerSession.tags)N)r!   r"   r#   r$   r%   r   r   r   rw   r   r   r   r`   rf   rs   rm   r@   r   rt   r&   r&   rg   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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   r\   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dZd	S )
BaseMessageLikez7A protocol representing objects similar to BaseMessage.r   contentzDict[Any, Any]Zadditional_kwargsr3   c                 C  s   dS )z,Type of the Message, used for serialization.Nr&   r4   r&   r&   r'   r     s    zBaseMessageLike.typeN)r!   r"   r#   r$   r%   rs   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   rm   Nr    r&   r&   r&   r'   r     s
   
r   c                   @  sb   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   rH   r   r   NrX   rw   c                   C  s   t tjS rI   rJ   r&   r&   r&   r'   rM     rN   zAnnotationQueue.<lambda>r8   r   rO   c                   C  s   t tjS rI   rJ   r&   r&   r&   r'   rM     rN   
updated_atr   )	r!   r"   r#   r$   r%   rw   r   rO   r   r&   r&   r&   r'   r     s   
r   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	ed
< dS )BatchIngestConfigz"Configuration for batch ingestion.boolZ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                   @  sB   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   versionNr\   license_expiration_timezOptional[BatchIngestConfig]batch_ingest_configr>   instance_flags)	r!   r"   r#   r$   r   r%   r   r  r  r&   r&   r&   r'   r     s
   
r   c                   @  s6   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   rH   Zdisplay_namer   rO   NrX   tenant_handle)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 )	FeedbackIngestTokenz2Represents the schema for a feedback ingest token.r   rH   r   rm   r   Z
expires_atNr    r&   r&   r&   r'   r  9  s
   
r  c                   @  s*   e Zd ZU dZded< ded< ded< dS )	RunEventzRun event schema.r   r   zUnion[datetime, str]timer>   rc   Nr    r&   r&   r&   r'   r  D  s
   
r  c                   @  s*   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'   r  O  s
   
r  c                   @  s*   e Zd ZU dZded< ded< ded< dS )DatasetDiffInfoz;Represents the difference information between two datasets.z
List[UUID]Zexamples_modifiedZexamples_addedZexamples_removedNr    r&   r&   r&   r'   r  Z  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ed< dZded< dZded< dZ	ded< e
d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   rH   NrX   r   rw   r   r   rO   r]   r   r>   r   r   experiments_infor   r   r3   c                 C  s"   | j du sd| j vri S | j d S r   r   r4   r&   r&   r'   r@     s    zComparativeExperiment.metadata)r!   r"   r#   r$   r%   r   rw   r   r  r   rs   r@   r&   r&   r&   r'   r  e  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
S )PromptCommitz$Represents a Prompt with a manifest.r   ownerrepocommit_hashr:   manifestz
List[dict]ZexamplesNr    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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   rH   r   r  r  NrG   r   repo_id	parent_idrX   r  r\   rO   r   r8   r   example_run_idsr   r   num_downloads	num_viewsparent_commit_hash)r!   r"   r#   r$   r%   r   r  r  r  rO   r   r   rr   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< 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_handleNrX   rw   readmerH   r   r   rO   r   r   Z	is_publicZis_archivedry   r   original_repo_idupstream_repo_idr  Z	full_namer*   	num_likesr  r  r   liked_by_auth_userlast_commit_hashZnum_commitsoriginal_repo_full_nameupstream_repo_full_name)r!   r"   r#   r$   r%   rw   r  r  r  r   r!  r"  r#  r&   r&   r&   r'   r    s0   
r  c                   @  s"   e Zd ZU dZded< ded< dS )ListPromptsResponsez A list of prompts with metadata.zList[Prompt]Zreposr*   r   Nr    r&   r&   r&   r'   r$    s   
r$  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.r  r  r   r  N)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 )InputTokenDetailsz~Breakdown of input token counts.

    Does *not* need to sum to full input token count. Does *not* need to have all keys.
    r*   audioZcache_creationZ
cache_readNr    r&   r&   r&   r'   r&  
  s
   
r&  c                   @  s"   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*   r'  Z	reasoningNr    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
S )UsageMetadatazUsage metadata for a message, such as token counts.

    This is a standard representation of token usage that is consistent across models.
    r*   Zinput_tokensZoutput_tokensr   zNotRequired[InputTokenDetails]Zinput_token_detailszNotRequired[OutputTokenDetails]Zoutput_token_detailsNr    r&   r&   r&   r'   r)  /  s   
r)  c                   @  s"   e Zd ZU dZded< ded< dS )UpsertExamplesResponsezCResponse object returned from the upsert_examples_multipart method.r*   country   Zexample_idsNr    r&   r&   r&   r'   r*  G  s   
r*  )br$   
__future__r   r   r   r   decimalr   enumr   typingr   r	   r
   r   r   r   r   r   r   uuidr   Ztyping_extensionsr   r   Zpydantic.v1r   r   r   r   r   r   ImportErrorZpydanticpathlibr   r   r   r   r   r   r+   r   r(   r6   rF   rR   rU   rV   rY   ru   rv   r{   r   r   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   Zupdate_forward_refsr  r  r  r  r  r  r  r  r  r$  r%  r&  r(  r)  r*  r&   r&   r&   r'   <module>   s   ,$&	&+	/QG		*	6&$+1	