
    j                     ~   d dl 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 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 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! 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.  e j^                  e j`                  d      Z1 G d d      Z2 G d d      Z3y)    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)#ExperimentGroupAggregationsResponse)ExperimentGroupResponse)ExperimentItem)3ExperimentItemBulkRecordExperimentItemBulkWriteView)ExperimentItemPublic)ExperimentPagePublic)ExperimentPublic)ExperimentScore)ExperimentScoreWrite)ExperimentUpdate)ExperimentUpdateStatus)ExperimentUpdateType)FeedbackScoreNamesPublic)JsonListStringWrite)JsonNode)PromptVersionLinkWrite   )AsyncRawExperimentsClientRawExperimentsClient)ExperimentWriteEvaluationMethod)ExperimentWriteStatus)ExperimentWriteType.c            #          e Zd ZdefdZedefd       Zeddde	j                  e   ded	e	j                  e   d
e	j                  e   ddf
dZddddddddddddddddde	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   d
e	j                  e   def dZeeeeeeeeeeeeeeeddde	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   d e	j                  e   d!e	j                  e	j                  e      d"e	j                  e   d#e	j                  e   de	j                  e   d$e	j                  e   d%e	j                  e	j                  e      d&e	j                  e   d'e	j                  e	j                  e      d(e	j                  e   d
e	j                  e   ddf"d)Zdd*d+e	j                  e   d
e	j                  e   ddfd,Zdd*de	j                  e   d
e	j                  e   ddfd-Zdd*de	j                  e   d
e	j                  e   ddfd.Zedd/d0eded1e	j                  e   d2e	j                  e   d
e	j                  e   ddfd3Z ddd4de	j                  e   d
e	j                  e   de!fd5Z"dddddddd6d7e	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   d
e	j                  e   de#fd8Z$dddddddd6d7e	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   d
e	j                  e   de%fd9Z&dd*de	j                  e   d
e	j                  e   ddfd:Z'dd*ded
e	j                  e   de(fd;Z)eeeeeeeedd<	dede	j                  e   d e	j                  e*   d!e	j                  e	j                  e      d=e	j                  e	j                  e      d>e	j                  e	j                  e      d"e	j                  e+   d$e	j                  e,   d%e	j                  e	j                  e-      d
e	j                  e   ddfd?Z.dd*ded
e	j                  e   de/fd@Z0eeeddAd0edBe	j                  e   dCe	j                  e   dDe	j                  e   d
e	j                  e   de	jb                  e2   fdEZ3eeddFdedBe	j                  e   dCe	j                  e   d
e	j                  e   de	jb                  e2   f
dGZ4y)HExperimentsClientclient_wrapperc                &    t        |      | _        y N)r   )r   _raw_clientselfr   s     y/Users/manta/Documents/Projects/TheRoad-I1/backend/.venv/lib/python3.12/site-packages/opik/rest_api/experiments/client.py__init__zExperimentsClient.__init__#   s    /~N    returnc                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawExperimentsClient
        r"   r$   s    r%   with_raw_responsez#ExperimentsClient.with_raw_response&        r'   N
merge_tagsrequest_optionsidsupdater/   r0   c                X    | j                   j                  ||||      }|j                  S )a  
        Update multiple experiments

        Parameters
        ----------
        ids : typing.Sequence[str]
            List of experiment IDs to update (max 1000)

        update : ExperimentUpdate

        merge_tags : typing.Optional[bool]
            If true, merge tags with existing tags instead of replacing them. Default: false

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import ExperimentUpdate
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.batch_update_experiments(ids=['ids'], update=ExperimentUpdate(), )
        r1   r2   r/   r0   r"   batch_update_experimentsdatar$   r1   r2   r/   r0   	_responses         r%   r6   z*ExperimentsClient.batch_update_experiments1   s5    F $$==Fz? > 
	 ~~r'   pagesize
dataset_idoptimization_idtypesnamedataset_deleted	prompt_id
project_idproject_deletedsortingfiltersexperiment_idsforce_sortingr0   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   c                n    | j                   j                  |||||||||	|
|||||      }|j                  S )a.  
        Find experiments

        Parameters
        ----------
        page : typing.Optional[int]

        size : typing.Optional[int]

        dataset_id : typing.Optional[str]

        optimization_id : typing.Optional[str]

        types : typing.Optional[str]

        name : typing.Optional[str]

        dataset_deleted : typing.Optional[bool]

        prompt_id : typing.Optional[str]

        project_id : typing.Optional[str]

        project_deleted : typing.Optional[bool]

        sorting : typing.Optional[str]

        filters : typing.Optional[str]

        experiment_ids : typing.Optional[str]

        force_sorting : typing.Optional[bool]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ExperimentPagePublic
            Experiments resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.find_experiments()
        r:   r"   find_experimentsr7   r$   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   r0   r9   s                    r%   rK   z"ExperimentsClient.find_experimentsY   sY    D $$55!++!+)'+ 6 
	" ~~r'   iddataset_namerC   project_namer@   metadatatagstypeevaluation_methodr>   statusexperiment_scoresprompt_versionprompt_versionsdataset_version_idr0   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   c                p    | j                   j                  |||||||||	|
||||||      }|j                  S )aF  
        Create experiment

        Parameters
        ----------
        id : typing.Optional[str]

        dataset_name : typing.Optional[str]

        project_id : typing.Optional[str]
            Project ID. Takes precedence over project_name when both are provided.

        project_name : typing.Optional[str]
            Project name. Creates project if it doesn't exist. Ignored when project_id is provided.

        name : typing.Optional[str]

        metadata : typing.Optional[JsonListStringWrite]

        tags : typing.Optional[typing.Sequence[str]]

        type : typing.Optional[ExperimentWriteType]

        evaluation_method : typing.Optional[ExperimentWriteEvaluationMethod]

        optimization_id : typing.Optional[str]

        status : typing.Optional[ExperimentWriteStatus]

        experiment_scores : typing.Optional[typing.Sequence[ExperimentScoreWrite]]

        prompt_version : typing.Optional[PromptVersionLinkWrite]

        prompt_versions : typing.Optional[typing.Sequence[PromptVersionLinkWrite]]

        dataset_version_id : typing.Optional[str]
            ID of the dataset version this experiment is linked to. If not provided at creation, experiment will be automatically linked to the latest version.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.create_experiment()
        rM   r"   create_experimentr7   r$   rN   rO   rC   rP   r@   rQ   rR   rS   rT   r>   rU   rV   rW   rX   rY   r0   r9   s                     r%   r\   z#ExperimentsClient.create_experiment   s\    N $$66%!%/+/)+1+! 7 
	$ ~~r'   r0   experiment_itemsc                T    | j                   j                  ||      }|j                  S )a  
        Create experiment items

        Parameters
        ----------
        experiment_items : typing.Sequence[ExperimentItem]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import ExperimentItem
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.create_experiment_items(experiment_items=[ExperimentItem(experiment_id='experiment_id', dataset_item_id='dataset_item_id', trace_id='trace_id', )], )
        r_   r0   r"   create_experiment_itemsr7   r$   r_   r0   r9   s       r%   rc   z)ExperimentsClient.create_experiment_items	  s0    6 $$<<- = 
	 ~~r'   c                T    | j                   j                  ||      }|j                  S )a  
        Delete experiment items

        Parameters
        ----------
        ids : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.delete_experiment_items(ids=['ids'], )
        r1   r0   r"   delete_experiment_itemsr7   r$   r1   r0   r9   s       r%   rh   z)ExperimentsClient.delete_experiment_items)  s*    . $$<<Ve<f	~~r'   c                T    | j                   j                  ||      }|j                  S )a  
        Delete experiments by id

        Parameters
        ----------
        ids : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.delete_experiments_by_id(ids=['ids'], )
        rf   r"   delete_experiments_by_idr7   ri   s       r%   rl   z*ExperimentsClient.delete_experiments_by_idC  s*    . $$==#Wf=g	~~r'   experiment_idr0   experiment_nameitemsrn   c                Z    | j                   j                  |||||      }|j                  S )a  
        Record experiment items in bulk with traces, spans, and feedback scores. Maximum request size is 4MB.

        Parameters
        ----------
        experiment_name : str

        dataset_name : str

        items : typing.Sequence[ExperimentItemBulkRecordExperimentItemBulkWriteView]

        experiment_id : typing.Optional[str]
            Optional experiment ID. If provided, items will be added to the existing experiment and experimentName will be ignored. If not provided or experiment with that ID doesn't exist, a new experiment will be created with the given experimentName

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import ExperimentItemBulkRecordExperimentItemBulkWriteView
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.experiment_items_bulk(experiment_name='experiment_name', dataset_name='dataset_name', items=[ExperimentItemBulkRecordExperimentItemBulkWriteView(dataset_item_id='dataset_item_id', )], )
        ro   rO   rp   rn   r0   r"   experiment_items_bulkr7   r$   ro   rO   rp   rn   r0   r9   s          r%   rt   z'ExperimentsClient.experiment_items_bulk]  s;    J $$::+%'+ ; 
	 ~~r'   rG   r0   c                T    | j                   j                  ||      }|j                  S )a"  
        Find Feedback Score names

        Parameters
        ----------
        experiment_ids : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        FeedbackScoreNamesPublic
            Feedback Scores resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.find_feedback_score_names()
        rv   r"   find_feedback_score_namesr7   r$   rG   r0   r9   s       r%   ry   z+ExperimentsClient.find_feedback_score_names  s0    0 $$>>)? ? 
	 ~~r'   groupsr?   r@   rC   rD   rF   r0   r|   c          	      ^    | j                   j                  |||||||      }|j                  S )a  
        Find experiments grouped by specified fields

        Parameters
        ----------
        groups : typing.Optional[str]

        types : typing.Optional[str]

        name : typing.Optional[str]

        project_id : typing.Optional[str]

        project_deleted : typing.Optional[bool]

        filters : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ExperimentGroupResponse
            Experiment groups

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.find_experiment_groups()
        r{   r"   find_experiment_groupsr7   	r$   r|   r?   r@   rC   rD   rF   r0   r9   s	            r%   r   z(ExperimentsClient.find_experiment_groups  sA    T $$;;!++ < 
	 ~~r'   c          	      ^    | j                   j                  |||||||      }|j                  S )a5  
        Find experiments grouped by specified fields with aggregation metrics

        Parameters
        ----------
        groups : typing.Optional[str]

        types : typing.Optional[str]

        name : typing.Optional[str]

        project_id : typing.Optional[str]

        project_deleted : typing.Optional[bool]

        filters : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ExperimentGroupAggregationsResponse
            Experiment groups with aggregations

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.find_experiment_groups_aggregations()
        r{   r"   #find_experiment_groups_aggregationsr7   r   s	            r%   r   z5ExperimentsClient.find_experiment_groups_aggregations  sB    T $$HH!++ I 
	 ~~r'   c                T    | j                   j                  ||      }|j                  S )a  
        Finish experiments and trigger alert events

        Parameters
        ----------
        ids : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.finish_experiments(ids=['ids'], )
        rf   r"   finish_experimentsr7   ri   s       r%   r   z$ExperimentsClient.finish_experiments  s*    . $$77CQ`7a	~~r'   c                T    | j                   j                  ||      }|j                  S )a  
        Get experiment by id

        Parameters
        ----------
        id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ExperimentPublic
            Experiment resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.get_experiment_by_id(id='id', )
        r^   r"   get_experiment_by_idr7   r$   rN   r0   r9   s       r%   r   z&ExperimentsClient.get_experiment_by_id,  s)    0 $$99"o9^	~~r'   	r@   rQ   rR   tags_to_addtags_to_removerS   rU   rV   r0   r   r   c       	         d    | j                   j                  |||||||||	|

      }|j                  S )a  
        Update experiment by id

        Parameters
        ----------
        id : str

        name : typing.Optional[str]

        metadata : typing.Optional[JsonNode]

        tags : typing.Optional[typing.Sequence[str]]
            Tags

        tags_to_add : typing.Optional[typing.Sequence[str]]
            Tags to add

        tags_to_remove : typing.Optional[typing.Sequence[str]]
            Tags to remove

        type : typing.Optional[ExperimentUpdateType]

        status : typing.Optional[ExperimentUpdateStatus]
            The status of the experiment

        experiment_scores : typing.Optional[typing.Sequence[ExperimentScore]]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.update_experiment(id='id', )
        r   r"   update_experimentr7   r$   rN   r@   rQ   rR   r   r   rS   rU   rV   r0   r9   s               r%   r   z#ExperimentsClient.update_experimentG  sJ    l $$66#)/+ 7 
	 ~~r'   c                T    | j                   j                  ||      }|j                  S )a
  
        Get experiment item by id

        Parameters
        ----------
        id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ExperimentItemPublic
            Experiment item resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.experiments.get_experiment_item_by_id(id='id', )
        r^   r"   get_experiment_item_by_idr7   r   s       r%   r   z+ExperimentsClient.get_experiment_item_by_id  s*    0 $$>>rSb>c	~~r'   limitlast_retrieved_idtruncater0   r   r   r   c             #      K   | j                   j                  |||||      5 }|j                  E d{    ddd       y7 # 1 sw Y   yxY ww)a  
        Stream experiment items

        Parameters
        ----------
        experiment_name : str

        limit : typing.Optional[int]

        last_retrieved_id : typing.Optional[str]

        truncate : typing.Optional[bool]
            Truncate image included in either input, output or metadata

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Returns
        -------
        typing.Iterator[bytes]
            Experiment items stream or error during process
        ro   r   r   r   r0   Nr"   stream_experiment_itemsr7   )r$   ro   r   r   r   r0   rs          r%   r   z)ExperimentsClient.stream_experiment_items  s\     > 55+/+ 6 
 vv
 
 
 
s+   !AAAA	AAAAr   r   r0   c             #      K   | j                   j                  ||||      5 }|j                  E d{    ddd       y7 # 1 sw Y   yxY ww)a  
        Stream experiments

        Parameters
        ----------
        name : str

        limit : typing.Optional[int]

        last_retrieved_id : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Returns
        -------
        typing.Iterator[bytes]
            Experiments stream or error during process
        r@   r   r   r0   Nr"   stream_experimentsr7   )r$   r@   r   r   r0   r   s         r%   r   z$ExperimentsClient.stream_experiments  sV     6 00U6GYh 1 
vv
 
 
 
s+    AAA A	A AAA)5__name__
__module____qualname__r   r&   propertyr   r,   OMITtypingSequencestrr   Optionalboolr   r6   intr   rK   r   r   r   r   r   r   r\   r	   rc   rh   rl   r
   rt   r   ry   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Iteratorbytesr   r    r'   r%   r   r   "   s   O*; O  #7     -1;?& __S!& !	&
 OOD)&  8& 
&V &*%)+/04&*%)15*.+/15(,(,/3/3;?#S ooc"S ooc"	S
 OOC(S  -S s#S ooc"S  .S ??3'S OOC(S  .S %S %S ,S  t,!S"  8#S$ 
%Sp $(-1+/-1%)9=6:59NR049=TXBFTX37;?%Y OOC Y ooc*	Y
 OOC(Y ooc*Y ooc"Y //"56Y oofooc23Y oo12Y "??+JKY  -Y  56Y "??6??;O+PQY (>?Y   9O)PQ!Y" #OOC0#Y$  8%Y& 
'Y~ <@	 !//.9  8	
 
B `dooc*=C__^=\	6 `dooc*=C__^=\	@ /3;?, , 	,
 RS, s+,  8, 
,^ 9=qu!'!5OU_mOn	!@ (,&*%)+/15(,;?3 $3 s#	3
 ooc"3 OOC(3  .3 %3  83 
!3p (,&*%)+/15(,;?3 $3 s#	3
 ooc"3 OOC(3  .3 %3  83 
-3l `dooc*=C__^=\	6 NR+1??>+J	> &*.26:=A@D6::>OS;?BB ooc"	B
 //(+B oofooc23B __V__S%9:B (<=B oo23B  67B "??6???+KLB  8B 
BJ NR+1??>+J	> '+26*.;?& & s#	&
 "??3/& //$'&  8& 
	&X '+26;?  s#	
 "??3/  8 
	r'   r   c            #          e Zd ZdefdZedefd       Zeddde	j                  e   ded	e	j                  e   d
e	j                  e   ddf
dZddddddddddddddddde	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   d
e	j                  e   def dZeeeeeeeeeeeeeeeddde	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   d e	j                  e   d!e	j                  e	j                  e      d"e	j                  e   d#e	j                  e   de	j                  e   d$e	j                  e   d%e	j                  e	j                  e      d&e	j                  e   d'e	j                  e	j                  e      d(e	j                  e   d
e	j                  e   ddf"d)Zdd*d+e	j                  e   d
e	j                  e   ddfd,Zdd*de	j                  e   d
e	j                  e   ddfd-Zdd*de	j                  e   d
e	j                  e   ddfd.Zedd/d0eded1e	j                  e   d2e	j                  e   d
e	j                  e   ddfd3Z ddd4de	j                  e   d
e	j                  e   de!fd5Z"dddddddd6d7e	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   d
e	j                  e   de#fd8Z$dddddddd6d7e	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e   d
e	j                  e   de%fd9Z&dd*de	j                  e   d
e	j                  e   ddfd:Z'dd*ded
e	j                  e   de(fd;Z)eeeeeeeedd<	dede	j                  e   d e	j                  e*   d!e	j                  e	j                  e      d=e	j                  e	j                  e      d>e	j                  e	j                  e      d"e	j                  e+   d$e	j                  e,   d%e	j                  e	j                  e-      d
e	j                  e   ddfd?Z.dd*ded
e	j                  e   de/fd@Z0eeeddAd0edBe	j                  e   dCe	j                  e   dDe	j                  e   d
e	j                  e   de	jb                  e2   fdEZ3eeddFdedBe	j                  e   dCe	j                  e   d
e	j                  e   de	jb                  e2   f
dGZ4y)HAsyncExperimentsClientr   c                &    t        |      | _        y r!   )r   r"   r#   s     r%   r&   zAsyncExperimentsClient.__init__  s    4NSr'   r(   c                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawExperimentsClient
        r*   r+   s    r%   r,   z(AsyncExperimentsClient.with_raw_response  r-   r'   Nr.   r1   r2   r/   r0   c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)a~  
        Update multiple experiments

        Parameters
        ----------
        ids : typing.Sequence[str]
            List of experiment IDs to update (max 1000)

        update : ExperimentUpdate

        merge_tags : typing.Optional[bool]
            If true, merge tags with existing tags instead of replacing them. Default: false

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import ExperimentUpdate
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.batch_update_experiments(ids=['ids'], update=ExperimentUpdate(), )
        asyncio.run(main())
        r4   Nr5   r8   s         r%   r6   z/AsyncExperimentsClient.batch_update_experiments  sD     L **CCFz? D 
 
	 ~~
s   #868r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   c                   K   | j                   j                  |||||||||	|
|||||       d{   }|j                  S 7 w)a  
        Find experiments

        Parameters
        ----------
        page : typing.Optional[int]

        size : typing.Optional[int]

        dataset_id : typing.Optional[str]

        optimization_id : typing.Optional[str]

        types : typing.Optional[str]

        name : typing.Optional[str]

        dataset_deleted : typing.Optional[bool]

        prompt_id : typing.Optional[str]

        project_id : typing.Optional[str]

        project_deleted : typing.Optional[bool]

        sorting : typing.Optional[str]

        filters : typing.Optional[str]

        experiment_ids : typing.Optional[str]

        force_sorting : typing.Optional[bool]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ExperimentPagePublic
            Experiments resource

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.find_experiments()
        asyncio.run(main())
        r:   NrJ   rL   s                    r%   rK   z'AsyncExperimentsClient.find_experiments)  sg     J **;;!++!+)'+ < 
 
	" ~~#
s   .AAArM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   c                   K   | j                   j                  |||||||||	|
||||||       d{   }|j                  S 7 w)a  
        Create experiment

        Parameters
        ----------
        id : typing.Optional[str]

        dataset_name : typing.Optional[str]

        project_id : typing.Optional[str]
            Project ID. Takes precedence over project_name when both are provided.

        project_name : typing.Optional[str]
            Project name. Creates project if it doesn't exist. Ignored when project_id is provided.

        name : typing.Optional[str]

        metadata : typing.Optional[JsonListStringWrite]

        tags : typing.Optional[typing.Sequence[str]]

        type : typing.Optional[ExperimentWriteType]

        evaluation_method : typing.Optional[ExperimentWriteEvaluationMethod]

        optimization_id : typing.Optional[str]

        status : typing.Optional[ExperimentWriteStatus]

        experiment_scores : typing.Optional[typing.Sequence[ExperimentScoreWrite]]

        prompt_version : typing.Optional[PromptVersionLinkWrite]

        prompt_versions : typing.Optional[typing.Sequence[PromptVersionLinkWrite]]

        dataset_version_id : typing.Optional[str]
            ID of the dataset version this experiment is linked to. If not provided at creation, experiment will be automatically linked to the latest version.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.create_experiment()
        asyncio.run(main())
        rM   Nr[   r]   s                     r%   r\   z(AsyncExperimentsClient.create_experiment  sj     T **<<%!%/+/)+1+! = 
 
	$ ~~%
s   /AAAr^   r_   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a  
        Create experiment items

        Parameters
        ----------
        experiment_items : typing.Sequence[ExperimentItem]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import ExperimentItem
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.create_experiment_items(experiment_items=[ExperimentItem(experiment_id='experiment_id', dataset_item_id='dataset_item_id', trace_id='trace_id', )], )
        asyncio.run(main())
        ra   Nrb   rd   s       r%   rc   z.AsyncExperimentsClient.create_experiment_items  s?     < **BB- C 
 
	 ~~
   !646c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)aP  
        Delete experiment items

        Parameters
        ----------
        ids : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.delete_experiment_items(ids=['ids'], )
        asyncio.run(main())
        rf   Nrg   ri   s       r%   rh   z.AsyncExperimentsClient.delete_experiment_items  s7     4 **BBs\kBll	~~ mr   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)aR  
        Delete experiments by id

        Parameters
        ----------
        ids : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.delete_experiments_by_id(ids=['ids'], )
        asyncio.run(main())
        rf   Nrk   ri   s       r%   rl   z/AsyncExperimentsClient.delete_experiments_by_id  s7     4 **CC]lCmm	~~ nr   rm   ro   rp   rn   c                v   K   | j                   j                  |||||       d{   }|j                  S 7 w)a  
        Record experiment items in bulk with traces, spans, and feedback scores. Maximum request size is 4MB.

        Parameters
        ----------
        experiment_name : str

        dataset_name : str

        items : typing.Sequence[ExperimentItemBulkRecordExperimentItemBulkWriteView]

        experiment_id : typing.Optional[str]
            Optional experiment ID. If provided, items will be added to the existing experiment and experimentName will be ignored. If not provided or experiment with that ID doesn't exist, a new experiment will be created with the given experimentName

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import ExperimentItemBulkRecordExperimentItemBulkWriteView
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.experiment_items_bulk(experiment_name='experiment_name', dataset_name='dataset_name', items=[ExperimentItemBulkRecordExperimentItemBulkWriteView(dataset_item_id='dataset_item_id', )], )
        asyncio.run(main())
        rr   Nrs   ru   s          r%   rt   z,AsyncExperimentsClient.experiment_items_bulk<  sJ     P **@@+%'+ A 
 
	 ~~
s   $979rv   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a  
        Find Feedback Score names

        Parameters
        ----------
        experiment_ids : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        FeedbackScoreNamesPublic
            Feedback Scores resource

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.find_feedback_score_names()
        asyncio.run(main())
        rv   Nrx   rz   s       r%   ry   z0AsyncExperimentsClient.find_feedback_score_namesm  s?     6 **DD)? E 
 
	 ~~
r   r{   r|   c          	      z   K   | j                   j                  |||||||       d{   }|j                  S 7 w)aZ  
        Find experiments grouped by specified fields

        Parameters
        ----------
        groups : typing.Optional[str]

        types : typing.Optional[str]

        name : typing.Optional[str]

        project_id : typing.Optional[str]

        project_deleted : typing.Optional[bool]

        filters : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ExperimentGroupResponse
            Experiment groups

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.find_experiment_groups()
        asyncio.run(main())
        r{   Nr~   r   s	            r%   r   z-AsyncExperimentsClient.find_experiment_groups  sP     Z **AA!++ B 
 
	 ~~
   &;9;c          	      z   K   | j                   j                  |||||||       d{   }|j                  S 7 w)a  
        Find experiments grouped by specified fields with aggregation metrics

        Parameters
        ----------
        groups : typing.Optional[str]

        types : typing.Optional[str]

        name : typing.Optional[str]

        project_id : typing.Optional[str]

        project_deleted : typing.Optional[bool]

        filters : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ExperimentGroupAggregationsResponse
            Experiment groups with aggregations

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.find_experiment_groups_aggregations()
        asyncio.run(main())
        r{   Nr   r   s	            r%   r   z:AsyncExperimentsClient.find_experiment_groups_aggregations  sP     Z **NN!++ O 
 
	 ~~
r   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a_  
        Finish experiments and trigger alert events

        Parameters
        ----------
        ids : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.finish_experiments(ids=['ids'], )
        asyncio.run(main())
        rf   Nr   ri   s       r%   r   z)AsyncExperimentsClient.finish_experiments  s7     4 **==#Wf=gg	~~ hr   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a`  
        Get experiment by id

        Parameters
        ----------
        id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ExperimentPublic
            Experiment resource

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.get_experiment_by_id(id='id', )
        asyncio.run(main())
        r^   Nr   r   s       r%   r   z+AsyncExperimentsClient.get_experiment_by_id  s7     6 **??Tc?dd	~~ er   r   r   r   c       	            K   | j                   j                  |||||||||	|

       d{   }|j                  S 7 w)af  
        Update experiment by id

        Parameters
        ----------
        id : str

        name : typing.Optional[str]

        metadata : typing.Optional[JsonNode]

        tags : typing.Optional[typing.Sequence[str]]
            Tags

        tags_to_add : typing.Optional[typing.Sequence[str]]
            Tags to add

        tags_to_remove : typing.Optional[typing.Sequence[str]]
            Tags to remove

        type : typing.Optional[ExperimentUpdateType]

        status : typing.Optional[ExperimentUpdateStatus]
            The status of the experiment

        experiment_scores : typing.Optional[typing.Sequence[ExperimentScore]]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.update_experiment(id='id', )
        asyncio.run(main())
        r   Nr   r   s               r%   r   z(AsyncExperimentsClient.update_experiment8  sX     r **<<#)/+ = 
 
	 ~~
s   )><>c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)as  
        Get experiment item by id

        Parameters
        ----------
        id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ExperimentItemPublic
            Experiment item resource

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.experiments.get_experiment_item_by_id(id='id', )
        asyncio.run(main())
        r^   Nr   r   s       r%   r   z0AsyncExperimentsClient.get_experiment_item_by_id  s7     6 **DDRYhDii	~~ jr   r   r   r   r   c                  K   | j                   j                  |||||      4 d{   }|j                  2 3 d{   }| 7 7 6 ddd      d{  7   y# 1 d{  7  sw Y   yxY ww)a  
        Stream experiment items

        Parameters
        ----------
        experiment_name : str

        limit : typing.Optional[int]

        last_retrieved_id : typing.Optional[str]

        truncate : typing.Optional[bool]
            Truncate image included in either input, output or metadata

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Returns
        -------
        typing.AsyncIterator[bytes]
            Experiment items stream or error during process
        r   Nr   )r$   ro   r   r   r   r0   r   r7   s           r%   r   z.AsyncExperimentsClient.stream_experiment_items  st     > ##;;+/+ < 
 
 ff d

f
 
 
 
 
se   %A3AA3AAA	A AA3	AAA3AA3A0$A'%A0,A3r   c                  K   | j                   j                  ||||      4 d{   }|j                  2 3 d{   }| 7 7 6 ddd      d{  7   y# 1 d{  7  sw Y   yxY ww)a  
        Stream experiments

        Parameters
        ----------
        name : str

        limit : typing.Optional[int]

        last_retrieved_id : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Returns
        -------
        typing.AsyncIterator[bytes]
            Experiments stream or error during process
        r   Nr   )r$   r@   r   r   r0   r   r7   s          r%   r   z)AsyncExperimentsClient.stream_experiments  sn     6 ##66U6GYh 7 
 
ff d
	
f
 
 
 
 
sd   $A2AA2AA
AA
AA2A

AA2AA2A/#A&$A/+A2)5r   r   r   r   r&   r   r   r,   r   r   r   r   r   r   r   r   r6   r   r   rK   r   r   r   r   r   r   r\   r	   rc   rh   rl   r
   rt   r   ry   r   r   r   r   r   r   r   r   r   r   r   r   r   r   AsyncIteratorr   r   r   r   r'   r%   r   r     s   T*< T  #<     -1;?) __S!) !	)
 OOD))  8) 
)\ &*%)+/04&*%)15*.+/15(,(,/3/3;?#V ooc"V ooc"	V
 OOC(V  -V s#V ooc"V  .V ??3'V OOC(V  .V %V %V ,V  t,!V"  8#V$ 
%Vv $(-1+/-1%)9=6:59NR049=TXBFTX37;?%\ OOC \ ooc*	\
 OOC(\ ooc*\ ooc"\ //"56\ oofooc23\ oo12\ "??+JK\  -\  56\ "??6??;O+PQ\ (>?\   9O)PQ!\" #OOC0#\$  8%\& 
'\D <@	! !//.9!  8	!
 
!H `dooc*=C__^=\	< `dooc*=C__^=\	F /3;?/ / 	/
 RS/ s+/  8/ 
/d 9=qu!'!5OU_mOn	!F (,&*%)+/15(,;?6 $6 s#	6
 ooc"6 OOC(6  .6 %6  86 
!6v (,&*%)+/15(,;?6 $6 s#	6
 ooc"6 OOC(6  .6 %6  86 
-6r `dooc*=C__^=\	< NR+1??>+J	D &*.26:=A@D6::>OS;?EE ooc"	E
 //(+E oofooc23E __V__S%9:E (<=E oo23E  67E "??6???+KLE  8E 
EP NR+1??>+J	D '+26*.;?' ' s#	'
 "??3/' //$''  8' 
		e	$'Z '+26;?  s#	
 "??3/  8 
		e	$r'   r   )4r   core.client_wrapperr   r   core.request_optionsr   ,types.experiment_group_aggregations_responser   types.experiment_group_responser   types.experiment_itemr	   Atypes.experiment_item_bulk_record_experiment_item_bulk_write_viewr
   types.experiment_item_publicr   types.experiment_page_publicr   types.experiment_publicr   types.experiment_scorer   types.experiment_score_writer   types.experiment_updater   types.experiment_update_statusr   types.experiment_update_typer   !types.feedback_score_names_publicr   types.json_list_string_writer   types.json_noder   types.prompt_version_link_writer   
raw_clientr   r   (types.experiment_write_evaluation_methodr   types.experiment_write_statusr   types.experiment_write_typer   castAnyr   r   r   r   r'   r%   <module>r      s     G 1 ^ E 2 @ ? 6 4 ? 6 C ? H > & D G U @ < v{{6::s#J JZv vr'   