
    j~t                       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' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3m4Z4 ddl5m6Z6 ddl7m8Z8 ddl9m:Z:  e jv                  e jx                  d       Z= G d! d"      Z> G d# d$      Z?y)%    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)DatasetExpansionResponse)DatasetExportJobPublic)DatasetItemChangesPublic)DatasetItemFilter)DatasetItemPageCompare)DatasetItemPagePublic)DatasetItemPublic)DatasetItemUpdate)DatasetItemWrite)DatasetItemWriteSource)DatasetPagePublic)DatasetPublic)DatasetVersionDiff)DatasetVersionPagePublic)DatasetVersionPublic)EvaluatorItemWrite)ExecutionPolicyWrite)JsonNode)PageColumns)ProjectStatsPublic)SpanEnrichmentOptions)TraceEnrichmentOptions   )AsyncRawDatasetsClientRawDatasetsClient)DatasetUpdateVisibility)DatasetWriteType)DatasetWriteVisibility.c                      e Zd ZdefdZedefd       Zddddede	d	e
j                  e   d
e
j                  e   def
dZeeeeddd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   ddfdZ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fdZeeeeeeeddd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dfd#Z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dfd(Zdd)d*e
j:                  ee
j                  e
j<                     f   ded
e
j                  e   ddfd+Zdd)ded,e
j$                  e   d-e d
e
j                  e   ddf
d.Z!dd)ded/e
j$                  e   d-e"d
e
j                  e   ddf
d0Z#dd)ded
e
j                  e   de$fd1Z%eeedd2deded"e
j                  e   d e
j                  e&   d!e
j                  e
j$                  e      d
e
j                  e   ddfd3Z'dd)ded
e
j                  e   ddfd4Z(edd5d&ede
j                  e   d
e
j                  e   ddfd6Z)eeeedd7d8e
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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
jX                  e-   fd<Z.eeeedd=ded>ed?e
j                  e   d@e
j                  e
j$                  e      dAe
j                  e   dBe
j                  e   d
e
j                  e   de/fdCZ0ddddddddDdedEede
j                  e   de
j                  e   de
j                  e   de
j                  e   dFe
j                  e   dGe
j                  e   d
e
j                  e   de1fdHZ2edd5d&ede
j                  e   d
e
j                  e   de$fdIZ3dddJdedEede
j                  e   d
e
j                  e   de4f
dKZ5dd)d;ed
e
j                  e   de6fdLZ7dd)d
e
j                  e   de
jp                  e6   fdMZ9dd)dNed
e
j                  e   de:fdOZ;eeeeeeeddPdNedQe<dRe=de
j                  e   dSe
j                  e   dTe
j                  e   d"e
j                  e   d!e
j                  e
j$                  e      dUe
j                  e
j$                  e>      dVe
j                  e?   d
e
j                  e   ddfdWZ@dddddddXdede
j                  e   de
j                  e   dYe
j                  e   de
j                  e   dGe
j                  e   d
e
j                  e   deAfdZZBddd[dedEe
j                  e   d
e
j                  e   deCfd\ZDdd)d;ed
e
j                  e   ddfd]ZEdd)ded
e
j                  e   de6fd^ZFeeeeedd_d&ed`e
j                  e   dae
j                  e   dbe
j                  e   de
j                  e   de
j                  e   d
e
j                  e   de
jX                  e-   fdcZGdd)ded
e
j                  e   deHfddZIdd)dedeedfed
e
j                  e   ddf
dgZJdd)dedeedfed
e
j                  e   ddf
dhZKddddidede
j                  e   de
j                  e   d
e
j                  e   deLf
djZMdd)dedked
e
j                  e   defdlZNdd)dedmed
e
j                  e   defdnZOeeddodedeedpe
j                  e   dqe
j                  e
j$                  e      d
e
j                  e   defdrZPy)sDatasetsClientclient_wrapperc                &    t        |      | _        y N)r%   )r   _raw_clientselfr%   s     v/Users/manta/Documents/Projects/TheRoad-I1/backend/.venv/lib/python3.12/site-packages/opik/rest_api/datasets/client.py__init__zDatasetsClient.__init__'   s    ,NK    returnc                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawDatasetsClient
        r(   r*   s    r+   with_raw_responsez DatasetsClient.with_raw_response*        r-   Noverriderequest_optionsidrequestr5   r6   c                X    | j                   j                  ||||      }|j                  S )a  
        Apply delta changes (add, edit, delete) to a dataset version with conflict detection.

        This endpoint:
        - Creates a new version with the applied changes
        - Validates that baseVersion matches the latest version (unless override=true)
        - Returns 409 Conflict if baseVersion is stale and override is not set

        Use `override=true` query parameter to force version creation even with stale baseVersion.

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

        request : DatasetItemChangesPublic

        override : typing.Optional[bool]

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

        Returns
        -------
        DatasetVersionPublic
            Version created successfully

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.apply_dataset_item_changes(id='id', request={'key': 'value'
        }, )
        r8   r5   r6   r(   apply_dataset_item_changesdatar*   r7   r8   r5   r6   	_responses         r+   r<   z)DatasetsClient.apply_dataset_item_changes5   s6    R $$??(O @ 
	 ~~r-   idsfilters
dataset_id
merge_tagsr6   updaterA   rB   rC   rD   c                \    | j                   j                  ||||||      }|j                  S )aA  
        Update multiple dataset items

        Parameters
        ----------
        update : DatasetItemUpdate

        ids : typing.Optional[typing.Sequence[str]]
            List of dataset item IDs to update (max 1000). Mutually exclusive with 'filters'.

        filters : typing.Optional[typing.Sequence[DatasetItemFilter]]

        dataset_id : typing.Optional[str]
            Dataset ID. Required when using 'filters', optional when using 'ids'.

        merge_tags : typing.Optional[bool]
            If true, merge tags with existing tags instead of replacing them. Default: false. When using 'filters', this is automatically set to true.

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import DatasetItemUpdate
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.batch_update_dataset_items(update=DatasetItemUpdate(), )
        rE   rA   rB   rC   rD   r6   r(   batch_update_dataset_itemsr=   r*   rE   rA   rB   rC   rD   r6   r?   s           r+   rI   z)DatasetsClient.batch_update_dataset_itemsc   s?    T $$??!!+ @ 
	 ~~r-   
pagesizewith_experiments_onlywith_optimizations_only	prompt_id
project_idnamesortingrB   r6   rL   rM   rN   rO   rP   rQ   rR   rS   c       
         d    | j                   j                  |||||||||	|

      }|j                  S )aM  
        Find datasets

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

        size : typing.Optional[int]

        with_experiments_only : typing.Optional[bool]

        with_optimizations_only : typing.Optional[bool]

        prompt_id : typing.Optional[str]

        project_id : typing.Optional[str]

        name : typing.Optional[str]

        sorting : typing.Optional[str]

        filters : typing.Optional[str]

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

        Returns
        -------
        DatasetPagePublic
            Dataset resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.find_datasets()
        rK   r(   find_datasetsr=   r*   rL   rM   rN   rO   rP   rQ   rR   rS   rB   r6   r?   s               r+   rV   zDatasetsClient.find_datasets   sJ    f $$22"7$;!+ 3 
	 ~~r-   r7   rQ   project_nametype
visibilitytagsdescriptionr6   rY   rZ   r[   r\   r]   c       	         b    | j                   j                  |||||||||		      }
|
j                  S )ad  
        Create dataset

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

        id : typing.Optional[str]

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

        project_name : typing.Optional[str]
            For project scope, specify either project_id or project_name. If project_name is provided and the project does not exist, it will be created. Ignored when project_id is provided. If neither is provided, the dataset is created at workspace level.

        type : typing.Optional[DatasetWriteType]

        visibility : typing.Optional[DatasetWriteVisibility]

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

        description : typing.Optional[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.datasets.create_dataset(name='name', )
        	rR   r7   rQ   rY   rZ   r[   r\   r]   r6   r(   create_datasetr=   r*   rR   r7   rQ   rY   rZ   r[   r\   r]   r6   r?   s              r+   ra   zDatasetsClient.create_dataset   sG    b $$33!%!#+ 4 

	 ~~r-   dataset_namerC   batch_group_idr6   itemsrd   re   c                Z    | j                   j                  |||||      }|j                  S )a  
        Create/update dataset items based on dataset item id

        Parameters
        ----------
        items : typing.Sequence[DatasetItemWrite]

        dataset_name : typing.Optional[str]
            If null, dataset_id must be provided

        dataset_id : typing.Optional[str]
            If null, dataset_name must be provided

        batch_group_id : typing.Optional[str]
            Optional batch group ID to group multiple batches into a single dataset version. If null, mutates the latest version instead of creating a new one.

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import DatasetItemWrite
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.create_or_update_dataset_items(items=[DatasetItemWrite(source="manual", data={'key': 'value'
        }, )], )
        rf   rd   rC   re   r6   r(   create_or_update_dataset_itemsr=   r*   rf   rd   rC   re   r6   r?   s          r+   rj   z-DatasetsClient.create_or_update_dataset_items  s<    P $$CC%!)+ D 
	 ~~r-   r6   filec                V    | j                   j                  |||      }|j                  S )a  
        Create dataset items from uploaded CSV file. CSV should have headers in the first row. Processing happens asynchronously in batches.

        Parameters
        ----------
        file : typing.Dict[str, typing.Optional[typing.Any]]

        dataset_id : 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.datasets.create_dataset_items_from_csv(file={'key': 'value'
        }, dataset_id='dataset_id', )
        rm   rC   r6   r(   create_dataset_items_from_csvr=   r*   rm   rC   r6   r?   s        r+   rq   z,DatasetsClient.create_dataset_items_from_csvG  s3    < $$BB*o C 
	 ~~r-   span_idsenrichment_optionsc                X    | j                   j                  ||||      }|j                  S )a  
        Create dataset items from spans with enriched metadata

        Parameters
        ----------
        dataset_id : str

        span_ids : typing.Sequence[str]
            Set of span IDs to add to the dataset

        enrichment_options : SpanEnrichmentOptions

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import SpanEnrichmentOptions
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.create_dataset_items_from_spans(dataset_id='dataset_id', span_ids=['span_ids'], enrichment_options=SpanEnrichmentOptions(), )
        rs   rt   r6   r(   create_dataset_items_from_spansr=   r*   rC   rs   rt   r6   r?   s         r+   rx   z.DatasetsClient.create_dataset_items_from_spansj  s8    D $$DD>Pbq E 
	 ~~r-   	trace_idsc                X    | j                   j                  ||||      }|j                  S )a  
        Create dataset items from traces with enriched metadata

        Parameters
        ----------
        dataset_id : str

        trace_ids : typing.Sequence[str]
            Set of trace IDs to add to the dataset

        enrichment_options : TraceEnrichmentOptions

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import TraceEnrichmentOptions
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.create_dataset_items_from_traces(dataset_id='dataset_id', trace_ids=['trace_ids'], enrichment_options=TraceEnrichmentOptions(), )
        rz   rt   r6   r(    create_dataset_items_from_tracesr=   r*   rC   rz   rt   r6   r?   s         r+   r~   z/DatasetsClient.create_dataset_items_from_traces  s8    D $$EE)@Rds F 
	 ~~r-   c                T    | j                   j                  ||      }|j                  S )a  
        Get dataset by id

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

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

        Returns
        -------
        DatasetPublic
            Dataset resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.get_dataset_by_id(id='id', )
        rl   r(   get_dataset_by_idr=   r*   r7   r6   r?   s       r+   r   z DatasetsClient.get_dataset_by_id  s)    , $$66r?6[	~~r-   r]   r[   r\   r6   c                \    | j                   j                  ||||||      }|j                  S )a  
        Update dataset by id

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

        name : str

        description : typing.Optional[str]

        visibility : typing.Optional[DatasetUpdateVisibility]

        tags : typing.Optional[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.datasets.update_dataset(id='id', name='name', )
        rR   r]   r[   r\   r6   r(   update_datasetr=   r*   r7   rR   r]   r[   r\   r6   r?   s           r+   r   zDatasetsClient.update_dataset  s;    L $$33T{zPTfu 4 
	 ~~r-   c                T    | j                   j                  ||      }|j                  S )a  
        Delete dataset by id

        Parameters
        ----------
        id : 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.datasets.delete_dataset(id='id', )
        rl   r(   delete_datasetr=   r   s       r+   r   zDatasetsClient.delete_dataset  s)    * $$33B3X	~~r-   rY   r6   c                V    | j                   j                  |||      }|j                  S )a  
        Delete dataset by name

        Parameters
        ----------
        dataset_name : str

        project_name : typing.Optional[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.datasets.delete_dataset_by_name(dataset_name='dataset_name', )
        rd   rY   r6   r(   delete_dataset_by_namer=   r*   rd   rY   r6   r?   s        r+   r   z%DatasetsClient.delete_dataset_by_name  s3    : $$;;%LRa < 
	 ~~r-   item_idsrC   rB   re   r6   r   c                Z    | j                   j                  |||||      }|j                  S )aU  
        Delete dataset items using one of two modes:
        1. **Delete by IDs**: Provide 'item_ids' to delete specific items by their IDs
        2. **Delete by filters**: Provide 'dataset_id' with optional 'filters' to delete items matching criteria

        When using filters, an empty 'filters' array will delete all items in the specified dataset.

        Parameters
        ----------
        item_ids : typing.Optional[typing.Sequence[str]]
            List of dataset item IDs to delete (max 1000). Use this to delete specific items by their IDs. Mutually exclusive with 'dataset_id' and 'filters'.

        dataset_id : typing.Optional[str]
            Dataset ID to scope the deletion. Required when using 'filters'. Mutually exclusive with 'item_ids'.

        filters : typing.Optional[typing.Sequence[DatasetItemFilter]]
            Filters to select dataset items to delete within the specified dataset. Must be used with 'dataset_id'. Mutually exclusive with 'item_ids'. Empty array means 'delete all items in the dataset'.

        batch_group_id : typing.Optional[str]
            Optional batch group ID to group multiple delete operations into a single dataset version. If null, mutates the latest version instead of creating a new one.

        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.datasets.delete_dataset_items()
        r   r(   delete_dataset_itemsr=   r*   r   rC   rB   re   r6   r?   s          r+   r   z#DatasetsClient.delete_dataset_items6  s;    V $$99!)+ : 
	 ~~r-   c                T    | j                   j                  ||      }|j                  S )a  
        Delete datasets batch

        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.datasets.delete_datasets_batch(ids=['ids'], )
        rA   r6   r(   delete_datasets_batchr=   r*   rA   r6   r?   s       r+   r   z$DatasetsClient.delete_datasets_batchj  s*    . $$::sTc:d	~~r-   job_idc             #      K   | j                   j                  ||      5 }|j                  E d{    ddd       y7 # 1 sw Y   yxY ww)a  
        Downloads the exported CSV file for a completed export job. This endpoint proxies the file download to avoid exposing internal storage URLs.

        Parameters
        ----------
        job_id : 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]
            CSV file content

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.download_dataset_export(job_id='jobId', )
        rl   Nr(   download_dataset_exportr=   )r*   r   r6   rs       r+   r   z&DatasetsClient.download_dataset_export  sG     0 55fo5^bcvv _^ _^s)   AA >A 	AA  A	Asample_countpreserve_fieldsvariation_instructionscustom_promptr6   modelr   r   r   r   c          	      ^    | j                   j                  |||||||      }|j                  S )a\  
        Generate synthetic dataset samples using LLM based on existing data patterns

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

        model : str
            The model to use for synthetic data generation

        sample_count : typing.Optional[int]
            Number of synthetic samples to generate

        preserve_fields : typing.Optional[typing.Sequence[str]]
            Fields to preserve patterns from original data

        variation_instructions : typing.Optional[str]
            Additional instructions for data variation

        custom_prompt : typing.Optional[str]
            Custom prompt to use for generation instead of auto-generated one

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

        Returns
        -------
        DatasetExpansionResponse
            Generated synthetic samples

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.expand_dataset(id='id', model='gpt-4', )
        r   r   r   r   r   r6   r(   expand_datasetr=   	r*   r7   r   r   r   r   r   r6   r?   s	            r+   r   zDatasetsClient.expand_dataset  sA    ^ $$33%+#9'+ 4 
	 ~~r-   rL   rM   rB   rS   searchtruncater6   experiment_idsr   r   c                b    | j                   j                  |||||||||		      }
|
j                  S )aN  
        Find dataset items with experiment items

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

        experiment_ids : str

        page : typing.Optional[int]

        size : typing.Optional[int]

        filters : typing.Optional[str]

        sorting : typing.Optional[str]

        search : typing.Optional[str]

        truncate : typing.Optional[bool]

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

        Returns
        -------
        DatasetItemPageCompare
            Dataset item resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.find_dataset_items_with_experiment_items(id='id', experiment_ids='experiment_ids', )
        r   rL   rM   rB   rS   r   r   r6   r(   (find_dataset_items_with_experiment_itemsr=   r*   r7   r   rL   rM   rB   rS   r   r   r6   r?   s              r+   r   z7DatasetsClient.find_dataset_items_with_experiment_items  sH    ` $$MM)+ N 

	 ~~r-   c                V    | j                   j                  |||      }|j                  S )a=  
        Get dataset by name

        Parameters
        ----------
        dataset_name : str

        project_name : typing.Optional[str]

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

        Returns
        -------
        DatasetPublic
            Dataset resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.get_dataset_by_identifier(dataset_name='dataset_name', )
        r   r(   get_dataset_by_identifierr=   r   s        r+   r   z(DatasetsClient.get_dataset_by_identifier  s3    < $$>>%LRa ? 
	 ~~r-   rB   r6   c                X    | j                   j                  ||||      }|j                  S )a  
        Get experiment items stats for dataset

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

        experiment_ids : str

        filters : typing.Optional[str]

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

        Returns
        -------
        ProjectStatsPublic
            Experiment items stats resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.get_dataset_experiment_items_stats(id='id', experiment_ids='experiment_ids', )
        r   rB   r6   r(   "get_dataset_experiment_items_statsr=   r*   r7   r   rB   r6   r?   s         r+   r   z1DatasetsClient.get_dataset_experiment_items_stats9  s7    B $$GG~wP_ H 
	 ~~r-   c                T    | j                   j                  ||      }|j                  S )a&  
        Retrieves the current status of a dataset export job

        Parameters
        ----------
        job_id : str

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

        Returns
        -------
        DatasetExportJobPublic
            Export job details

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.get_dataset_export_job(job_id='jobId', )
        rl   r(   get_dataset_export_jobr=   r*   r   r6   r?   s       r+   r   z%DatasetsClient.get_dataset_export_job_  s*    0 $$;;FTc;d	~~r-   c                R    | j                   j                  |      }|j                  S )aJ  
        Retrieves all export jobs for the workspace. This is used to restore the export panel state after page refresh.

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

        Returns
        -------
        typing.List[DatasetExportJobPublic]
            List of export jobs

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.get_dataset_export_jobs()
        rl   r(   get_dataset_export_jobsr=   r*   r6   r?   s      r+   r   z&DatasetsClient.get_dataset_export_jobsz  s'    , $$<<_<]	~~r-   item_idc                T    | j                   j                  ||      }|j                  S )a	  
        Get dataset item by id

        Parameters
        ----------
        item_id : str

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

        Returns
        -------
        DatasetItemPublic
            Dataset item resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.get_dataset_item_by_id(item_id='itemId', )
        rl   r(   get_dataset_item_by_idr=   r*   r   r6   r?   s       r+   r   z%DatasetsClient.get_dataset_item_by_id  s*    0 $$;;GUd;e	~~r-   r7   trace_idspan_idr]   r\   
evaluatorsexecution_policyr6   sourcer=   r   r   r   r   c       
         f    | j                   j                  |||||||||	|
|      }|j                  S )a  
        Partially update dataset item by id. Only provided fields will be updated.

        Parameters
        ----------
        item_id : str

        source : DatasetItemWriteSource

        data : JsonNode

        id : typing.Optional[str]

        trace_id : typing.Optional[str]

        span_id : typing.Optional[str]

        description : typing.Optional[str]

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

        evaluators : typing.Optional[typing.Sequence[EvaluatorItemWrite]]

        execution_policy : typing.Optional[ExecutionPolicyWrite]

        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.datasets.patch_dataset_item(item_id='itemId', source="manual", data={'key': 'value'
        }, )
        
r   r=   r7   r   r   r]   r\   r   r   r6   r(   patch_dataset_itemr=   r*   r   r   r=   r7   r   r   r]   r\   r   r   r6   r?   s                r+   r   z!DatasetsClient.patch_dataset_item  sM    l $$77#!-+ 8 
	 ~~r-   rL   rM   versionrB   r   r6   r   c          	      ^    | j                   j                  |||||||      }|j                  S )a  
        Get dataset items

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

        page : typing.Optional[int]

        size : typing.Optional[int]

        version : typing.Optional[str]

        filters : typing.Optional[str]

        truncate : typing.Optional[bool]

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

        Returns
        -------
        DatasetItemPagePublic
            Dataset items resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.get_dataset_items(id='id', )
        r   r(   get_dataset_itemsr=   	r*   r7   rL   rM   r   rB   r   r6   r?   s	            r+   r   z DatasetsClient.get_dataset_items  sA    T $$66+ 7 
	 ~~r-   r   r6   c                V    | j                   j                  |||      }|j                  S )a>  
        Get dataset items output columns

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

        experiment_ids : typing.Optional[str]

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

        Returns
        -------
        PageColumns
            Dataset item output columns

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.get_dataset_items_output_columns(id='id', )
        r   r(    get_dataset_items_output_columnsr=   r*   r7   r   r6   r?   s        r+   r   z/DatasetsClient.get_dataset_items_output_columns(  s3    < $$EE~ F 
	 ~~r-   c                T    | j                   j                  ||      }|j                  S )ax  
        Marks a dataset export job as viewed by setting the viewed_at timestamp. This is used to track that a user has seen a failed job's error message. This operation is idempotent.

        Parameters
        ----------
        job_id : 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.datasets.mark_dataset_export_job_viewed(job_id='jobId', )
        rl   r(   mark_dataset_export_job_viewedr=   r   s       r+   r   z-DatasetsClient.mark_dataset_export_job_viewedK  s*    . $$CCF\kCl	~~r-   c                T    | j                   j                  ||      }|j                  S )a]  
        Initiates an asynchronous CSV export job for the dataset. Returns immediately with job details for polling.

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

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

        Returns
        -------
        DatasetExportJobPublic
            Existing export job in progress

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.start_dataset_export(id='id', )
        rl   r(   start_dataset_exportr=   r   s       r+   r   z#DatasetsClient.start_dataset_exporte  s)    0 $$99"o9^	~~r-   last_retrieved_idsteam_limitdataset_versionrY   rB   r6   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 dataset items

        Parameters
        ----------
        dataset_name : str

        last_retrieved_id : typing.Optional[str]

        steam_limit : typing.Optional[int]

        dataset_version : typing.Optional[str]

        project_name : typing.Optional[str]

        filters : 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]
            Dataset items stream or error during process
        rd   r   r   r   rY   rB   r6   Nr(   stream_dataset_itemsr=   )	r*   rd   r   r   r   rY   rB   r6   r   s	            r+   r   z#DatasetsClient.stream_dataset_items  sc     H 22%/#+%+ 3 
 vv
 
 
 
s+   #AAAA	AAA
Ac                T    | j                   j                  ||      }|j                  S )a  
        Compare the latest committed dataset version with the current draft state. This endpoint provides insights into changes made since the last version was committed. The comparison calculates additions, modifications, deletions, and unchanged items between the latest version snapshot and current draft.

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

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

        Returns
        -------
        DatasetVersionDiff
            Diff computed successfully

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.compare_dataset_versions(id='id', )
        rl   r(   compare_dataset_versionsr=   r   s       r+   r   z'DatasetsClient.compare_dataset_versions  s*    0 $$==bRa=b	~~r-   version_hashtagc                X    | j                   j                  ||||      }|j                  S )ak  
        Add a tag to a specific dataset version for easy reference (e.g., 'baseline', 'v1.0', 'production')

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

        version_hash : str

        tag : 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.datasets.create_version_tag(id='id', version_hash='versionHash', tag='tag', )
        r   r6   r(   create_version_tagr=   r*   r7   r   r   r6   r?   s         r+   r   z!DatasetsClient.create_version_tag  s.    6 $$77Lccr7s	~~r-   c                X    | j                   j                  ||||      }|j                  S )ag  
        Remove a tag from a dataset version. The version itself is not deleted, only the tag reference.

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

        version_hash : str

        tag : 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.datasets.delete_version_tag(id='id', version_hash='versionHash', tag='tag', )
        rl   r(   delete_version_tagr=   r   s         r+   r   z!DatasetsClient.delete_version_tag  s.    6 $$77L#_n7o	~~r-   rL   rM   r6   c                X    | j                   j                  ||||      }|j                  S )a  
        Get paginated list of versions for a dataset, ordered by creation time (newest first)

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

        page : typing.Optional[int]

        size : typing.Optional[int]

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

        Returns
        -------
        DatasetVersionPagePublic
            Dataset versions

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.list_dataset_versions(id='id', )
        r   r(   list_dataset_versionsr=   r*   r7   rL   rM   r6   r?   s         r+   r  z$DatasetsClient.list_dataset_versions  s/    B $$::2Dtet:u	~~r-   version_refc                V    | j                   j                  |||      }|j                  S )a  
        Restores the dataset to a previous version state by creating a new version with items copied from the specified version. If the version is already the latest, returns it as-is (no-op).

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

        version_ref : str
            Version hash or tag to restore from

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

        Returns
        -------
        DatasetVersionPublic
            Version restored successfully

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.restore_dataset_version(id='id', version_ref='version_ref', )
        r  r6   r(   restore_dataset_versionr=   r*   r7   r  r6   r?   s        r+   r  z&DatasetsClient.restore_dataset_version*  s2    6 $$<<K = 
	 ~~r-   version_namec                V    | j                   j                  |||      }|j                  S )a  
        Get a specific version by its version name (e.g., 'v1', 'v373'). This is more efficient than paginating through all versions for large datasets.

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

        version_name : str
            Version name in format 'vN' (e.g., 'v1', 'v373')

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

        Returns
        -------
        DatasetVersionPublic
            Dataset version

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.retrieve_dataset_version(id='id', version_name='v1', )
        r	  r6   r(   retrieve_dataset_versionr=   r*   r7   r	  r6   r?   s        r+   r  z'DatasetsClient.retrieve_dataset_versionJ  s2    6 $$==\? > 
	 ~~r-   change_descriptiontags_to_addr6   r  r  c                Z    | j                   j                  |||||      }|j                  S )aM  
        Update a dataset version's change_description and/or add new tags

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

        version_hash : str

        change_description : typing.Optional[str]
            Optional description of changes in this version

        tags_to_add : typing.Optional[typing.Sequence[str]]
            Optional list of tags to add to this version

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

        Returns
        -------
        DatasetVersionPublic
            Version updated successfully

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.datasets.update_dataset_version(id='id', version_hash='versionHash', )
        r  r(   update_dataset_versionr=   r*   r7   r   r  r  r6   r?   s          r+   r  z%DatasetsClient.update_dataset_versionj  s;    L $$;;1#+ < 
	 ~~r-   )Q__name__
__module____qualname__r   r,   propertyr   r2   strr	   typingOptionalboolr   r   r<   OMITr   Sequencer
   rI   intr   rV   r!   r"   ra   r   rj   DictAnyrq   r   rx   r   r~   r   r   r    r   r   r   r   r   Iteratorbytesr   r   r   r   r   r   r   r   r   r   Listr   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$   &   s   L*; L  #4     +/;?,, *	,
 //$',  8, 
,d 6:GK+/,0;?2 "2 __V__S12	2
 1B!CD2 OOC(2 OOD)2  82 
2n &*%)7;9=*.+/%)(,(,;?? ooc"? ooc"	?
  &t4? "(!6? ??3'? OOC(? ooc"? %? %?  8? 
?J $(+/-126>B6:,0;?< < OOC 	<
 OOC(< ooc*< oo./< OO$:;< oofooc23< __S)<  8< 
<D .2+//3;?/ /0/ ooc*	/
 OOC(/ ,/  8/ 
/l <@! kk#vvzz::;! 	!
  8! 
!R <@%% //#&	%
 2%  8% 
%Z <@%% ??3'	%
 3%  8% 
%N `d C V__^=\ hu < -1?C6:;?)) 	)
 __S)) OO$;<) oofooc23)  8) 
)V ]a  &//.:Y ei 8 .2;?    ooc*	 
  8  
 J ;?+/GK/3;?2 //&//#"672 OOC(	2
 1B!CD2 ,2  82 
2j `dooc*=C__^=\	6 RV/5~/N		@ .2AE7;.2;?88 	8
 ooc*8  )=>8 !' 48 s+8  88 
"8~ &*%)(,(,'+*.;?;; 	;
 ooc"; ooc"; %; %; $; //$';  8; 
 ;B .2;?! ! ooc*	!
  8! 
!P )-;?$$ 	$
 %$  8$ 
$N RV/5~/N	8 EI"(//."A	+	,4 SW060O	B $()-(,,06:KOBF;?CC '	C
 C OOC C //#&C %C __S)C oofooc23C OOFOO4F$GHC !//*>?C  8C 
CR &*%)(,(,*.;?33 ooc"	3
 ooc"3 %3 %3 //$'3  83 
3r 04;?!! ,	!
  8! 
!H RV/5~/N	6 NR+1??>+J	> 37,004-1(,;?- - "??3/	-
 __S)-  -- ooc*- %-  8- 
	-` NR+1??>+J	8 ko%(25HNXfHg	> ko%(/2HNXfHg	D &*%);?"" ooc"	"
 ooc""  8" 
""J `d'*=C__^=\	B ae(+>Doon>]	J 48=A;?-- -
 #OOC0- __V__S%9:-  8- 
-r-   r$   c                      e Zd ZdefdZedefd       Zddddede	d	e
j                  e   d
e
j                  e   def
dZeeeeddd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   ddfdZ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fdZeeeeeeeddd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dfd#Z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dfd(Zdd)d*e
j:                  ee
j                  e
j<                     f   ded
e
j                  e   ddfd+Zdd)ded,e
j$                  e   d-e d
e
j                  e   ddf
d.Z!dd)ded/e
j$                  e   d-e"d
e
j                  e   ddf
d0Z#dd)ded
e
j                  e   de$fd1Z%eeedd2deded"e
j                  e   d e
j                  e&   d!e
j                  e
j$                  e      d
e
j                  e   ddfd3Z'dd)ded
e
j                  e   ddfd4Z(edd5d&ede
j                  e   d
e
j                  e   ddfd6Z)eeeedd7d8e
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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
jX                  e-   fd<Z.eeeedd=ded>ed?e
j                  e   d@e
j                  e
j$                  e      dAe
j                  e   dBe
j                  e   d
e
j                  e   de/fdCZ0ddddddddDdedEede
j                  e   de
j                  e   de
j                  e   de
j                  e   dFe
j                  e   dGe
j                  e   d
e
j                  e   de1fdHZ2edd5d&ede
j                  e   d
e
j                  e   de$fdIZ3dddJdedEede
j                  e   d
e
j                  e   de4f
dKZ5dd)d;ed
e
j                  e   de6fdLZ7dd)d
e
j                  e   de
jp                  e6   fdMZ9dd)dNed
e
j                  e   de:fdOZ;eeeeeeeddPdNedQe<dRe=de
j                  e   dSe
j                  e   dTe
j                  e   d"e
j                  e   d!e
j                  e
j$                  e      dUe
j                  e
j$                  e>      dVe
j                  e?   d
e
j                  e   ddfdWZ@dddddddXdede
j                  e   de
j                  e   dYe
j                  e   de
j                  e   dGe
j                  e   d
e
j                  e   deAfdZZBddd[dedEe
j                  e   d
e
j                  e   deCfd\ZDdd)d;ed
e
j                  e   ddfd]ZEdd)ded
e
j                  e   de6fd^ZFeeeeedd_d&ed`e
j                  e   dae
j                  e   dbe
j                  e   de
j                  e   de
j                  e   d
e
j                  e   de
jX                  e-   fdcZGdd)ded
e
j                  e   deHfddZIdd)dedeedfed
e
j                  e   ddf
dgZJdd)dedeedfed
e
j                  e   ddf
dhZKddddidede
j                  e   de
j                  e   d
e
j                  e   deLf
djZMdd)dedked
e
j                  e   defdlZNdd)dedmed
e
j                  e   defdnZOeeddodedeedpe
j                  e   dqe
j                  e
j$                  e      d
e
j                  e   defdrZPy)sAsyncDatasetsClientr%   c                &    t        |      | _        y r'   )r   r(   r)   s     r+   r,   zAsyncDatasetsClient.__init__  s    1Pr-   r.   c                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawDatasetsClient
        r0   r1   s    r+   r2   z%AsyncDatasetsClient.with_raw_response  r3   r-   Nr4   r7   r8   r5   r6   c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)a  
        Apply delta changes (add, edit, delete) to a dataset version with conflict detection.

        This endpoint:
        - Creates a new version with the applied changes
        - Validates that baseVersion matches the latest version (unless override=true)
        - Returns 409 Conflict if baseVersion is stale and override is not set

        Use `override=true` query parameter to force version creation even with stale baseVersion.

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

        request : DatasetItemChangesPublic

        override : typing.Optional[bool]

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

        Returns
        -------
        DatasetVersionPublic
            Version created successfully

        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.datasets.apply_dataset_item_changes(id='id', request={'key': 'value'
            }, )
        asyncio.run(main())
        r:   Nr;   r>   s         r+   r<   z.AsyncDatasetsClient.apply_dataset_item_changes  sD     X **EE(O F 
 
	 ~~
   #868r@   rE   rA   rB   rC   rD   c                x   K   | j                   j                  ||||||       d{   }|j                  S 7 w)a  
        Update multiple dataset items

        Parameters
        ----------
        update : DatasetItemUpdate

        ids : typing.Optional[typing.Sequence[str]]
            List of dataset item IDs to update (max 1000). Mutually exclusive with 'filters'.

        filters : typing.Optional[typing.Sequence[DatasetItemFilter]]

        dataset_id : typing.Optional[str]
            Dataset ID. Required when using 'filters', optional when using 'ids'.

        merge_tags : typing.Optional[bool]
            If true, merge tags with existing tags instead of replacing them. Default: false. When using 'filters', this is automatically set to true.

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import DatasetItemUpdate
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.datasets.batch_update_dataset_items(update=DatasetItemUpdate(), )
        asyncio.run(main())
        rG   NrH   rJ   s           r+   rI   z.AsyncDatasetsClient.batch_update_dataset_items  sM     Z **EE!!+ F 
 
	 ~~
   %:8:rK   rL   rM   rN   rO   rP   rQ   rR   rS   c       
            K   | j                   j                  |||||||||	|

       d{   }|j                  S 7 w)a  
        Find datasets

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

        size : typing.Optional[int]

        with_experiments_only : typing.Optional[bool]

        with_optimizations_only : typing.Optional[bool]

        prompt_id : typing.Optional[str]

        project_id : typing.Optional[str]

        name : typing.Optional[str]

        sorting : typing.Optional[str]

        filters : typing.Optional[str]

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

        Returns
        -------
        DatasetPagePublic
            Dataset 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.datasets.find_datasets()
        asyncio.run(main())
        rK   NrU   rW   s               r+   rV   z!AsyncDatasetsClient.find_datasets  sX     l **88"7$;!+ 9 
 
	 ~~
s   )><>rX   rY   rZ   r[   r\   r]   c       	         ~   K   | j                   j                  |||||||||		       d{   }
|
j                  S 7 w)a  
        Create dataset

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

        id : typing.Optional[str]

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

        project_name : typing.Optional[str]
            For project scope, specify either project_id or project_name. If project_name is provided and the project does not exist, it will be created. Ignored when project_id is provided. If neither is provided, the dataset is created at workspace level.

        type : typing.Optional[DatasetWriteType]

        visibility : typing.Optional[DatasetWriteVisibility]

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

        description : typing.Optional[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.datasets.create_dataset(name='name', )
        asyncio.run(main())
        r_   Nr`   rb   s              r+   ra   z"AsyncDatasetsClient.create_datasetU  sU     h **99!%!#+ : 

 

	 ~~

   (=;=rc   rf   rd   re   c                v   K   | j                   j                  |||||       d{   }|j                  S 7 w)ay  
        Create/update dataset items based on dataset item id

        Parameters
        ----------
        items : typing.Sequence[DatasetItemWrite]

        dataset_name : typing.Optional[str]
            If null, dataset_id must be provided

        dataset_id : typing.Optional[str]
            If null, dataset_name must be provided

        batch_group_id : typing.Optional[str]
            Optional batch group ID to group multiple batches into a single dataset version. If null, mutates the latest version instead of creating a new one.

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import DatasetItemWrite
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.datasets.create_or_update_dataset_items(items=[DatasetItemWrite(source="manual", data={'key': 'value'
            }, )], )
        asyncio.run(main())
        rh   Nri   rk   s          r+   rj   z2AsyncDatasetsClient.create_or_update_dataset_items  sJ     V **II%!)+ J 
 
	 ~~
   $979rl   rm   c                r   K   | j                   j                  |||       d{   }|j                  S 7 w)a$  
        Create dataset items from uploaded CSV file. CSV should have headers in the first row. Processing happens asynchronously in batches.

        Parameters
        ----------
        file : typing.Dict[str, typing.Optional[typing.Any]]

        dataset_id : 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.datasets.create_dataset_items_from_csv(file={'key': 'value'
            }, dataset_id='dataset_id', )
        asyncio.run(main())
        ro   Nrp   rr   s        r+   rq   z1AsyncDatasetsClient.create_dataset_items_from_csv  sB     B **HH*o I 
 
	 ~~
   "757rs   rt   c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)aw  
        Create dataset items from spans with enriched metadata

        Parameters
        ----------
        dataset_id : str

        span_ids : typing.Sequence[str]
            Set of span IDs to add to the dataset

        enrichment_options : SpanEnrichmentOptions

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import SpanEnrichmentOptions
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.datasets.create_dataset_items_from_spans(dataset_id='dataset_id', span_ids=['span_ids'], enrichment_options=SpanEnrichmentOptions(), )
        asyncio.run(main())
        rv   Nrw   ry   s         r+   rx   z3AsyncDatasetsClient.create_dataset_items_from_spans  sF     J **JJ>Pbq K 
 
	 ~~
r,  rz   c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)a  
        Create dataset items from traces with enriched metadata

        Parameters
        ----------
        dataset_id : str

        trace_ids : typing.Sequence[str]
            Set of trace IDs to add to the dataset

        enrichment_options : TraceEnrichmentOptions

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import TraceEnrichmentOptions
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.datasets.create_dataset_items_from_traces(dataset_id='dataset_id', trace_ids=['trace_ids'], enrichment_options=TraceEnrichmentOptions(), )
        asyncio.run(main())
        r|   Nr}   r   s         r+   r~   z4AsyncDatasetsClient.create_dataset_items_from_traces  sF     J **KK)@Rds L 
 
	 ~~
r,  c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)aQ  
        Get dataset by id

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

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

        Returns
        -------
        DatasetPublic
            Dataset 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.datasets.get_dataset_by_id(id='id', )
        asyncio.run(main())
        rl   Nr   r   s       r+   r   z%AsyncDatasetsClient.get_dataset_by_idD  s7     6 **<<RQ`<aa	~~ b   !646r   c                x   K   | j                   j                  ||||||       d{   }|j                  S 7 w)a  
        Update dataset by id

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

        name : str

        description : typing.Optional[str]

        visibility : typing.Optional[DatasetUpdateVisibility]

        tags : typing.Optional[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.datasets.update_dataset(id='id', name='name', )
        asyncio.run(main())
        r   Nr   r   s           r+   r   z"AsyncDatasetsClient.update_datasetb  sI     R **99T{zPTfu : 
 
	 ~~
r.  c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a+  
        Delete dataset by id

        Parameters
        ----------
        id : 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.datasets.delete_dataset(id='id', )
        asyncio.run(main())
        rl   Nr   r   s       r+   r   z"AsyncDatasetsClient.delete_dataset  s6     0 **99"o9^^	~~ _r9  r   c                r   K   | j                   j                  |||       d{   }|j                  S 7 w)a  
        Delete dataset by name

        Parameters
        ----------
        dataset_name : str

        project_name : typing.Optional[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.datasets.delete_dataset_by_name(dataset_name='dataset_name', )
        asyncio.run(main())
        r   Nr   r   s        r+   r   z*AsyncDatasetsClient.delete_dataset_by_name  sC     @ **AA%LRa B 
 
	 ~~
r5  r   r   c                v   K   | j                   j                  |||||       d{   }|j                  S 7 w)a  
        Delete dataset items using one of two modes:
        1. **Delete by IDs**: Provide 'item_ids' to delete specific items by their IDs
        2. **Delete by filters**: Provide 'dataset_id' with optional 'filters' to delete items matching criteria

        When using filters, an empty 'filters' array will delete all items in the specified dataset.

        Parameters
        ----------
        item_ids : typing.Optional[typing.Sequence[str]]
            List of dataset item IDs to delete (max 1000). Use this to delete specific items by their IDs. Mutually exclusive with 'dataset_id' and 'filters'.

        dataset_id : typing.Optional[str]
            Dataset ID to scope the deletion. Required when using 'filters'. Mutually exclusive with 'item_ids'.

        filters : typing.Optional[typing.Sequence[DatasetItemFilter]]
            Filters to select dataset items to delete within the specified dataset. Must be used with 'dataset_id'. Mutually exclusive with 'item_ids'. Empty array means 'delete all items in the dataset'.

        batch_group_id : typing.Optional[str]
            Optional batch group ID to group multiple delete operations into a single dataset version. If null, mutates the latest version instead of creating a new one.

        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.datasets.delete_dataset_items()
        asyncio.run(main())
        r   Nr   r   s          r+   r   z(AsyncDatasetsClient.delete_dataset_items  sJ     \ **??!)+ @ 
 
	 ~~
r3  c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)aI  
        Delete datasets batch

        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.datasets.delete_datasets_batch(ids=['ids'], )
        asyncio.run(main())
        r   Nr   r   s       r+   r   z)AsyncDatasetsClient.delete_datasets_batch  s7     4 **@@SZi@jj	~~ kr9  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)aO  
        Downloads the exported CSV file for a completed export job. This endpoint proxies the file download to avoid exposing internal storage URLs.

        Parameters
        ----------
        job_id : 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]
            CSV file content

        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.datasets.download_dataset_export(job_id='jobId', )
        asyncio.run(main())
        rl   Nr   )r*   r   r6   r   r=   s        r+   r   z+AsyncDatasetsClient.download_dataset_export$  s\     6 ##;;FTc;ddhiff d
 ef eddddsd   "A0AA0AAAAAA0AA	A0AA0A-!A$"A-)A0r   r   r   r   r   r   c          	      z   K   | j                   j                  |||||||       d{   }|j                  S 7 w)a  
        Generate synthetic dataset samples using LLM based on existing data patterns

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

        model : str
            The model to use for synthetic data generation

        sample_count : typing.Optional[int]
            Number of synthetic samples to generate

        preserve_fields : typing.Optional[typing.Sequence[str]]
            Fields to preserve patterns from original data

        variation_instructions : typing.Optional[str]
            Additional instructions for data variation

        custom_prompt : typing.Optional[str]
            Custom prompt to use for generation instead of auto-generated one

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

        Returns
        -------
        DatasetExpansionResponse
            Generated synthetic samples

        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.datasets.expand_dataset(id='id', model='gpt-4', )
        asyncio.run(main())
        r   Nr   r   s	            r+   r   z"AsyncDatasetsClient.expand_datasetC  sO     d **99%+#9'+ : 
 
	 ~~
   &;9;r   r   r   r   c                ~   K   | j                   j                  |||||||||		       d{   }
|
j                  S 7 w)a  
        Find dataset items with experiment items

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

        experiment_ids : str

        page : typing.Optional[int]

        size : typing.Optional[int]

        filters : typing.Optional[str]

        sorting : typing.Optional[str]

        search : typing.Optional[str]

        truncate : typing.Optional[bool]

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

        Returns
        -------
        DatasetItemPageCompare
            Dataset 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.datasets.find_dataset_items_with_experiment_items(id='id', experiment_ids='experiment_ids', )
        asyncio.run(main())
        r   Nr   r   s              r+   r   z<AsyncDatasetsClient.find_dataset_items_with_experiment_items  sV     f **SS)+ T 

 

	 ~~

r1  c                r   K   | j                   j                  |||       d{   }|j                  S 7 w)a  
        Get dataset by name

        Parameters
        ----------
        dataset_name : str

        project_name : typing.Optional[str]

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

        Returns
        -------
        DatasetPublic
            Dataset 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.datasets.get_dataset_by_identifier(dataset_name='dataset_name', )
        asyncio.run(main())
        r   Nr   r   s        r+   r   z-AsyncDatasetsClient.get_dataset_by_identifier  sC     B **DD%LRa E 
 
	 ~~
r5  r   c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)a  
        Get experiment items stats for dataset

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

        experiment_ids : str

        filters : typing.Optional[str]

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

        Returns
        -------
        ProjectStatsPublic
            Experiment items stats 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.datasets.get_dataset_experiment_items_stats(id='id', experiment_ids='experiment_ids', )
        asyncio.run(main())
        r   Nr   r   s         r+   r   z6AsyncDatasetsClient.get_dataset_experiment_items_stats  sE     H **MM~wP_ N 
 
	 ~~
r,  c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a  
        Retrieves the current status of a dataset export job

        Parameters
        ----------
        job_id : str

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

        Returns
        -------
        DatasetExportJobPublic
            Export job details

        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.datasets.get_dataset_export_job(job_id='jobId', )
        asyncio.run(main())
        rl   Nr   r   s       r+   r   z*AsyncDatasetsClient.get_dataset_export_job	  s7     6 **AA&ZiAjj	~~ kr9  c                n   K   | j                   j                  |       d{   }|j                  S 7 w)a  
        Retrieves all export jobs for the workspace. This is used to restore the export panel state after page refresh.

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

        Returns
        -------
        typing.List[DatasetExportJobPublic]
            List of export jobs

        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.datasets.get_dataset_export_jobs()
        asyncio.run(main())
        rl   Nr   r   s      r+   r   z+AsyncDatasetsClient.get_dataset_export_jobs-	  s5     2 **BBSbBcc	~~ ds    535r   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)ar  
        Get dataset item by id

        Parameters
        ----------
        item_id : str

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

        Returns
        -------
        DatasetItemPublic
            Dataset 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.datasets.get_dataset_item_by_id(item_id='itemId', )
        asyncio.run(main())
        rl   Nr   r   s       r+   r   z*AsyncDatasetsClient.get_dataset_item_by_idI	  s7     6 **AA'[jAkk	~~ lr9  r   r   r=   r   r   r   r   c       
            K   | j                   j                  |||||||||	|
|       d{   }|j                  S 7 w)aM  
        Partially update dataset item by id. Only provided fields will be updated.

        Parameters
        ----------
        item_id : str

        source : DatasetItemWriteSource

        data : JsonNode

        id : typing.Optional[str]

        trace_id : typing.Optional[str]

        span_id : typing.Optional[str]

        description : typing.Optional[str]

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

        evaluators : typing.Optional[typing.Sequence[EvaluatorItemWrite]]

        execution_policy : typing.Optional[ExecutionPolicyWrite]

        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.datasets.patch_dataset_item(item_id='itemId', source="manual", data={'key': 'value'
            }, )
        asyncio.run(main())
        r   Nr   r   s                r+   r   z&AsyncDatasetsClient.patch_dataset_itemg	  s[     r **==#!-+ > 
 
	 ~~
s   *?=?r   r   c          	      z   K   | j                   j                  |||||||       d{   }|j                  S 7 w)a#  
        Get dataset items

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

        page : typing.Optional[int]

        size : typing.Optional[int]

        version : typing.Optional[str]

        filters : typing.Optional[str]

        truncate : typing.Optional[bool]

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

        Returns
        -------
        DatasetItemPagePublic
            Dataset items 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.datasets.get_dataset_items(id='id', )
        asyncio.run(main())
        r   Nr   r   s	            r+   r   z%AsyncDatasetsClient.get_dataset_items	  sO     Z **<<+ = 
 
	 ~~
rA  r   c                r   K   | j                   j                  |||       d{   }|j                  S 7 w)a  
        Get dataset items output columns

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

        experiment_ids : typing.Optional[str]

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

        Returns
        -------
        PageColumns
            Dataset item output columns

        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.datasets.get_dataset_items_output_columns(id='id', )
        asyncio.run(main())
        r   Nr   r   s        r+   r   z4AsyncDatasetsClient.get_dataset_items_output_columns	  sB     B **KK~ L 
 
	 ~~
r5  c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a  
        Marks a dataset export job as viewed by setting the viewed_at timestamp. This is used to track that a user has seen a failed job's error message. This operation is idempotent.

        Parameters
        ----------
        job_id : 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.datasets.mark_dataset_export_job_viewed(job_id='jobId', )
        asyncio.run(main())
        rl   Nr   r   s       r+   r   z2AsyncDatasetsClient.mark_dataset_export_job_viewed
  s7     4 **II&bqIrr	~~ sr9  c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a  
        Initiates an asynchronous CSV export job for the dataset. Returns immediately with job details for polling.

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

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

        Returns
        -------
        DatasetExportJobPublic
            Existing export job in progress

        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.datasets.start_dataset_export(id='id', )
        asyncio.run(main())
        rl   Nr   r   s       r+   r   z(AsyncDatasetsClient.start_dataset_export*
  s7     6 **??Tc?dd	~~ er9  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 dataset items

        Parameters
        ----------
        dataset_name : str

        last_retrieved_id : typing.Optional[str]

        steam_limit : typing.Optional[int]

        dataset_version : typing.Optional[str]

        project_name : typing.Optional[str]

        filters : 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]
            Dataset items stream or error during process
        r   Nr   )
r*   rd   r   r   r   rY   rB   r6   r   r=   s
             r+   r   z(AsyncDatasetsClient.stream_dataset_itemsH
  s{     H ##88%/#+%+ 9 
 
 ff d

f
 
 
 
 
se   'A5A	A5A AAAA 	A5AA A5AA5 A2&A)'A2.A5c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a  
        Compare the latest committed dataset version with the current draft state. This endpoint provides insights into changes made since the last version was committed. The comparison calculates additions, modifications, deletions, and unchanged items between the latest version snapshot and current draft.

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

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

        Returns
        -------
        DatasetVersionDiff
            Diff computed successfully

        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.datasets.compare_dataset_versions(id='id', )
        asyncio.run(main())
        rl   Nr   r   s       r+   r   z,AsyncDatasetsClient.compare_dataset_versionsx
  s7     6 **CCBXgChh	~~ ir9  r   r   c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)a  
        Add a tag to a specific dataset version for easy reference (e.g., 'baseline', 'v1.0', 'production')

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

        version_hash : str

        tag : 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.datasets.create_version_tag(id='id', version_hash='versionHash', tag='tag', )
        asyncio.run(main())
        r   Nr   r   s         r+   r   z&AsyncDatasetsClient.create_version_tag
  sB     < **==# > 
 
	 ~~
r,  c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)a  
        Remove a tag from a dataset version. The version itself is not deleted, only the tag reference.

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

        version_hash : str

        tag : 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.datasets.delete_version_tag(id='id', version_hash='versionHash', tag='tag', )
        asyncio.run(main())
        rl   Nr   r   s         r+   r   z&AsyncDatasetsClient.delete_version_tag
  s<     < **==b,PSet=uu	~~ vr,  r   c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)a  
        Get paginated list of versions for a dataset, ordered by creation time (newest first)

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

        page : typing.Optional[int]

        size : typing.Optional[int]

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

        Returns
        -------
        DatasetVersionPagePublic
            Dataset versions

        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.datasets.list_dataset_versions(id='id', )
        asyncio.run(main())
        r   Nr   r  s         r+   r  z)AsyncDatasetsClient.list_dataset_versions
  sD     H **@@To A 
 
	 ~~
r,  r  c                r   K   | j                   j                  |||       d{   }|j                  S 7 w)ax  
        Restores the dataset to a previous version state by creating a new version with items copied from the specified version. If the version is already the latest, returns it as-is (no-op).

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

        version_ref : str
            Version hash or tag to restore from

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

        Returns
        -------
        DatasetVersionPublic
            Version restored successfully

        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.datasets.restore_dataset_version(id='id', version_ref='version_ref', )
        asyncio.run(main())
        r  Nr  r  s        r+   r  z+AsyncDatasetsClient.restore_dataset_version  sA     < **BBK C 
 
	 ~~
r5  r	  c                r   K   | j                   j                  |||       d{   }|j                  S 7 w)aI  
        Get a specific version by its version name (e.g., 'v1', 'v373'). This is more efficient than paginating through all versions for large datasets.

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

        version_name : str
            Version name in format 'vN' (e.g., 'v1', 'v373')

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

        Returns
        -------
        DatasetVersionPublic
            Dataset version

        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.datasets.retrieve_dataset_version(id='id', version_name='v1', )
        asyncio.run(main())
        r  Nr  r  s        r+   r  z,AsyncDatasetsClient.retrieve_dataset_version&  sA     < **CC\? D 
 
	 ~~
r5  r  r  r  c                v   K   | j                   j                  |||||       d{   }|j                  S 7 w)a  
        Update a dataset version's change_description and/or add new tags

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

        version_hash : str

        change_description : typing.Optional[str]
            Optional description of changes in this version

        tags_to_add : typing.Optional[typing.Sequence[str]]
            Optional list of tags to add to this version

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

        Returns
        -------
        DatasetVersionPublic
            Version updated successfully

        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.datasets.update_dataset_version(id='id', version_hash='versionHash', )
        asyncio.run(main())
        r  Nr  r  s          r+   r  z*AsyncDatasetsClient.update_dataset_versionI  sJ     R **AA1#+ B 
 
	 ~~
r3  )Qr  r  r  r   r,   r  r   r2   r  r	   r  r  r  r   r   r<   r  r   r  r
   rI   r   r   rV   r!   r"   ra   r   rj   r!  r"  rq   r   rx   r   r~   r   r   r    r   r   r   r   r   AsyncIteratorr$  r   r   r   r   r   r   r   r   r   r   r%  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r&  r-   r+   r(  r(    s   Q*< Q  #9     +/;?// *	/
 //$'/  8/ 
/j 6:GK+/,0;?5 "5 __V__S12	5
 1B!CD5 OOC(5 OOD)5  85 
5t &*%)7;9=*.+/%)(,(,;?B ooc"B ooc"	B
  &t4B "(!6B ??3'B OOC(B ooc"B %B %B  8B 
BP $(+/-126>B6:,0;?? ? OOC 	?
 OOC(? ooc*? oo./? OO$:;? oofooc23? __S)?  8? 
?J .2+//3;?2 /02 ooc*	2
 OOC(2 ,2  82 
2r <@$ kk#vvzz::;$ 	$
  8$ 
$X <@(( //#&	(
 2(  8( 
(` <@(( ??3'	(
 3(  8( 
(V NR+1??>+J	F -1?C6:;?,, 	,
 __S), OO$;<, oofooc23,  8, 
,\ cg s P^@_ ko > .2;?# # ooc*	#
  8# 
#P ;?+/GK/3;?5 //&//#"675 OOC(	5
 1B!CD5 ,5  85 
5p `dooc*=C__^=\	< RV/5~/N			e	$H .2AE7;.2;?;; 	;
 ooc*;  )=>; !' 4; s+;  8; 
";D &*%)(,(,'+*.;?>> 	>
 ooc"> ooc"> %> %> $> //$'>  8> 
 >H .2;?$ $ ooc*	$
  8$ 
$V )-;?'' 	'
 %'  8' 
'T RV/5~/N	> EI"(//."A	+	,: SW060O	H $()-(,,06:KOBF;?FF '	F
 F OOC F //#&F %F __S)F oofooc23F OOFOO4F$GHF !//*>?F  8F 
FX &*%)(,(,*.;?66 ooc"	6
 ooc"6 %6 %6 //$'6  86 
6x 04;?$$ ,	$
  8$ 
$N RV/5~/N	< NR+1??>+J	D 37,004-1(,;?. . "??3/	.
 __S).  -. ooc*. %.  8. 
		e	$.b NR+1??>+J	> ko!!%(!25!HNXfHg!	!H ko%(/2HNXfHg	J &*%);?'' ooc"	'
 ooc"'  8' 
"'T `d!!'*!=C__^=\!	!H ae!!(+!>Doon>]!	!P 48=A;?00 0
 #OOC00 __V__S%9:0  80 
0r-   r(  )@r  core.client_wrapperr   r   core.request_optionsr    types.dataset_expansion_responser   types.dataset_export_job_publicr   !types.dataset_item_changes_publicr	   types.dataset_item_filterr
   types.dataset_item_page_comparer   types.dataset_item_page_publicr   types.dataset_item_publicr   types.dataset_item_updater   types.dataset_item_writer   types.dataset_item_write_sourcer   types.dataset_page_publicr   types.dataset_publicr   types.dataset_version_diffr   !types.dataset_version_page_publicr   types.dataset_version_publicr   types.evaluator_item_writer   types.execution_policy_writer   types.json_noder   types.page_columnsr   types.project_stats_publicr   types.span_enrichment_optionsr   types.trace_enrichment_optionsr   
raw_clientr   r   types.dataset_update_visibilityr    types.dataset_write_typer!   types.dataset_write_visibilityr"   castr"  r  r$   r(  r&  r-   r+   <module>rs     s     G 1 G D H 9 D B 9 9 7 D 9 0 ; H ? ; ? & , ; A C A D 6 B v{{6::s#q qh+_ _r-   