o
    iJ                     @   s   d dl Zd dlZddlmZ ddlmZmZ ddlm	Z	 ddl
mZ ddlmZ 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 eejdZG dd dZG dd dZdS )    N   )core)AsyncClientWrapperSyncClientWrapper)RequestOptions)DatasetType)DatasetValidationStatus   )AsyncRawDatasetsClientRawDatasetsClient)DatasetsCreateResponse)DatasetsGetResponse)DatasetsGetUsageResponse)DatasetsListResponse.c                   @     e Zd ZdefddZedefddZddddddddd	ej	e
 d
ej	ej dej	ej dej	e dej	e dej	e dej	e defddZddddddeddde
dedejdej	e dej	e dej	eje
eje
 f  dej	eje
eje
 f  dej	e
 dej	e
 dej	ej dej	e defddZdddej	e defd d!Zddd"e
dej	e defd#d$Zddd"e
dej	e deje
ej	ej  f fd%d&Z!dS )'DatasetsClientclient_wrapperc                C      t |d| _d S N)r   )r   _raw_clientselfr    r   \/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/cohere/datasets/client.py__init__      zDatasetsClient.__init__returnc                 C      | j S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawDatasetsClient
        r   r   r   r   r   with_raw_response      	z DatasetsClient.with_raw_responseNdataset_typebeforeafterlimitoffsetvalidation_statusrequest_optionsr#   r$   r%   r&   r'   r(   r)   c          	   	   C   s    | j j|||||||d}|jS )a*  
        List datasets that have been created.

        Parameters
        ----------
        dataset_type : typing.Optional[str]
            optional filter by dataset type

        before : typing.Optional[dt.datetime]
            optional filter before a date

        after : typing.Optional[dt.datetime]
            optional filter after a date

        limit : typing.Optional[float]
            optional limit to number of results

        offset : typing.Optional[float]
            optional offset to start of results

        validation_status : typing.Optional[DatasetValidationStatus]
            optional filter by validation status

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

        Returns
        -------
        DatasetsListResponse
            A successful response.

        Examples
        --------
        from cohere import Client

        client = Client(
            client_name="YOUR_CLIENT_NAME",
            token="YOUR_TOKEN",
        )
        client.datasets.list()
        r"   r   listdata	r   r#   r$   r%   r&   r'   r(   r)   	_responser   r   r   r+   $   s   4	zDatasetsClient.listkeep_original_fileskip_malformed_inputkeep_fieldsoptional_fieldstext_separatorcsv_delimiter	eval_datar)   nametyper,   r0   r1   r2   r3   r4   r5   r6   c                C   s(   | j j|||||||||	|
|d}|jS )a
  
        Create a dataset by uploading a file. See ['Dataset Creation'](https://docs.cohere.com/docs/datasets#dataset-creation) for more information.

        Parameters
        ----------
        name : str
            The name of the uploaded dataset.

        type : DatasetType
            The dataset type, which is used to validate the data. The only valid type is `embed-input` used in conjunction with the Embed Jobs API.

        data : core.File
            See core.File for more documentation

        keep_original_file : typing.Optional[bool]
            Indicates if the original file should be stored.

        skip_malformed_input : typing.Optional[bool]
            Indicates whether rows with malformed input should be dropped (instead of failing the validation check). Dropped rows will be returned in the warnings field.

        keep_fields : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `keep_fields` are missing from the uploaded file, Dataset validation will fail.

        optional_fields : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, Datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `optional_fields` are missing from the uploaded file, Dataset validation will pass.

        text_separator : typing.Optional[str]
            Raw .txt uploads will be split into entries using the text_separator value.

        csv_delimiter : typing.Optional[str]
            The delimiter used for .csv uploads.

        eval_data : typing.Optional[core.File]
            See core.File for more documentation

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

        Returns
        -------
        DatasetsCreateResponse
            A successful response.

        Examples
        --------
        from cohere import Client

        client = Client(
            client_name="YOUR_CLIENT_NAME",
            token="YOUR_TOKEN",
        )
        client.datasets.create(
            name="name",
            type="embed-input",
        )
        r7   r8   r,   r0   r1   r2   r3   r4   r5   r6   r)   r   creater,   r   r7   r8   r,   r0   r1   r2   r3   r4   r5   r6   r)   r.   r   r   r   r;   c   s   GzDatasetsClient.creater)   c                C   s   | j j|d}|jS )a[  
        View the dataset storage usage for your Organization. Each Organization can have up to 10GB of storage across all their users.

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

        Returns
        -------
        DatasetsGetUsageResponse
            A successful response.

        Examples
        --------
        from cohere import Client

        client = Client(
            client_name="YOUR_CLIENT_NAME",
            token="YOUR_TOKEN",
        )
        client.datasets.get_usage()
        r=   r   	get_usager,   r   r)   r.   r   r   r   r?      s   zDatasetsClient.get_usageidc                C      | j j||d}|jS )ai  
        Retrieve a dataset by ID. See ['Datasets'](https://docs.cohere.com/docs/datasets) for more information.

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

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

        Returns
        -------
        DatasetsGetResponse
            A successful response.

        Examples
        --------
        from cohere import Client

        client = Client(
            client_name="YOUR_CLIENT_NAME",
            token="YOUR_TOKEN",
        )
        client.datasets.get(
            id="id",
        )
        r=   r   getr,   r   rA   r)   r.   r   r   r   rD      s   zDatasetsClient.getc                C   rB   )a  
        Delete a dataset by ID. Datasets are automatically deleted after 30 days, but they can also be deleted manually.

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

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

        Returns
        -------
        typing.Dict[str, typing.Optional[typing.Any]]
            A successful response.

        Examples
        --------
        from cohere import Client

        client = Client(
            client_name="YOUR_CLIENT_NAME",
            token="YOUR_TOKEN",
        )
        client.datasets.delete(
            id="id",
        )
        r=   r   deleter,   rE   r   r   r   rG      s   zDatasetsClient.delete)"__name__
__module____qualname__r   r   propertyr   r    typingOptionalstrdtdatetimefloatr   r   r   r+   OMITr   r   FileboolUnionSequencer   r;   r   r?   r   rD   DictAnyrG   r   r   r   r   r      s    

	

E	


V" r   c                   @   r   )'AsyncDatasetsClientr   c                C   r   r   )r
   r   r   r   r   r   r     r   zAsyncDatasetsClient.__init__r   c                 C   r   )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawDatasetsClient
        r   r   r   r   r   r      r!   z%AsyncDatasetsClient.with_raw_responseNr"   r#   r$   r%   r&   r'   r(   r)   c          	   	      s(   | j j|||||||dI dH }|jS )a  
        List datasets that have been created.

        Parameters
        ----------
        dataset_type : typing.Optional[str]
            optional filter by dataset type

        before : typing.Optional[dt.datetime]
            optional filter before a date

        after : typing.Optional[dt.datetime]
            optional filter after a date

        limit : typing.Optional[float]
            optional limit to number of results

        offset : typing.Optional[float]
            optional offset to start of results

        validation_status : typing.Optional[DatasetValidationStatus]
            optional filter by validation status

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

        Returns
        -------
        DatasetsListResponse
            A successful response.

        Examples
        --------
        import asyncio

        from cohere import AsyncClient

        client = AsyncClient(
            client_name="YOUR_CLIENT_NAME",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.datasets.list()


        asyncio.run(main())
        r"   Nr*   r-   r   r   r   r+   $  s   <	zAsyncDatasetsClient.listr/   r7   r8   r,   r0   r1   r2   r3   r4   r5   r6   c                   s0   | j j|||||||||	|
|dI dH }|jS )a/  
        Create a dataset by uploading a file. See ['Dataset Creation'](https://docs.cohere.com/docs/datasets#dataset-creation) for more information.

        Parameters
        ----------
        name : str
            The name of the uploaded dataset.

        type : DatasetType
            The dataset type, which is used to validate the data. The only valid type is `embed-input` used in conjunction with the Embed Jobs API.

        data : core.File
            See core.File for more documentation

        keep_original_file : typing.Optional[bool]
            Indicates if the original file should be stored.

        skip_malformed_input : typing.Optional[bool]
            Indicates whether rows with malformed input should be dropped (instead of failing the validation check). Dropped rows will be returned in the warnings field.

        keep_fields : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `keep_fields` are missing from the uploaded file, Dataset validation will fail.

        optional_fields : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, Datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `optional_fields` are missing from the uploaded file, Dataset validation will pass.

        text_separator : typing.Optional[str]
            Raw .txt uploads will be split into entries using the text_separator value.

        csv_delimiter : typing.Optional[str]
            The delimiter used for .csv uploads.

        eval_data : typing.Optional[core.File]
            See core.File for more documentation

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

        Returns
        -------
        DatasetsCreateResponse
            A successful response.

        Examples
        --------
        import asyncio

        from cohere import AsyncClient

        client = AsyncClient(
            client_name="YOUR_CLIENT_NAME",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.datasets.create(
                name="name",
                type="embed-input",
            )


        asyncio.run(main())
        r9   Nr:   r<   r   r   r   r;   k  s   OzAsyncDatasetsClient.creater=   c                   s   | j j|dI dH }|jS )a  
        View the dataset storage usage for your Organization. Each Organization can have up to 10GB of storage across all their users.

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

        Returns
        -------
        DatasetsGetUsageResponse
            A successful response.

        Examples
        --------
        import asyncio

        from cohere import AsyncClient

        client = AsyncClient(
            client_name="YOUR_CLIENT_NAME",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.datasets.get_usage()


        asyncio.run(main())
        r=   Nr>   r@   r   r   r   r?     s    zAsyncDatasetsClient.get_usagerA   c                      | j j||dI dH }|jS )a  
        Retrieve a dataset by ID. See ['Datasets'](https://docs.cohere.com/docs/datasets) for more information.

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

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

        Returns
        -------
        DatasetsGetResponse
            A successful response.

        Examples
        --------
        import asyncio

        from cohere import AsyncClient

        client = AsyncClient(
            client_name="YOUR_CLIENT_NAME",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.datasets.get(
                id="id",
            )


        asyncio.run(main())
        r=   NrC   rE   r   r   r   rD     s   $zAsyncDatasetsClient.getc                   rZ   )a  
        Delete a dataset by ID. Datasets are automatically deleted after 30 days, but they can also be deleted manually.

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

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

        Returns
        -------
        typing.Dict[str, typing.Optional[typing.Any]]
            A successful response.

        Examples
        --------
        import asyncio

        from cohere import AsyncClient

        client = AsyncClient(
            client_name="YOUR_CLIENT_NAME",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.datasets.delete(
                id="id",
            )


        asyncio.run(main())
        r=   NrF   rE   r   r   r   rG     s   &zAsyncDatasetsClient.delete)"rH   rI   rJ   r   r   rK   r
   r    rL   rM   rN   rO   rP   rQ   r   r   r   r+   rR   r   r   rS   rT   rU   rV   r   r;   r   r?   r   rD   rW   rX   rG   r   r   r   r   rY     s    

	

M	


^"#(rY   )rP   rO   rL    r   core.client_wrapperr   r   core.request_optionsr   types.dataset_typer   types.dataset_validation_statusr   
raw_clientr
   r   types.datasets_create_responser   types.datasets_get_responser   !types.datasets_get_usage_responser   types.datasets_list_responser   castrX   rR   r   rY   r   r   r   r   <module>   s"     