
    ]jR=                         d dl Z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mZ dd
lmZ  ej&                  ej(                  d      Z G d d      Z G d d      Zy)    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)CancelModelRunResponse)ModelRun)ProjectSubsetEnum   )AsyncRawRunsClientRawRunsClient)ListRunsRequestProjectSubset.c                      e Zd ZdefdZedefd       Zddddddde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   fdZeeeeeeeedd	dededede	j                  e   de	j                  e   de	j                  e   de	j                  ej(                     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dddededede	j                  e   def
dZy)
RunsClientclient_wrapperc                &    t        |      | _        y N)r   )r   _raw_clientselfr   s     N/root/env/lib/python3.12/site-packages/label_studio_sdk/prompts/runs/client.py__init__zRunsClient.__init__   s    (G    returnc                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawRunsClient
        r   r   s    r   with_raw_responsezRunsClient.with_raw_response        r   Norderingparent_modelprojectproject_subsetrequest_options	prompt_id
version_idr    r!   r"   r#   r$   c          	      ^    | j                   j                  |||||||      }|j                  S )ay  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Get information (status, metadata, etc) about an existing inference run

        Parameters
        ----------
        prompt_id : int

        version_id : int

        ordering : typing.Optional[str]
            Which field to use when ordering the results.

        parent_model : typing.Optional[int]
            The ID of the parent model for this Inference Run

        project : typing.Optional[int]
            The ID of the project this Inference Run makes predictions on

        project_subset : typing.Optional[ListRunsRequestProjectSubset]
            Defines which tasks are operated on (e.g. HasGT will only operate on tasks with a ground truth annotation, but All will operate on all records)

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

        Returns
        -------
        typing.List[ModelRun]


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.prompts.runs.list(
            prompt_id=1,
            version_id=1,
        )
        r   r   listdata	r   r%   r&   r    r!   r"   r#   r$   	_responses	            r   r)   zRunsClient.list!   sA    t $$))%)+ * 
	 ~~r   	job_idonly_missing_predictionsorganizationpredictions_updated_atr#   total_correct_predictionstotal_predictionstotal_tasksr$   r.   r/   r0   r1   r2   r3   r4   c       
         h    | j                   j                  |||||||||	|
||      }|j                  S )a  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Run a prompt inference.

        Parameters
        ----------
        prompt_id : int

        version_id : int

        project : int

        job_id : typing.Optional[str]
            Job ID for inference job for a ModelRun e.g. Adala job ID

        only_missing_predictions : typing.Optional[bool]
            When true, only tasks without successful predictions for this prompt version are submitted for inference.

        organization : typing.Optional[int]

        predictions_updated_at : typing.Optional[dt.datetime]

        project_subset : typing.Optional[ProjectSubsetEnum]

        total_correct_predictions : typing.Optional[int]

        total_predictions : typing.Optional[int]

        total_tasks : typing.Optional[int]

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

        Returns
        -------
        ModelRun


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.prompts.runs.create(
            prompt_id=1,
            version_id=1,
            project=1,
        )
        
r"   r.   r/   r0   r1   r#   r2   r3   r4   r$   r   creater*   r   r%   r&   r"   r.   r/   r0   r1   r#   r2   r3   r4   r$   r,   s                 r   r8   zRunsClient.createf   sP    P $$++%=%#9)&?/#+ , 
	 ~~r   r$   inference_run_idc                X    | j                   j                  ||||      }|j                  S )a{  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Cancel the inference run for the given api

        Parameters
        ----------
        prompt_id : int

        version_id : int

        inference_run_id : int

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

        Returns
        -------
        CancelModelRunResponse


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.prompts.runs.cancel(
            prompt_id=1,
            version_id=1,
            inference_run_id=1,
        )
        r:   r   cancelr*   r   r%   r&   r;   r$   r,   s         r   r>   zRunsClient.cancel   s0    \ $$++IzCSet+u	~~r   )__name__
__module____qualname__r   r   propertyr   r   inttypingOptionalstrr   r   Listr   r)   OMITbooldtdatetimer	   r8   r   r>    r   r   r   r      s   H*; H  =     *.-1(,HL;?CC C
 //#&C ooc*C %C (DEC  8C 
X	CV (,:>-1?C=A:>26,0;?VV V
 V $V #)//$"7V ooc*V !' <V (9:V $*??3#7V "??3/V __S)V  8V 
V| <@// / 	/  8/ 
 /r   r   c                      e Zd ZdefdZedefd       Zddddddde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   fdZeeeeeeeedd	dededede	j                  e   de	j                  e   de	j                  e   de	j                  ej(                     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dddededede	j                  e   def
dZy)AsyncRunsClientr   c                &    t        |      | _        y r   )r   r   r   s     r   r   zAsyncRunsClient.__init__   s    -^Lr   r   c                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawRunsClient
        r   r   s    r   r   z!AsyncRunsClient.with_raw_response   r   r   Nr   r%   r&   r    r!   r"   r#   r$   c          	      z   K   | j                   j                  |||||||       d{   }|j                  S 7 w)a  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Get information (status, metadata, etc) about an existing inference run

        Parameters
        ----------
        prompt_id : int

        version_id : int

        ordering : typing.Optional[str]
            Which field to use when ordering the results.

        parent_model : typing.Optional[int]
            The ID of the parent model for this Inference Run

        project : typing.Optional[int]
            The ID of the project this Inference Run makes predictions on

        project_subset : typing.Optional[ListRunsRequestProjectSubset]
            Defines which tasks are operated on (e.g. HasGT will only operate on tasks with a ground truth annotation, but All will operate on all records)

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

        Returns
        -------
        typing.List[ModelRun]


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.prompts.runs.list(
                prompt_id=1,
                version_id=1,
            )


        asyncio.run(main())
        r   Nr(   r+   s	            r   r)   zAsyncRunsClient.list   sO     D **//%)+ 0 
 
	 ~~
s   &;9;r-   r.   r/   r0   r1   r2   r3   r4   c       
            K   | j                   j                  |||||||||	|
||       d{   }|j                  S 7 w)a$  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Run a prompt inference.

        Parameters
        ----------
        prompt_id : int

        version_id : int

        project : int

        job_id : typing.Optional[str]
            Job ID for inference job for a ModelRun e.g. Adala job ID

        only_missing_predictions : typing.Optional[bool]
            When true, only tasks without successful predictions for this prompt version are submitted for inference.

        organization : typing.Optional[int]

        predictions_updated_at : typing.Optional[dt.datetime]

        project_subset : typing.Optional[ProjectSubsetEnum]

        total_correct_predictions : typing.Optional[int]

        total_predictions : typing.Optional[int]

        total_tasks : typing.Optional[int]

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

        Returns
        -------
        ModelRun


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.prompts.runs.create(
                prompt_id=1,
                version_id=1,
                project=1,
            )


        asyncio.run(main())
        r6   Nr7   r9   s                 r   r8   zAsyncRunsClient.createL  s^     ` **11%=%#9)&?/#+ 2 
 
	 ~~
s   +A >A r:   r;   c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)a  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Cancel the inference run for the given api

        Parameters
        ----------
        prompt_id : int

        version_id : int

        inference_run_id : int

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

        Returns
        -------
        CancelModelRunResponse


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.prompts.runs.cancel(
                prompt_id=1,
                version_id=1,
                inference_run_id=1,
            )


        asyncio.run(main())
        r:   Nr=   r?   s         r   r>   zAsyncRunsClient.cancel  sD     l **11z#3_ 2 
 
	 ~~
s   #868)r@   rA   rB   r   r   rC   r   r   rD   rE   rF   rG   r   r   rH   r   r)   rI   rJ   rK   rL   r	   r8   r   r>   rM   r   r   rO   rO      s   M*< M  #5     *.-1(,HL;?KK K
 //#&K ooc*K %K (DEK  8K 
X	Kf (,:>-1?C=A:>26,0;?^^ ^
 ^ $^ #)//$"7^ ooc*^ !' <^ (9:^ $*??3#7^ "??3/^ __S)^  8^ 
^L <@99 9 	9  89 
 9r   rO   )rL   rK   rE   core.client_wrapperr   r   core.request_optionsr   types.cancel_model_run_responser   types.model_runr   types.project_subset_enumr	   
raw_clientr   r   &types.list_runs_request_project_subsetr   castAnyrI   r   rO   rM   r   r   <module>r^      sS      H 2 E ' : 9 P v{{6::s#[ [|u ur   