# This file was auto-generated by Fern from our API Definition.

import typing

from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ...core.request_options import RequestOptions
from ...types.inference_run_cost_estimate import InferenceRunCostEstimate
from ...types.provider_enum import ProviderEnum
from ...types.refined_prompt_response import RefinedPromptResponse
from ...types.third_party_model_version import ThirdPartyModelVersion
from .raw_client import AsyncRawVersionsClient, RawVersionsClient

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class VersionsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawVersionsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawVersionsClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawVersionsClient
        """
        return self._raw_client

    def get_default_version_name(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        <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 default prompt version name

        Parameters
        ----------
        id : int

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

        Returns
        -------
        None

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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.prompts.versions.get_default_version_name(
            id=1,
        )
        """
        _response = self._raw_client.get_default_version_name(id, request_options=request_options)
        return _response.data

    def list(
        self,
        prompt_id: int,
        *,
        ordering: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[ThirdPartyModelVersion]:
        """
        <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>
        List all versions of a prompt.

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

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

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

        Returns
        -------
        typing.List[ThirdPartyModelVersion]


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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.prompts.versions.list(
            prompt_id=1,
        )
        """
        _response = self._raw_client.list(prompt_id, ordering=ordering, request_options=request_options)
        return _response.data

    def create(
        self,
        prompt_id: int,
        *,
        prompt: str,
        provider_model_id: str,
        title: str,
        model_provider_connection: typing.Optional[int] = OMIT,
        organization: typing.Optional[int] = OMIT,
        parent_model: typing.Optional[int] = OMIT,
        provider: typing.Optional[ProviderEnum] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ThirdPartyModelVersion:
        """
        <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>
        Create a new version of a prompt.

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

        prompt : str
            Prompt to execute

        provider_model_id : str
            The model ID to use within the given provider, e.g. gpt-3.5

        title : str
            Model name

        model_provider_connection : typing.Optional[int]

        organization : typing.Optional[int]

        parent_model : typing.Optional[int]
            Parent model interface ID

        provider : typing.Optional[ProviderEnum]
            The model provider to use e.g. OpenAI

            * `OpenAI` - OpenAI
            * `AzureOpenAI` - AzureOpenAI
            * `AzureAIFoundry` - AzureAIFoundry
            * `VertexAI` - VertexAI
            * `Gemini` - Gemini
            * `Anthropic` - Anthropic
            * `Custom` - Custom

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

        Returns
        -------
        ThirdPartyModelVersion


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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.prompts.versions.create(
            prompt_id=1,
            prompt="prompt",
            provider_model_id="provider_model_id",
            title="title",
        )
        """
        _response = self._raw_client.create(
            prompt_id,
            prompt=prompt,
            provider_model_id=provider_model_id,
            title=title,
            model_provider_connection=model_provider_connection,
            organization=organization,
            parent_model=parent_model,
            provider=provider,
            request_options=request_options,
        )
        return _response.data

    def get(
        self, prompt_id: int, version_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> ThirdPartyModelVersion:
        """
        <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>
        Retrieve a specific prompt of a model.

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

        version_id : int

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

        Returns
        -------
        ThirdPartyModelVersion


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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.prompts.versions.get(
            prompt_id=1,
            version_id=1,
        )
        """
        _response = self._raw_client.get(prompt_id, version_id, request_options=request_options)
        return _response.data

    def delete(
        self, prompt_id: int, version_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> None:
        """
        <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>
        Delete a prompt version by ID

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

        version_id : int

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

        Returns
        -------
        None

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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.prompts.versions.delete(
            prompt_id=1,
            version_id=1,
        )
        """
        _response = self._raw_client.delete(prompt_id, version_id, request_options=request_options)
        return _response.data

    def update(
        self,
        prompt_id: int,
        version_id: int,
        *,
        model_provider_connection: typing.Optional[int] = OMIT,
        organization: typing.Optional[int] = OMIT,
        parent_model: typing.Optional[int] = OMIT,
        prompt: typing.Optional[str] = OMIT,
        provider: typing.Optional[ProviderEnum] = OMIT,
        provider_model_id: typing.Optional[str] = OMIT,
        title: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ThirdPartyModelVersion:
        """
        <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>
        Update a specific prompt version by ID.

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

        version_id : int

        model_provider_connection : typing.Optional[int]

        organization : typing.Optional[int]

        parent_model : typing.Optional[int]
            Parent model interface ID

        prompt : typing.Optional[str]
            Prompt to execute

        provider : typing.Optional[ProviderEnum]
            The model provider to use e.g. OpenAI

            * `OpenAI` - OpenAI
            * `AzureOpenAI` - AzureOpenAI
            * `AzureAIFoundry` - AzureAIFoundry
            * `VertexAI` - VertexAI
            * `Gemini` - Gemini
            * `Anthropic` - Anthropic
            * `Custom` - Custom

        provider_model_id : typing.Optional[str]
            The model ID to use within the given provider, e.g. gpt-3.5

        title : typing.Optional[str]
            Model name

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

        Returns
        -------
        ThirdPartyModelVersion


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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.prompts.versions.update(
            prompt_id=1,
            version_id=1,
        )
        """
        _response = self._raw_client.update(
            prompt_id,
            version_id,
            model_provider_connection=model_provider_connection,
            organization=organization,
            parent_model=parent_model,
            prompt=prompt,
            provider=provider,
            provider_model_id=provider_model_id,
            title=title,
            request_options=request_options,
        )
        return _response.data

    def cost_estimate(
        self, prompt_id: int, version_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> InferenceRunCostEstimate:
        """
        <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 an estimate of the cost for making an inference run on the selected Prompt Version and Project/ProjectSubset

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

        version_id : int

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

        Returns
        -------
        InferenceRunCostEstimate
            Cost estimate response

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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.prompts.versions.cost_estimate(
            prompt_id=1,
            version_id=1,
        )
        """
        _response = self._raw_client.cost_estimate(prompt_id, version_id, request_options=request_options)
        return _response.data

    def get_refined_prompt(
        self,
        prompt_id: int,
        version_id: int,
        *,
        refinement_job_id: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> RefinedPromptResponse:
        """
        <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 the refined prompt based on the `refinement_job_id`.

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

        version_id : int

        refinement_job_id : typing.Optional[str]
            Refinement Job ID acquired from the `POST /api/prompts/{prompt_id}/versions/{version_id}/refine` endpoint

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

        Returns
        -------
        RefinedPromptResponse
            Refined prompt response

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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.prompts.versions.get_refined_prompt(
            prompt_id=1,
            version_id=1,
        )
        """
        _response = self._raw_client.get_refined_prompt(
            prompt_id, version_id, refinement_job_id=refinement_job_id, request_options=request_options
        )
        return _response.data

    def refine_prompt(
        self,
        prompt_id: int,
        version_id: int,
        *,
        project_id: int,
        teacher_model_name: str,
        teacher_model_provider_connection_id: int,
        async_: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> RefinedPromptResponse:
        """
        <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>
        Refine a prompt version using a teacher model and save the refined prompt as a new version.

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

        version_id : int

        project_id : int
            Project ID to target the refined prompt for

        teacher_model_name : str
            Name of the model to use to refine the prompt

        teacher_model_provider_connection_id : int
            Model Provider Connection ID to use to refine the prompt

        async_ : typing.Optional[bool]
            Whether to run the refinement asynchronously

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

        Returns
        -------
        RefinedPromptResponse
            Refined prompt response

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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.prompts.versions.refine_prompt(
            prompt_id=1,
            version_id=1,
            project_id=1,
            teacher_model_name="teacher_model_name",
            teacher_model_provider_connection_id=1,
        )
        """
        _response = self._raw_client.refine_prompt(
            prompt_id,
            version_id,
            project_id=project_id,
            teacher_model_name=teacher_model_name,
            teacher_model_provider_connection_id=teacher_model_provider_connection_id,
            async_=async_,
            request_options=request_options,
        )
        return _response.data


class AsyncVersionsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawVersionsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawVersionsClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawVersionsClient
        """
        return self._raw_client

    async def get_default_version_name(
        self, id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> None:
        """
        <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 default prompt version name

        Parameters
        ----------
        id : int

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.prompts.versions.get_default_version_name(
                id=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_default_version_name(id, request_options=request_options)
        return _response.data

    async def list(
        self,
        prompt_id: int,
        *,
        ordering: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[ThirdPartyModelVersion]:
        """
        <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>
        List all versions of a prompt.

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

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

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

        Returns
        -------
        typing.List[ThirdPartyModelVersion]


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


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


        asyncio.run(main())
        """
        _response = await self._raw_client.list(prompt_id, ordering=ordering, request_options=request_options)
        return _response.data

    async def create(
        self,
        prompt_id: int,
        *,
        prompt: str,
        provider_model_id: str,
        title: str,
        model_provider_connection: typing.Optional[int] = OMIT,
        organization: typing.Optional[int] = OMIT,
        parent_model: typing.Optional[int] = OMIT,
        provider: typing.Optional[ProviderEnum] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ThirdPartyModelVersion:
        """
        <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>
        Create a new version of a prompt.

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

        prompt : str
            Prompt to execute

        provider_model_id : str
            The model ID to use within the given provider, e.g. gpt-3.5

        title : str
            Model name

        model_provider_connection : typing.Optional[int]

        organization : typing.Optional[int]

        parent_model : typing.Optional[int]
            Parent model interface ID

        provider : typing.Optional[ProviderEnum]
            The model provider to use e.g. OpenAI

            * `OpenAI` - OpenAI
            * `AzureOpenAI` - AzureOpenAI
            * `AzureAIFoundry` - AzureAIFoundry
            * `VertexAI` - VertexAI
            * `Gemini` - Gemini
            * `Anthropic` - Anthropic
            * `Custom` - Custom

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

        Returns
        -------
        ThirdPartyModelVersion


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.prompts.versions.create(
                prompt_id=1,
                prompt="prompt",
                provider_model_id="provider_model_id",
                title="title",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create(
            prompt_id,
            prompt=prompt,
            provider_model_id=provider_model_id,
            title=title,
            model_provider_connection=model_provider_connection,
            organization=organization,
            parent_model=parent_model,
            provider=provider,
            request_options=request_options,
        )
        return _response.data

    async def get(
        self, prompt_id: int, version_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> ThirdPartyModelVersion:
        """
        <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>
        Retrieve a specific prompt of a model.

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

        version_id : int

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

        Returns
        -------
        ThirdPartyModelVersion


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


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


        asyncio.run(main())
        """
        _response = await self._raw_client.get(prompt_id, version_id, request_options=request_options)
        return _response.data

    async def delete(
        self, prompt_id: int, version_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> None:
        """
        <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>
        Delete a prompt version by ID

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

        version_id : int

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


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


        asyncio.run(main())
        """
        _response = await self._raw_client.delete(prompt_id, version_id, request_options=request_options)
        return _response.data

    async def update(
        self,
        prompt_id: int,
        version_id: int,
        *,
        model_provider_connection: typing.Optional[int] = OMIT,
        organization: typing.Optional[int] = OMIT,
        parent_model: typing.Optional[int] = OMIT,
        prompt: typing.Optional[str] = OMIT,
        provider: typing.Optional[ProviderEnum] = OMIT,
        provider_model_id: typing.Optional[str] = OMIT,
        title: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ThirdPartyModelVersion:
        """
        <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>
        Update a specific prompt version by ID.

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

        version_id : int

        model_provider_connection : typing.Optional[int]

        organization : typing.Optional[int]

        parent_model : typing.Optional[int]
            Parent model interface ID

        prompt : typing.Optional[str]
            Prompt to execute

        provider : typing.Optional[ProviderEnum]
            The model provider to use e.g. OpenAI

            * `OpenAI` - OpenAI
            * `AzureOpenAI` - AzureOpenAI
            * `AzureAIFoundry` - AzureAIFoundry
            * `VertexAI` - VertexAI
            * `Gemini` - Gemini
            * `Anthropic` - Anthropic
            * `Custom` - Custom

        provider_model_id : typing.Optional[str]
            The model ID to use within the given provider, e.g. gpt-3.5

        title : typing.Optional[str]
            Model name

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

        Returns
        -------
        ThirdPartyModelVersion


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


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


        asyncio.run(main())
        """
        _response = await self._raw_client.update(
            prompt_id,
            version_id,
            model_provider_connection=model_provider_connection,
            organization=organization,
            parent_model=parent_model,
            prompt=prompt,
            provider=provider,
            provider_model_id=provider_model_id,
            title=title,
            request_options=request_options,
        )
        return _response.data

    async def cost_estimate(
        self, prompt_id: int, version_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> InferenceRunCostEstimate:
        """
        <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 an estimate of the cost for making an inference run on the selected Prompt Version and Project/ProjectSubset

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

        version_id : int

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

        Returns
        -------
        InferenceRunCostEstimate
            Cost estimate response

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


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


        asyncio.run(main())
        """
        _response = await self._raw_client.cost_estimate(prompt_id, version_id, request_options=request_options)
        return _response.data

    async def get_refined_prompt(
        self,
        prompt_id: int,
        version_id: int,
        *,
        refinement_job_id: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> RefinedPromptResponse:
        """
        <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 the refined prompt based on the `refinement_job_id`.

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

        version_id : int

        refinement_job_id : typing.Optional[str]
            Refinement Job ID acquired from the `POST /api/prompts/{prompt_id}/versions/{version_id}/refine` endpoint

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

        Returns
        -------
        RefinedPromptResponse
            Refined prompt response

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


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


        asyncio.run(main())
        """
        _response = await self._raw_client.get_refined_prompt(
            prompt_id, version_id, refinement_job_id=refinement_job_id, request_options=request_options
        )
        return _response.data

    async def refine_prompt(
        self,
        prompt_id: int,
        version_id: int,
        *,
        project_id: int,
        teacher_model_name: str,
        teacher_model_provider_connection_id: int,
        async_: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> RefinedPromptResponse:
        """
        <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>
        Refine a prompt version using a teacher model and save the refined prompt as a new version.

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

        version_id : int

        project_id : int
            Project ID to target the refined prompt for

        teacher_model_name : str
            Name of the model to use to refine the prompt

        teacher_model_provider_connection_id : int
            Model Provider Connection ID to use to refine the prompt

        async_ : typing.Optional[bool]
            Whether to run the refinement asynchronously

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

        Returns
        -------
        RefinedPromptResponse
            Refined prompt response

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.prompts.versions.refine_prompt(
                prompt_id=1,
                version_id=1,
                project_id=1,
                teacher_model_name="teacher_model_name",
                teacher_model_provider_connection_id=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.refine_prompt(
            prompt_id,
            version_id,
            project_id=project_id,
            teacher_model_name=teacher_model_name,
            teacher_model_provider_connection_id=teacher_model_provider_connection_id,
            async_=async_,
            request_options=request_options,
        )
        return _response.data
