# 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.json_node_write import JsonNodeWrite
from ..types.prompt_detail import PromptDetail
from ..types.prompt_page_public import PromptPagePublic
from ..types.prompt_version_detail import PromptVersionDetail
from ..types.prompt_version_link_public import PromptVersionLinkPublic
from ..types.prompt_version_page_public import PromptVersionPagePublic
from ..types.prompt_version_update import PromptVersionUpdate
from .raw_client import AsyncRawPromptsClient, RawPromptsClient
from .types.create_prompt_version_detail_template_structure import CreatePromptVersionDetailTemplateStructure
from .types.prompt_write_template_structure import PromptWriteTemplateStructure
from .types.prompt_write_type import PromptWriteType

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


class PromptsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawPromptsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawPromptsClient
        """
        return self._raw_client

    def get_prompts(
        self,
        *,
        page: typing.Optional[int] = None,
        size: typing.Optional[int] = None,
        name: typing.Optional[str] = None,
        project_id: typing.Optional[str] = None,
        sorting: typing.Optional[str] = None,
        filters: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PromptPagePublic:
        """
        Get prompts

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

        size : typing.Optional[int]

        name : typing.Optional[str]

        project_id : typing.Optional[str]

        sorting : typing.Optional[str]

        filters : typing.Optional[str]

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

        Returns
        -------
        PromptPagePublic
            OK

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.prompts.get_prompts()
        """
        _response = self._raw_client.get_prompts(
            page=page,
            size=size,
            name=name,
            project_id=project_id,
            sorting=sorting,
            filters=filters,
            request_options=request_options,
        )
        return _response.data

    def create_prompt(
        self,
        *,
        name: str,
        id: typing.Optional[str] = OMIT,
        project_id: typing.Optional[str] = OMIT,
        project_name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        template: typing.Optional[str] = OMIT,
        metadata: typing.Optional[JsonNodeWrite] = OMIT,
        change_description: typing.Optional[str] = OMIT,
        type: typing.Optional[PromptWriteType] = OMIT,
        template_structure: typing.Optional[PromptWriteTemplateStructure] = OMIT,
        tags: typing.Optional[typing.Sequence[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Create prompt

        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 prompt is created at workspace level.

        description : typing.Optional[str]

        template : typing.Optional[str]

        metadata : typing.Optional[JsonNodeWrite]

        change_description : typing.Optional[str]

        type : typing.Optional[PromptWriteType]

        template_structure : typing.Optional[PromptWriteTemplateStructure]
            Template structure type: 'text' or 'chat'. Immutable after creation.

        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.prompts.create_prompt(name='name', )
        """
        _response = self._raw_client.create_prompt(
            name=name,
            id=id,
            project_id=project_id,
            project_name=project_name,
            description=description,
            template=template,
            metadata=metadata,
            change_description=change_description,
            type=type,
            template_structure=template_structure,
            tags=tags,
            request_options=request_options,
        )
        return _response.data

    def create_prompt_version(
        self,
        *,
        name: str,
        version: PromptVersionDetail,
        template_structure: typing.Optional[CreatePromptVersionDetailTemplateStructure] = OMIT,
        exclude_blueprint_update_for_projects: typing.Optional[typing.Sequence[str]] = OMIT,
        project_id: typing.Optional[str] = OMIT,
        project_name: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PromptVersionDetail:
        """
        Create prompt version

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

        version : PromptVersionDetail

        template_structure : typing.Optional[CreatePromptVersionDetailTemplateStructure]
            Template structure for the prompt: 'text' or 'chat'. Note: This field is only used when creating a new prompt. If a prompt with the given name already exists, this field is ignored and the existing prompt's template structure is used. Template structure is immutable after prompt creation.

        exclude_blueprint_update_for_projects : typing.Optional[typing.Sequence[str]]
            Optional set of project IDs to exclude from automatic blueprint creation when this prompt version is committed.

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

        project_name : typing.Optional[str]
            If provided, scopes the prompt to the specified project. Ignored when project_id is provided.

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

        Returns
        -------
        PromptVersionDetail
            OK

        Examples
        --------
        from Opik import OpikApi
        from Opik import PromptVersionDetail
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.prompts.create_prompt_version(name='name', version=PromptVersionDetail(template='template', ), )
        """
        _response = self._raw_client.create_prompt_version(
            name=name,
            version=version,
            template_structure=template_structure,
            exclude_blueprint_update_for_projects=exclude_blueprint_update_for_projects,
            project_id=project_id,
            project_name=project_name,
            request_options=request_options,
        )
        return _response.data

    def update_prompt_versions(
        self,
        *,
        ids: typing.Sequence[str],
        update: PromptVersionUpdate,
        merge_tags: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Update one or more prompt versions.

        Note: Prompt versions are immutable by design.
        Only organizational properties, such as tags etc., can be updated.
        Core properties like template and metadata cannot be modified after creation.

        PATCH semantics:
        - non-empty values update the field
        - null values preserve existing field values (no change)
        - empty values explicitly clear the field

        Parameters
        ----------
        ids : typing.Sequence[str]
            IDs of prompt versions to update

        update : PromptVersionUpdate

        merge_tags : typing.Optional[bool]
            Tag merge behavior:
            - true: Add new tags to existing tags (union)
            - false: Replace all existing tags with new tags (default behaviour if not provided)

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import PromptVersionUpdate
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.prompts.update_prompt_versions(ids=['ids'], update=PromptVersionUpdate(), )
        """
        _response = self._raw_client.update_prompt_versions(
            ids=ids, update=update, merge_tags=merge_tags, request_options=request_options
        )
        return _response.data

    def get_prompt_by_id(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> PromptDetail:
        """
        Get prompt by id

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

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

        Returns
        -------
        PromptDetail
            Prompt resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.prompts.get_prompt_by_id(id='id', )
        """
        _response = self._raw_client.get_prompt_by_id(id, request_options=request_options)
        return _response.data

    def update_prompt(
        self,
        id: str,
        *,
        name: str,
        description: typing.Optional[str] = OMIT,
        tags: typing.Optional[typing.Sequence[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Update prompt

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

        name : str

        description : typing.Optional[str]

        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.prompts.update_prompt(id='id', name='name', )
        """
        _response = self._raw_client.update_prompt(
            id, name=name, description=description, tags=tags, request_options=request_options
        )
        return _response.data

    def delete_prompt(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        Delete prompt

        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.prompts.delete_prompt(id='id', )
        """
        _response = self._raw_client.delete_prompt(id, request_options=request_options)
        return _response.data

    def delete_prompts_batch(
        self, *, ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
    ) -> None:
        """
        Delete prompts 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.prompts.delete_prompts_batch(ids=['ids'], )
        """
        _response = self._raw_client.delete_prompts_batch(ids=ids, request_options=request_options)
        return _response.data

    def get_prompt_by_commit(
        self, commit: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PromptDetail:
        """
        Get prompt by commit

        Parameters
        ----------
        commit : str

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

        Returns
        -------
        PromptDetail
            OK

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.prompts.get_prompt_by_commit(commit='commit', )
        """
        _response = self._raw_client.get_prompt_by_commit(commit, request_options=request_options)
        return _response.data

    def get_prompt_version_by_id(
        self, version_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PromptVersionDetail:
        """
        Get prompt version by id

        Parameters
        ----------
        version_id : str

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

        Returns
        -------
        PromptVersionDetail
            Prompt version resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.prompts.get_prompt_version_by_id(version_id='versionId', )
        """
        _response = self._raw_client.get_prompt_version_by_id(version_id, request_options=request_options)
        return _response.data

    def get_prompt_versions(
        self,
        id: str,
        *,
        page: typing.Optional[int] = None,
        size: typing.Optional[int] = None,
        search: typing.Optional[str] = None,
        sorting: typing.Optional[str] = None,
        filters: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PromptVersionPagePublic:
        """
        Get prompt versions

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

        page : typing.Optional[int]

        size : typing.Optional[int]

        search : typing.Optional[str]
            Search text to find in template or change description fields

        sorting : typing.Optional[str]

        filters : typing.Optional[str]

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

        Returns
        -------
        PromptVersionPagePublic
            OK

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.prompts.get_prompt_versions(id='id', )
        """
        _response = self._raw_client.get_prompt_versions(
            id, page=page, size=size, search=search, sorting=sorting, filters=filters, request_options=request_options
        )
        return _response.data

    def get_prompts_by_commits(
        self, *, commits: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[PromptVersionLinkPublic]:
        """
        Get prompts by prompt version commits

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

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

        Returns
        -------
        typing.List[PromptVersionLinkPublic]
            OK

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.prompts.get_prompts_by_commits(commits=['commits'], )
        """
        _response = self._raw_client.get_prompts_by_commits(commits=commits, request_options=request_options)
        return _response.data

    def restore_prompt_version(
        self, prompt_id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PromptVersionDetail:
        """
        Restore a prompt version by creating a new version with the content from the specified version

        Parameters
        ----------
        prompt_id : str

        version_id : str

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

        Returns
        -------
        PromptVersionDetail
            OK

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.prompts.restore_prompt_version(prompt_id='promptId', version_id='versionId', )
        """
        _response = self._raw_client.restore_prompt_version(prompt_id, version_id, request_options=request_options)
        return _response.data

    def retrieve_prompt_version(
        self,
        *,
        name: str,
        commit: typing.Optional[str] = OMIT,
        project_name: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PromptVersionDetail:
        """
        Retrieve prompt version

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

        commit : typing.Optional[str]

        project_name : typing.Optional[str]
            If provided, scopes the search to the specified project

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

        Returns
        -------
        PromptVersionDetail
            OK

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.prompts.retrieve_prompt_version(name='name', )
        """
        _response = self._raw_client.retrieve_prompt_version(
            name=name, commit=commit, project_name=project_name, request_options=request_options
        )
        return _response.data


class AsyncPromptsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawPromptsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawPromptsClient
        """
        return self._raw_client

    async def get_prompts(
        self,
        *,
        page: typing.Optional[int] = None,
        size: typing.Optional[int] = None,
        name: typing.Optional[str] = None,
        project_id: typing.Optional[str] = None,
        sorting: typing.Optional[str] = None,
        filters: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PromptPagePublic:
        """
        Get prompts

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

        size : typing.Optional[int]

        name : typing.Optional[str]

        project_id : typing.Optional[str]

        sorting : typing.Optional[str]

        filters : typing.Optional[str]

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

        Returns
        -------
        PromptPagePublic
            OK

        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.prompts.get_prompts()
        asyncio.run(main())
        """
        _response = await self._raw_client.get_prompts(
            page=page,
            size=size,
            name=name,
            project_id=project_id,
            sorting=sorting,
            filters=filters,
            request_options=request_options,
        )
        return _response.data

    async def create_prompt(
        self,
        *,
        name: str,
        id: typing.Optional[str] = OMIT,
        project_id: typing.Optional[str] = OMIT,
        project_name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        template: typing.Optional[str] = OMIT,
        metadata: typing.Optional[JsonNodeWrite] = OMIT,
        change_description: typing.Optional[str] = OMIT,
        type: typing.Optional[PromptWriteType] = OMIT,
        template_structure: typing.Optional[PromptWriteTemplateStructure] = OMIT,
        tags: typing.Optional[typing.Sequence[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Create prompt

        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 prompt is created at workspace level.

        description : typing.Optional[str]

        template : typing.Optional[str]

        metadata : typing.Optional[JsonNodeWrite]

        change_description : typing.Optional[str]

        type : typing.Optional[PromptWriteType]

        template_structure : typing.Optional[PromptWriteTemplateStructure]
            Template structure type: 'text' or 'chat'. Immutable after creation.

        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.prompts.create_prompt(name='name', )
        asyncio.run(main())
        """
        _response = await self._raw_client.create_prompt(
            name=name,
            id=id,
            project_id=project_id,
            project_name=project_name,
            description=description,
            template=template,
            metadata=metadata,
            change_description=change_description,
            type=type,
            template_structure=template_structure,
            tags=tags,
            request_options=request_options,
        )
        return _response.data

    async def create_prompt_version(
        self,
        *,
        name: str,
        version: PromptVersionDetail,
        template_structure: typing.Optional[CreatePromptVersionDetailTemplateStructure] = OMIT,
        exclude_blueprint_update_for_projects: typing.Optional[typing.Sequence[str]] = OMIT,
        project_id: typing.Optional[str] = OMIT,
        project_name: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PromptVersionDetail:
        """
        Create prompt version

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

        version : PromptVersionDetail

        template_structure : typing.Optional[CreatePromptVersionDetailTemplateStructure]
            Template structure for the prompt: 'text' or 'chat'. Note: This field is only used when creating a new prompt. If a prompt with the given name already exists, this field is ignored and the existing prompt's template structure is used. Template structure is immutable after prompt creation.

        exclude_blueprint_update_for_projects : typing.Optional[typing.Sequence[str]]
            Optional set of project IDs to exclude from automatic blueprint creation when this prompt version is committed.

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

        project_name : typing.Optional[str]
            If provided, scopes the prompt to the specified project. Ignored when project_id is provided.

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

        Returns
        -------
        PromptVersionDetail
            OK

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import PromptVersionDetail
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.prompts.create_prompt_version(name='name', version=PromptVersionDetail(template='template', ), )
        asyncio.run(main())
        """
        _response = await self._raw_client.create_prompt_version(
            name=name,
            version=version,
            template_structure=template_structure,
            exclude_blueprint_update_for_projects=exclude_blueprint_update_for_projects,
            project_id=project_id,
            project_name=project_name,
            request_options=request_options,
        )
        return _response.data

    async def update_prompt_versions(
        self,
        *,
        ids: typing.Sequence[str],
        update: PromptVersionUpdate,
        merge_tags: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Update one or more prompt versions.

        Note: Prompt versions are immutable by design.
        Only organizational properties, such as tags etc., can be updated.
        Core properties like template and metadata cannot be modified after creation.

        PATCH semantics:
        - non-empty values update the field
        - null values preserve existing field values (no change)
        - empty values explicitly clear the field

        Parameters
        ----------
        ids : typing.Sequence[str]
            IDs of prompt versions to update

        update : PromptVersionUpdate

        merge_tags : typing.Optional[bool]
            Tag merge behavior:
            - true: Add new tags to existing tags (union)
            - false: Replace all existing tags with new tags (default behaviour if not provided)

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import PromptVersionUpdate
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.prompts.update_prompt_versions(ids=['ids'], update=PromptVersionUpdate(), )
        asyncio.run(main())
        """
        _response = await self._raw_client.update_prompt_versions(
            ids=ids, update=update, merge_tags=merge_tags, request_options=request_options
        )
        return _response.data

    async def get_prompt_by_id(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PromptDetail:
        """
        Get prompt by id

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

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

        Returns
        -------
        PromptDetail
            Prompt 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.prompts.get_prompt_by_id(id='id', )
        asyncio.run(main())
        """
        _response = await self._raw_client.get_prompt_by_id(id, request_options=request_options)
        return _response.data

    async def update_prompt(
        self,
        id: str,
        *,
        name: str,
        description: typing.Optional[str] = OMIT,
        tags: typing.Optional[typing.Sequence[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Update prompt

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

        name : str

        description : typing.Optional[str]

        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.prompts.update_prompt(id='id', name='name', )
        asyncio.run(main())
        """
        _response = await self._raw_client.update_prompt(
            id, name=name, description=description, tags=tags, request_options=request_options
        )
        return _response.data

    async def delete_prompt(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        Delete prompt

        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.prompts.delete_prompt(id='id', )
        asyncio.run(main())
        """
        _response = await self._raw_client.delete_prompt(id, request_options=request_options)
        return _response.data

    async def delete_prompts_batch(
        self, *, ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
    ) -> None:
        """
        Delete prompts 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.prompts.delete_prompts_batch(ids=['ids'], )
        asyncio.run(main())
        """
        _response = await self._raw_client.delete_prompts_batch(ids=ids, request_options=request_options)
        return _response.data

    async def get_prompt_by_commit(
        self, commit: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PromptDetail:
        """
        Get prompt by commit

        Parameters
        ----------
        commit : str

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

        Returns
        -------
        PromptDetail
            OK

        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.prompts.get_prompt_by_commit(commit='commit', )
        asyncio.run(main())
        """
        _response = await self._raw_client.get_prompt_by_commit(commit, request_options=request_options)
        return _response.data

    async def get_prompt_version_by_id(
        self, version_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PromptVersionDetail:
        """
        Get prompt version by id

        Parameters
        ----------
        version_id : str

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

        Returns
        -------
        PromptVersionDetail
            Prompt version 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.prompts.get_prompt_version_by_id(version_id='versionId', )
        asyncio.run(main())
        """
        _response = await self._raw_client.get_prompt_version_by_id(version_id, request_options=request_options)
        return _response.data

    async def get_prompt_versions(
        self,
        id: str,
        *,
        page: typing.Optional[int] = None,
        size: typing.Optional[int] = None,
        search: typing.Optional[str] = None,
        sorting: typing.Optional[str] = None,
        filters: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PromptVersionPagePublic:
        """
        Get prompt versions

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

        page : typing.Optional[int]

        size : typing.Optional[int]

        search : typing.Optional[str]
            Search text to find in template or change description fields

        sorting : typing.Optional[str]

        filters : typing.Optional[str]

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

        Returns
        -------
        PromptVersionPagePublic
            OK

        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.prompts.get_prompt_versions(id='id', )
        asyncio.run(main())
        """
        _response = await self._raw_client.get_prompt_versions(
            id, page=page, size=size, search=search, sorting=sorting, filters=filters, request_options=request_options
        )
        return _response.data

    async def get_prompts_by_commits(
        self, *, commits: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[PromptVersionLinkPublic]:
        """
        Get prompts by prompt version commits

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

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

        Returns
        -------
        typing.List[PromptVersionLinkPublic]
            OK

        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.prompts.get_prompts_by_commits(commits=['commits'], )
        asyncio.run(main())
        """
        _response = await self._raw_client.get_prompts_by_commits(commits=commits, request_options=request_options)
        return _response.data

    async def restore_prompt_version(
        self, prompt_id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PromptVersionDetail:
        """
        Restore a prompt version by creating a new version with the content from the specified version

        Parameters
        ----------
        prompt_id : str

        version_id : str

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

        Returns
        -------
        PromptVersionDetail
            OK

        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.prompts.restore_prompt_version(prompt_id='promptId', version_id='versionId', )
        asyncio.run(main())
        """
        _response = await self._raw_client.restore_prompt_version(
            prompt_id, version_id, request_options=request_options
        )
        return _response.data

    async def retrieve_prompt_version(
        self,
        *,
        name: str,
        commit: typing.Optional[str] = OMIT,
        project_name: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PromptVersionDetail:
        """
        Retrieve prompt version

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

        commit : typing.Optional[str]

        project_name : typing.Optional[str]
            If provided, scopes the search to the specified project

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

        Returns
        -------
        PromptVersionDetail
            OK

        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.prompts.retrieve_prompt_version(name='name', )
        asyncio.run(main())
        """
        _response = await self._raw_client.retrieve_prompt_version(
            name=name, commit=commit, project_name=project_name, request_options=request_options
        )
        return _response.data
