# 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.app_api_v1schemas_assistants_audit_log_list_response import AppApiV1SchemasAssistantsAuditLogListResponse
from ..types.assistant_list_response import AssistantListResponse
from ..types.assistant_response import AssistantResponse
from ..types.convert_to_workflow_response import ConvertToWorkflowResponse
from ..types.detach_workflow_response import DetachWorkflowResponse
from ..types.reasoning_config_schema import ReasoningConfigSchema
from ..types.tool_configuration_schema import ToolConfigurationSchema
from ..types.workflow_response import WorkflowResponse
from .raw_client import AsyncRawAssistantsClient, RawAssistantsClient

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


class AssistantsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawAssistantsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawAssistantsClient
        """
        return self._raw_client

    def list_assistants(
        self,
        *,
        organization_id: str,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        search: typing.Optional[str] = None,
        access_mode: typing.Optional[str] = None,
        vector_store_id: typing.Optional[str] = None,
        visible_in_chat: typing.Optional[bool] = None,
        for_chat: typing.Optional[bool] = None,
        include_inactive: typing.Optional[bool] = None,
        sort_by: typing.Optional[str] = None,
        sort_order: typing.Optional[str] = None,
        fields: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AssistantListResponse:
        """
        List assistants for an organization with filters.

        Only returns assistants the user has access to.
        Fields parameter controls response detail:
        - summary: Minimal fields for list views
        - standard: Summary + model configuration
        - full: Complete assistant objects

        Filters:
        - vector_store_id: Only return assistants using this vector store
        - visible_in_chat: Only return assistants visible in chat interface (respects visible_in_chat_to_users)
        - for_chat: [DEPRECATED] Use visible_in_chat instead. Maintained for backward compatibility.

        Parameters
        ----------
        organization_id : str
            Organization ID

        limit : typing.Optional[int]
            Items per page

        offset : typing.Optional[int]
            Number of items to skip

        search : typing.Optional[str]
            Search term

        access_mode : typing.Optional[str]
            Filter by access mode

        vector_store_id : typing.Optional[str]
            Filter by vector store ID

        visible_in_chat : typing.Optional[bool]
            Filter for chat interface visibility

        for_chat : typing.Optional[bool]
            [DEPRECATED] Use visible_in_chat instead. Maintained for backward compatibility.

        include_inactive : typing.Optional[bool]
            Include inactive assistants

        sort_by : typing.Optional[str]
            Sort field

        sort_order : typing.Optional[str]
            Sort direction

        fields : typing.Optional[str]
            Response detail level: summary, standard, full

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

        Returns
        -------
        AssistantListResponse
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.assistants.list_assistants(
            organization_id="organization_id",
        )
        """
        _response = self._raw_client.list_assistants(
            organization_id=organization_id,
            limit=limit,
            offset=offset,
            search=search,
            access_mode=access_mode,
            vector_store_id=vector_store_id,
            visible_in_chat=visible_in_chat,
            for_chat=for_chat,
            include_inactive=include_inactive,
            sort_by=sort_by,
            sort_order=sort_order,
            fields=fields,
            request_options=request_options,
        )
        return _response.data

    def create_assistant(
        self,
        *,
        name: str,
        organization_id: str,
        description: typing.Optional[str] = OMIT,
        avatar_id: typing.Optional[str] = OMIT,
        icon_id: typing.Optional[str] = OMIT,
        icon_type: typing.Optional[str] = OMIT,
        icon_data: typing.Optional[str] = OMIT,
        is_default: typing.Optional[bool] = OMIT,
        default_model_key: typing.Optional[str] = OMIT,
        allowed_model_providers: typing.Optional[typing.Sequence[str]] = OMIT,
        allowed_models: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        instructions: typing.Optional[str] = OMIT,
        instructions_thread_id: typing.Optional[str] = OMIT,
        system_message: typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]] = OMIT,
        context_strategy: typing.Optional[str] = OMIT,
        context_window: typing.Optional[int] = OMIT,
        max_tool_calls: typing.Optional[int] = OMIT,
        parallel_tool_calls: typing.Optional[bool] = OMIT,
        service_tier: typing.Optional[str] = OMIT,
        store_responses: typing.Optional[bool] = OMIT,
        temperature: typing.Optional[float] = OMIT,
        frequency_penalty: typing.Optional[float] = OMIT,
        presence_penalty: typing.Optional[float] = OMIT,
        logit_bias: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        top_logprobs: typing.Optional[int] = OMIT,
        top_p: typing.Optional[float] = OMIT,
        output_mode: typing.Optional[str] = OMIT,
        response_format: typing.Optional[str] = OMIT,
        seed: typing.Optional[int] = OMIT,
        stop_sequences: typing.Optional[typing.Sequence[str]] = OMIT,
        max_completion_tokens: typing.Optional[int] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        access_departments: typing.Optional[typing.Sequence[str]] = OMIT,
        access_users: typing.Optional[typing.Sequence[str]] = OMIT,
        editable_by_users: typing.Optional[typing.Sequence[str]] = OMIT,
        visible_in_chat_to_users: typing.Optional[typing.Sequence[str]] = OMIT,
        editable_by_roles: typing.Optional[typing.Sequence[str]] = OMIT,
        visible_to_roles: typing.Optional[typing.Sequence[str]] = OMIT,
        api_enabled: typing.Optional[bool] = OMIT,
        public_enabled: typing.Optional[bool] = OMIT,
        is_active: typing.Optional[bool] = OMIT,
        streaming: typing.Optional[bool] = OMIT,
        memory_enabled: typing.Optional[bool] = OMIT,
        moderation_enabled: typing.Optional[bool] = OMIT,
        safety_level: typing.Optional[str] = OMIT,
        truncation: typing.Optional[bool] = OMIT,
        preset_prompts: typing.Optional[typing.Sequence[str]] = OMIT,
        metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        text_config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        voice_profile_id: typing.Optional[str] = OMIT,
        tool_configurations: typing.Optional[ToolConfigurationSchema] = OMIT,
        reasoning: typing.Optional[ReasoningConfigSchema] = OMIT,
        vector_store_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        slice_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        json_schemas: typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]] = OMIT,
        rule_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AssistantResponse:
        """
        Create a new assistant.

        The current user will be set as the creator.

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

        organization_id : str
            Organization ID

        description : typing.Optional[str]
            Assistant description

        avatar_id : typing.Optional[str]
            Avatar ID

        icon_id : typing.Optional[str]
            Icon ID (icon_ prefixed)

        icon_type : typing.Optional[str]
            Icon type (deprecated)

        icon_data : typing.Optional[str]
            Icon data (deprecated)

        is_default : typing.Optional[bool]
            Is default assistant

        default_model_key : typing.Optional[str]
            Default model key

        allowed_model_providers : typing.Optional[typing.Sequence[str]]
            Allowed model providers

        allowed_models : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]
            Per-provider model selection. Keys are provider slugs, values are lists of allowed model keys or null for all models from that provider. Example: {"openai": ["gpt-4o", "gpt-4o-mini"], "anthropic": null}

        instructions : typing.Optional[str]
            System instructions

        instructions_thread_id : typing.Optional[str]
            Instructions thread ID

        system_message : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
            System messages

        context_strategy : typing.Optional[str]
            Context management strategy

        context_window : typing.Optional[int]
            Context window size

        max_tool_calls : typing.Optional[int]
            Max tool calls

        parallel_tool_calls : typing.Optional[bool]
            Allow parallel tool calls

        service_tier : typing.Optional[str]
            Service tier

        store_responses : typing.Optional[bool]
            Store responses

        temperature : typing.Optional[float]
            Randomness (0.0-1.0). Lower=focused, higher=creative

        frequency_penalty : typing.Optional[float]
            Frequency penalty

        presence_penalty : typing.Optional[float]
            Presence penalty

        logit_bias : typing.Optional[typing.Dict[str, typing.Any]]
            Logit bias

        top_logprobs : typing.Optional[int]
            Top log probs

        top_p : typing.Optional[float]
            Top P

        output_mode : typing.Optional[str]
            Output mode

        response_format : typing.Optional[str]
            Response format

        seed : typing.Optional[int]
            Random seed

        stop_sequences : typing.Optional[typing.Sequence[str]]
            Stop sequences

        max_completion_tokens : typing.Optional[int]
            Max completion tokens

        access_mode : typing.Optional[str]
            Access mode: private, organization, department, public

        access_departments : typing.Optional[typing.Sequence[str]]
            Department IDs with access (required when access_mode is 'department')

        access_users : typing.Optional[typing.Sequence[str]]
            User IDs with access

        editable_by_users : typing.Optional[typing.Sequence[str]]
            User IDs that can edit. Use ['*'] for all organization members

        visible_in_chat_to_users : typing.Optional[typing.Sequence[str]]
            User IDs that can see assistant in chat interface

        editable_by_roles : typing.Optional[typing.Sequence[str]]
            Role IDs that can edit

        visible_to_roles : typing.Optional[typing.Sequence[str]]
            Role IDs that can view

        api_enabled : typing.Optional[bool]
            API enabled

        public_enabled : typing.Optional[bool]
            Public enabled

        is_active : typing.Optional[bool]
            Is active

        streaming : typing.Optional[bool]
            Streaming enabled

        memory_enabled : typing.Optional[bool]
            Memory enabled

        moderation_enabled : typing.Optional[bool]
            Moderation enabled

        safety_level : typing.Optional[str]
            Safety level

        truncation : typing.Optional[bool]
            Auto-truncate messages exceeding context window

        preset_prompts : typing.Optional[typing.Sequence[str]]
            Preset prompts

        metadata : typing.Optional[typing.Dict[str, typing.Any]]
            Custom metadata

        text_config : typing.Optional[typing.Dict[str, typing.Any]]
            Text configuration

        voice_profile_id : typing.Optional[str]
            Voice profile ID for meeting identity

        tool_configurations : typing.Optional[ToolConfigurationSchema]
            Tool configurations

        reasoning : typing.Optional[ReasoningConfigSchema]
            Reasoning configuration

        vector_store_ids : typing.Optional[typing.Sequence[str]]
            Vector store IDs

        slice_ids : typing.Optional[typing.Sequence[str]]
            Knowledge slice IDs to attach

        json_schemas : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
            JSON schemas

        rule_ids : typing.Optional[typing.Sequence[str]]
            Rule IDs to attach to assistant

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

        Returns
        -------
        AssistantResponse
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.assistants.create_assistant(
            name="name",
            organization_id="organization_id",
        )
        """
        _response = self._raw_client.create_assistant(
            name=name,
            organization_id=organization_id,
            description=description,
            avatar_id=avatar_id,
            icon_id=icon_id,
            icon_type=icon_type,
            icon_data=icon_data,
            is_default=is_default,
            default_model_key=default_model_key,
            allowed_model_providers=allowed_model_providers,
            allowed_models=allowed_models,
            instructions=instructions,
            instructions_thread_id=instructions_thread_id,
            system_message=system_message,
            context_strategy=context_strategy,
            context_window=context_window,
            max_tool_calls=max_tool_calls,
            parallel_tool_calls=parallel_tool_calls,
            service_tier=service_tier,
            store_responses=store_responses,
            temperature=temperature,
            frequency_penalty=frequency_penalty,
            presence_penalty=presence_penalty,
            logit_bias=logit_bias,
            top_logprobs=top_logprobs,
            top_p=top_p,
            output_mode=output_mode,
            response_format=response_format,
            seed=seed,
            stop_sequences=stop_sequences,
            max_completion_tokens=max_completion_tokens,
            access_mode=access_mode,
            access_departments=access_departments,
            access_users=access_users,
            editable_by_users=editable_by_users,
            visible_in_chat_to_users=visible_in_chat_to_users,
            editable_by_roles=editable_by_roles,
            visible_to_roles=visible_to_roles,
            api_enabled=api_enabled,
            public_enabled=public_enabled,
            is_active=is_active,
            streaming=streaming,
            memory_enabled=memory_enabled,
            moderation_enabled=moderation_enabled,
            safety_level=safety_level,
            truncation=truncation,
            preset_prompts=preset_prompts,
            metadata=metadata,
            text_config=text_config,
            voice_profile_id=voice_profile_id,
            tool_configurations=tool_configurations,
            reasoning=reasoning,
            vector_store_ids=vector_store_ids,
            slice_ids=slice_ids,
            json_schemas=json_schemas,
            rule_ids=rule_ids,
            request_options=request_options,
        )
        return _response.data

    def get_assistant(
        self, assistant_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AssistantResponse:
        """
        Get a specific assistant by ID.

        Parameters
        ----------
        assistant_id : str

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

        Returns
        -------
        AssistantResponse
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.assistants.get_assistant(
            assistant_id="assistant_id",
        )
        """
        _response = self._raw_client.get_assistant(assistant_id, request_options=request_options)
        return _response.data

    def update_assistant(
        self,
        assistant_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        avatar_id: typing.Optional[str] = OMIT,
        icon_id: typing.Optional[str] = OMIT,
        icon_type: typing.Optional[str] = OMIT,
        icon_data: typing.Optional[str] = OMIT,
        is_default: typing.Optional[bool] = OMIT,
        default_model_key: typing.Optional[str] = OMIT,
        allowed_model_providers: typing.Optional[typing.Sequence[str]] = OMIT,
        allowed_models: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        instructions: typing.Optional[str] = OMIT,
        instructions_thread_id: typing.Optional[str] = OMIT,
        system_message: typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]] = OMIT,
        context_strategy: typing.Optional[str] = OMIT,
        context_window: typing.Optional[int] = OMIT,
        max_tool_calls: typing.Optional[int] = OMIT,
        parallel_tool_calls: typing.Optional[bool] = OMIT,
        service_tier: typing.Optional[str] = OMIT,
        store_responses: typing.Optional[bool] = OMIT,
        temperature: typing.Optional[float] = OMIT,
        frequency_penalty: typing.Optional[float] = OMIT,
        presence_penalty: typing.Optional[float] = OMIT,
        logit_bias: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        top_logprobs: typing.Optional[int] = OMIT,
        top_p: typing.Optional[float] = OMIT,
        output_mode: typing.Optional[str] = OMIT,
        response_format: typing.Optional[str] = OMIT,
        seed: typing.Optional[int] = OMIT,
        stop_sequences: typing.Optional[typing.Sequence[str]] = OMIT,
        max_completion_tokens: typing.Optional[int] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        access_departments: typing.Optional[typing.Sequence[str]] = OMIT,
        access_users: typing.Optional[typing.Sequence[str]] = OMIT,
        editable_by_users: typing.Optional[typing.Sequence[str]] = OMIT,
        visible_in_chat_to_users: typing.Optional[typing.Sequence[str]] = OMIT,
        editable_by_roles: typing.Optional[typing.Sequence[str]] = OMIT,
        visible_to_roles: typing.Optional[typing.Sequence[str]] = OMIT,
        api_enabled: typing.Optional[bool] = OMIT,
        public_enabled: typing.Optional[bool] = OMIT,
        is_active: typing.Optional[bool] = OMIT,
        streaming: typing.Optional[bool] = OMIT,
        memory_enabled: typing.Optional[bool] = OMIT,
        moderation_enabled: typing.Optional[bool] = OMIT,
        safety_level: typing.Optional[str] = OMIT,
        truncation: typing.Optional[bool] = OMIT,
        preset_prompts: typing.Optional[typing.Sequence[str]] = OMIT,
        assistant_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        text_config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        tool_configurations: typing.Optional[ToolConfigurationSchema] = OMIT,
        reasoning: typing.Optional[ReasoningConfigSchema] = OMIT,
        vector_store_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        slice_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        rule_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        voice_profile_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AssistantResponse:
        """
        Update an existing assistant.

        Parameters
        ----------
        assistant_id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

        avatar_id : typing.Optional[str]

        icon_id : typing.Optional[str]

        icon_type : typing.Optional[str]

        icon_data : typing.Optional[str]

        is_default : typing.Optional[bool]

        default_model_key : typing.Optional[str]

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

        allowed_models : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]

        instructions : typing.Optional[str]

        instructions_thread_id : typing.Optional[str]

        system_message : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]

        context_strategy : typing.Optional[str]

        context_window : typing.Optional[int]

        max_tool_calls : typing.Optional[int]

        parallel_tool_calls : typing.Optional[bool]

        service_tier : typing.Optional[str]

        store_responses : typing.Optional[bool]

        temperature : typing.Optional[float]
            Randomness (0.0-1.0). Lower=focused, higher=creative

        frequency_penalty : typing.Optional[float]

        presence_penalty : typing.Optional[float]

        logit_bias : typing.Optional[typing.Dict[str, typing.Any]]

        top_logprobs : typing.Optional[int]

        top_p : typing.Optional[float]

        output_mode : typing.Optional[str]

        response_format : typing.Optional[str]

        seed : typing.Optional[int]

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

        max_completion_tokens : typing.Optional[int]

        access_mode : typing.Optional[str]
            Access mode: private, organization, department, public

        access_departments : typing.Optional[typing.Sequence[str]]
            Department IDs with access (required when access_mode is 'department')

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

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

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

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

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

        api_enabled : typing.Optional[bool]

        public_enabled : typing.Optional[bool]

        is_active : typing.Optional[bool]

        streaming : typing.Optional[bool]

        memory_enabled : typing.Optional[bool]

        moderation_enabled : typing.Optional[bool]

        safety_level : typing.Optional[str]

        truncation : typing.Optional[bool]

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

        assistant_metadata : typing.Optional[typing.Dict[str, typing.Any]]

        text_config : typing.Optional[typing.Dict[str, typing.Any]]

        tool_configurations : typing.Optional[ToolConfigurationSchema]

        reasoning : typing.Optional[ReasoningConfigSchema]

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

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

        rule_ids : typing.Optional[typing.Sequence[str]]
            Rule IDs to attach/replace on assistant

        voice_profile_id : typing.Optional[str]

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

        Returns
        -------
        AssistantResponse
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.assistants.update_assistant(
            assistant_id="assistant_id",
        )
        """
        _response = self._raw_client.update_assistant(
            assistant_id,
            name=name,
            description=description,
            avatar_id=avatar_id,
            icon_id=icon_id,
            icon_type=icon_type,
            icon_data=icon_data,
            is_default=is_default,
            default_model_key=default_model_key,
            allowed_model_providers=allowed_model_providers,
            allowed_models=allowed_models,
            instructions=instructions,
            instructions_thread_id=instructions_thread_id,
            system_message=system_message,
            context_strategy=context_strategy,
            context_window=context_window,
            max_tool_calls=max_tool_calls,
            parallel_tool_calls=parallel_tool_calls,
            service_tier=service_tier,
            store_responses=store_responses,
            temperature=temperature,
            frequency_penalty=frequency_penalty,
            presence_penalty=presence_penalty,
            logit_bias=logit_bias,
            top_logprobs=top_logprobs,
            top_p=top_p,
            output_mode=output_mode,
            response_format=response_format,
            seed=seed,
            stop_sequences=stop_sequences,
            max_completion_tokens=max_completion_tokens,
            access_mode=access_mode,
            access_departments=access_departments,
            access_users=access_users,
            editable_by_users=editable_by_users,
            visible_in_chat_to_users=visible_in_chat_to_users,
            editable_by_roles=editable_by_roles,
            visible_to_roles=visible_to_roles,
            api_enabled=api_enabled,
            public_enabled=public_enabled,
            is_active=is_active,
            streaming=streaming,
            memory_enabled=memory_enabled,
            moderation_enabled=moderation_enabled,
            safety_level=safety_level,
            truncation=truncation,
            preset_prompts=preset_prompts,
            assistant_metadata=assistant_metadata,
            text_config=text_config,
            tool_configurations=tool_configurations,
            reasoning=reasoning,
            vector_store_ids=vector_store_ids,
            slice_ids=slice_ids,
            rule_ids=rule_ids,
            voice_profile_id=voice_profile_id,
            request_options=request_options,
        )
        return _response.data

    def delete_assistant(self, assistant_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        Soft delete an assistant.

        Parameters
        ----------
        assistant_id : str

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

        Returns
        -------
        None

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.assistants.delete_assistant(
            assistant_id="assistant_id",
        )
        """
        _response = self._raw_client.delete_assistant(assistant_id, request_options=request_options)
        return _response.data

    def get_assistant_history(
        self,
        assistant_id: str,
        *,
        action: typing.Optional[str] = None,
        user_id: typing.Optional[str] = None,
        start_date: typing.Optional[str] = None,
        end_date: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AppApiV1SchemasAssistantsAuditLogListResponse:
        """
        Get audit history for an assistant.

        Parameters
        ----------
        assistant_id : str

        action : typing.Optional[str]
            Filter by action

        user_id : typing.Optional[str]
            Filter by user

        start_date : typing.Optional[str]
            Start date (ISO 8601)

        end_date : typing.Optional[str]
            End date (ISO 8601)

        limit : typing.Optional[int]
            Items per page

        offset : typing.Optional[int]
            Number of items to skip

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

        Returns
        -------
        AppApiV1SchemasAssistantsAuditLogListResponse
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.assistants.get_assistant_history(
            assistant_id="assistant_id",
        )
        """
        _response = self._raw_client.get_assistant_history(
            assistant_id,
            action=action,
            user_id=user_id,
            start_date=start_date,
            end_date=end_date,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    def convert_assistant_to_workflow(
        self,
        assistant_id: str,
        *,
        workflow_name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ConvertToWorkflowResponse:
        """
        Convert an assistant to use a workflow.

        Parameters
        ----------
        assistant_id : str

        workflow_name : typing.Optional[str]
            Workflow name (defaults to '{assistant.name} Workflow')

        description : typing.Optional[str]
            Workflow description

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

        Returns
        -------
        ConvertToWorkflowResponse
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.assistants.convert_assistant_to_workflow(
            assistant_id="assistant_id",
        )
        """
        _response = self._raw_client.convert_assistant_to_workflow(
            assistant_id, workflow_name=workflow_name, description=description, request_options=request_options
        )
        return _response.data

    def get_assistant_workflow(
        self, assistant_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> WorkflowResponse:
        """
        Get the workflow linked to an assistant.

        Parameters
        ----------
        assistant_id : str

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

        Returns
        -------
        WorkflowResponse
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.assistants.get_assistant_workflow(
            assistant_id="assistant_id",
        )
        """
        _response = self._raw_client.get_assistant_workflow(assistant_id, request_options=request_options)
        return _response.data

    def detach_assistant_workflow(
        self, assistant_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DetachWorkflowResponse:
        """
        Detach the workflow from an assistant (does not delete the workflow).

        Parameters
        ----------
        assistant_id : str

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

        Returns
        -------
        DetachWorkflowResponse
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.assistants.detach_assistant_workflow(
            assistant_id="assistant_id",
        )
        """
        _response = self._raw_client.detach_assistant_workflow(assistant_id, request_options=request_options)
        return _response.data

    def update_assistant_workflow(
        self,
        assistant_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        definition: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        is_active: typing.Optional[bool] = OMIT,
        external_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> WorkflowResponse:
        """
        Update the workflow linked to an assistant.

        Parameters
        ----------
        assistant_id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

        definition : typing.Optional[typing.Dict[str, typing.Any]]
            Updated workflow definition

        is_active : typing.Optional[bool]
            Active status

        external_id : typing.Optional[str]
            Flow-plate internal flow ID for correlation

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

        Returns
        -------
        WorkflowResponse
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.assistants.update_assistant_workflow(
            assistant_id="assistant_id",
        )
        """
        _response = self._raw_client.update_assistant_workflow(
            assistant_id,
            name=name,
            description=description,
            definition=definition,
            is_active=is_active,
            external_id=external_id,
            request_options=request_options,
        )
        return _response.data

    def warm_assistant_cache(
        self, assistant_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Dict[str, typing.Any]:
        """
        Pre-warm the cache for an assistant.

        Fetches the assistant from the database (warming the page cache)
        and stores the context in cache so subsequent conversation requests skip
        the DB query entirely (~10-50ms saved per request).

        TTL: 30 minutes. Typically called by Flow-Plate after saving a flow that
        contains an assistant node.

        Returns the assistant_id and cache status.

        Parameters
        ----------
        assistant_id : str

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

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.assistants.warm_assistant_cache(
            assistant_id="assistant_id",
        )
        """
        _response = self._raw_client.warm_assistant_cache(assistant_id, request_options=request_options)
        return _response.data


class AsyncAssistantsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawAssistantsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawAssistantsClient
        """
        return self._raw_client

    async def list_assistants(
        self,
        *,
        organization_id: str,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        search: typing.Optional[str] = None,
        access_mode: typing.Optional[str] = None,
        vector_store_id: typing.Optional[str] = None,
        visible_in_chat: typing.Optional[bool] = None,
        for_chat: typing.Optional[bool] = None,
        include_inactive: typing.Optional[bool] = None,
        sort_by: typing.Optional[str] = None,
        sort_order: typing.Optional[str] = None,
        fields: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AssistantListResponse:
        """
        List assistants for an organization with filters.

        Only returns assistants the user has access to.
        Fields parameter controls response detail:
        - summary: Minimal fields for list views
        - standard: Summary + model configuration
        - full: Complete assistant objects

        Filters:
        - vector_store_id: Only return assistants using this vector store
        - visible_in_chat: Only return assistants visible in chat interface (respects visible_in_chat_to_users)
        - for_chat: [DEPRECATED] Use visible_in_chat instead. Maintained for backward compatibility.

        Parameters
        ----------
        organization_id : str
            Organization ID

        limit : typing.Optional[int]
            Items per page

        offset : typing.Optional[int]
            Number of items to skip

        search : typing.Optional[str]
            Search term

        access_mode : typing.Optional[str]
            Filter by access mode

        vector_store_id : typing.Optional[str]
            Filter by vector store ID

        visible_in_chat : typing.Optional[bool]
            Filter for chat interface visibility

        for_chat : typing.Optional[bool]
            [DEPRECATED] Use visible_in_chat instead. Maintained for backward compatibility.

        include_inactive : typing.Optional[bool]
            Include inactive assistants

        sort_by : typing.Optional[str]
            Sort field

        sort_order : typing.Optional[str]
            Sort direction

        fields : typing.Optional[str]
            Response detail level: summary, standard, full

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

        Returns
        -------
        AssistantListResponse
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.assistants.list_assistants(
                organization_id="organization_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_assistants(
            organization_id=organization_id,
            limit=limit,
            offset=offset,
            search=search,
            access_mode=access_mode,
            vector_store_id=vector_store_id,
            visible_in_chat=visible_in_chat,
            for_chat=for_chat,
            include_inactive=include_inactive,
            sort_by=sort_by,
            sort_order=sort_order,
            fields=fields,
            request_options=request_options,
        )
        return _response.data

    async def create_assistant(
        self,
        *,
        name: str,
        organization_id: str,
        description: typing.Optional[str] = OMIT,
        avatar_id: typing.Optional[str] = OMIT,
        icon_id: typing.Optional[str] = OMIT,
        icon_type: typing.Optional[str] = OMIT,
        icon_data: typing.Optional[str] = OMIT,
        is_default: typing.Optional[bool] = OMIT,
        default_model_key: typing.Optional[str] = OMIT,
        allowed_model_providers: typing.Optional[typing.Sequence[str]] = OMIT,
        allowed_models: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        instructions: typing.Optional[str] = OMIT,
        instructions_thread_id: typing.Optional[str] = OMIT,
        system_message: typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]] = OMIT,
        context_strategy: typing.Optional[str] = OMIT,
        context_window: typing.Optional[int] = OMIT,
        max_tool_calls: typing.Optional[int] = OMIT,
        parallel_tool_calls: typing.Optional[bool] = OMIT,
        service_tier: typing.Optional[str] = OMIT,
        store_responses: typing.Optional[bool] = OMIT,
        temperature: typing.Optional[float] = OMIT,
        frequency_penalty: typing.Optional[float] = OMIT,
        presence_penalty: typing.Optional[float] = OMIT,
        logit_bias: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        top_logprobs: typing.Optional[int] = OMIT,
        top_p: typing.Optional[float] = OMIT,
        output_mode: typing.Optional[str] = OMIT,
        response_format: typing.Optional[str] = OMIT,
        seed: typing.Optional[int] = OMIT,
        stop_sequences: typing.Optional[typing.Sequence[str]] = OMIT,
        max_completion_tokens: typing.Optional[int] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        access_departments: typing.Optional[typing.Sequence[str]] = OMIT,
        access_users: typing.Optional[typing.Sequence[str]] = OMIT,
        editable_by_users: typing.Optional[typing.Sequence[str]] = OMIT,
        visible_in_chat_to_users: typing.Optional[typing.Sequence[str]] = OMIT,
        editable_by_roles: typing.Optional[typing.Sequence[str]] = OMIT,
        visible_to_roles: typing.Optional[typing.Sequence[str]] = OMIT,
        api_enabled: typing.Optional[bool] = OMIT,
        public_enabled: typing.Optional[bool] = OMIT,
        is_active: typing.Optional[bool] = OMIT,
        streaming: typing.Optional[bool] = OMIT,
        memory_enabled: typing.Optional[bool] = OMIT,
        moderation_enabled: typing.Optional[bool] = OMIT,
        safety_level: typing.Optional[str] = OMIT,
        truncation: typing.Optional[bool] = OMIT,
        preset_prompts: typing.Optional[typing.Sequence[str]] = OMIT,
        metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        text_config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        voice_profile_id: typing.Optional[str] = OMIT,
        tool_configurations: typing.Optional[ToolConfigurationSchema] = OMIT,
        reasoning: typing.Optional[ReasoningConfigSchema] = OMIT,
        vector_store_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        slice_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        json_schemas: typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]] = OMIT,
        rule_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AssistantResponse:
        """
        Create a new assistant.

        The current user will be set as the creator.

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

        organization_id : str
            Organization ID

        description : typing.Optional[str]
            Assistant description

        avatar_id : typing.Optional[str]
            Avatar ID

        icon_id : typing.Optional[str]
            Icon ID (icon_ prefixed)

        icon_type : typing.Optional[str]
            Icon type (deprecated)

        icon_data : typing.Optional[str]
            Icon data (deprecated)

        is_default : typing.Optional[bool]
            Is default assistant

        default_model_key : typing.Optional[str]
            Default model key

        allowed_model_providers : typing.Optional[typing.Sequence[str]]
            Allowed model providers

        allowed_models : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]
            Per-provider model selection. Keys are provider slugs, values are lists of allowed model keys or null for all models from that provider. Example: {"openai": ["gpt-4o", "gpt-4o-mini"], "anthropic": null}

        instructions : typing.Optional[str]
            System instructions

        instructions_thread_id : typing.Optional[str]
            Instructions thread ID

        system_message : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
            System messages

        context_strategy : typing.Optional[str]
            Context management strategy

        context_window : typing.Optional[int]
            Context window size

        max_tool_calls : typing.Optional[int]
            Max tool calls

        parallel_tool_calls : typing.Optional[bool]
            Allow parallel tool calls

        service_tier : typing.Optional[str]
            Service tier

        store_responses : typing.Optional[bool]
            Store responses

        temperature : typing.Optional[float]
            Randomness (0.0-1.0). Lower=focused, higher=creative

        frequency_penalty : typing.Optional[float]
            Frequency penalty

        presence_penalty : typing.Optional[float]
            Presence penalty

        logit_bias : typing.Optional[typing.Dict[str, typing.Any]]
            Logit bias

        top_logprobs : typing.Optional[int]
            Top log probs

        top_p : typing.Optional[float]
            Top P

        output_mode : typing.Optional[str]
            Output mode

        response_format : typing.Optional[str]
            Response format

        seed : typing.Optional[int]
            Random seed

        stop_sequences : typing.Optional[typing.Sequence[str]]
            Stop sequences

        max_completion_tokens : typing.Optional[int]
            Max completion tokens

        access_mode : typing.Optional[str]
            Access mode: private, organization, department, public

        access_departments : typing.Optional[typing.Sequence[str]]
            Department IDs with access (required when access_mode is 'department')

        access_users : typing.Optional[typing.Sequence[str]]
            User IDs with access

        editable_by_users : typing.Optional[typing.Sequence[str]]
            User IDs that can edit. Use ['*'] for all organization members

        visible_in_chat_to_users : typing.Optional[typing.Sequence[str]]
            User IDs that can see assistant in chat interface

        editable_by_roles : typing.Optional[typing.Sequence[str]]
            Role IDs that can edit

        visible_to_roles : typing.Optional[typing.Sequence[str]]
            Role IDs that can view

        api_enabled : typing.Optional[bool]
            API enabled

        public_enabled : typing.Optional[bool]
            Public enabled

        is_active : typing.Optional[bool]
            Is active

        streaming : typing.Optional[bool]
            Streaming enabled

        memory_enabled : typing.Optional[bool]
            Memory enabled

        moderation_enabled : typing.Optional[bool]
            Moderation enabled

        safety_level : typing.Optional[str]
            Safety level

        truncation : typing.Optional[bool]
            Auto-truncate messages exceeding context window

        preset_prompts : typing.Optional[typing.Sequence[str]]
            Preset prompts

        metadata : typing.Optional[typing.Dict[str, typing.Any]]
            Custom metadata

        text_config : typing.Optional[typing.Dict[str, typing.Any]]
            Text configuration

        voice_profile_id : typing.Optional[str]
            Voice profile ID for meeting identity

        tool_configurations : typing.Optional[ToolConfigurationSchema]
            Tool configurations

        reasoning : typing.Optional[ReasoningConfigSchema]
            Reasoning configuration

        vector_store_ids : typing.Optional[typing.Sequence[str]]
            Vector store IDs

        slice_ids : typing.Optional[typing.Sequence[str]]
            Knowledge slice IDs to attach

        json_schemas : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
            JSON schemas

        rule_ids : typing.Optional[typing.Sequence[str]]
            Rule IDs to attach to assistant

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

        Returns
        -------
        AssistantResponse
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.assistants.create_assistant(
                name="name",
                organization_id="organization_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_assistant(
            name=name,
            organization_id=organization_id,
            description=description,
            avatar_id=avatar_id,
            icon_id=icon_id,
            icon_type=icon_type,
            icon_data=icon_data,
            is_default=is_default,
            default_model_key=default_model_key,
            allowed_model_providers=allowed_model_providers,
            allowed_models=allowed_models,
            instructions=instructions,
            instructions_thread_id=instructions_thread_id,
            system_message=system_message,
            context_strategy=context_strategy,
            context_window=context_window,
            max_tool_calls=max_tool_calls,
            parallel_tool_calls=parallel_tool_calls,
            service_tier=service_tier,
            store_responses=store_responses,
            temperature=temperature,
            frequency_penalty=frequency_penalty,
            presence_penalty=presence_penalty,
            logit_bias=logit_bias,
            top_logprobs=top_logprobs,
            top_p=top_p,
            output_mode=output_mode,
            response_format=response_format,
            seed=seed,
            stop_sequences=stop_sequences,
            max_completion_tokens=max_completion_tokens,
            access_mode=access_mode,
            access_departments=access_departments,
            access_users=access_users,
            editable_by_users=editable_by_users,
            visible_in_chat_to_users=visible_in_chat_to_users,
            editable_by_roles=editable_by_roles,
            visible_to_roles=visible_to_roles,
            api_enabled=api_enabled,
            public_enabled=public_enabled,
            is_active=is_active,
            streaming=streaming,
            memory_enabled=memory_enabled,
            moderation_enabled=moderation_enabled,
            safety_level=safety_level,
            truncation=truncation,
            preset_prompts=preset_prompts,
            metadata=metadata,
            text_config=text_config,
            voice_profile_id=voice_profile_id,
            tool_configurations=tool_configurations,
            reasoning=reasoning,
            vector_store_ids=vector_store_ids,
            slice_ids=slice_ids,
            json_schemas=json_schemas,
            rule_ids=rule_ids,
            request_options=request_options,
        )
        return _response.data

    async def get_assistant(
        self, assistant_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AssistantResponse:
        """
        Get a specific assistant by ID.

        Parameters
        ----------
        assistant_id : str

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

        Returns
        -------
        AssistantResponse
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.assistants.get_assistant(
                assistant_id="assistant_id",
            )


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

    async def update_assistant(
        self,
        assistant_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        avatar_id: typing.Optional[str] = OMIT,
        icon_id: typing.Optional[str] = OMIT,
        icon_type: typing.Optional[str] = OMIT,
        icon_data: typing.Optional[str] = OMIT,
        is_default: typing.Optional[bool] = OMIT,
        default_model_key: typing.Optional[str] = OMIT,
        allowed_model_providers: typing.Optional[typing.Sequence[str]] = OMIT,
        allowed_models: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        instructions: typing.Optional[str] = OMIT,
        instructions_thread_id: typing.Optional[str] = OMIT,
        system_message: typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]] = OMIT,
        context_strategy: typing.Optional[str] = OMIT,
        context_window: typing.Optional[int] = OMIT,
        max_tool_calls: typing.Optional[int] = OMIT,
        parallel_tool_calls: typing.Optional[bool] = OMIT,
        service_tier: typing.Optional[str] = OMIT,
        store_responses: typing.Optional[bool] = OMIT,
        temperature: typing.Optional[float] = OMIT,
        frequency_penalty: typing.Optional[float] = OMIT,
        presence_penalty: typing.Optional[float] = OMIT,
        logit_bias: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        top_logprobs: typing.Optional[int] = OMIT,
        top_p: typing.Optional[float] = OMIT,
        output_mode: typing.Optional[str] = OMIT,
        response_format: typing.Optional[str] = OMIT,
        seed: typing.Optional[int] = OMIT,
        stop_sequences: typing.Optional[typing.Sequence[str]] = OMIT,
        max_completion_tokens: typing.Optional[int] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        access_departments: typing.Optional[typing.Sequence[str]] = OMIT,
        access_users: typing.Optional[typing.Sequence[str]] = OMIT,
        editable_by_users: typing.Optional[typing.Sequence[str]] = OMIT,
        visible_in_chat_to_users: typing.Optional[typing.Sequence[str]] = OMIT,
        editable_by_roles: typing.Optional[typing.Sequence[str]] = OMIT,
        visible_to_roles: typing.Optional[typing.Sequence[str]] = OMIT,
        api_enabled: typing.Optional[bool] = OMIT,
        public_enabled: typing.Optional[bool] = OMIT,
        is_active: typing.Optional[bool] = OMIT,
        streaming: typing.Optional[bool] = OMIT,
        memory_enabled: typing.Optional[bool] = OMIT,
        moderation_enabled: typing.Optional[bool] = OMIT,
        safety_level: typing.Optional[str] = OMIT,
        truncation: typing.Optional[bool] = OMIT,
        preset_prompts: typing.Optional[typing.Sequence[str]] = OMIT,
        assistant_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        text_config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        tool_configurations: typing.Optional[ToolConfigurationSchema] = OMIT,
        reasoning: typing.Optional[ReasoningConfigSchema] = OMIT,
        vector_store_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        slice_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        rule_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        voice_profile_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AssistantResponse:
        """
        Update an existing assistant.

        Parameters
        ----------
        assistant_id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

        avatar_id : typing.Optional[str]

        icon_id : typing.Optional[str]

        icon_type : typing.Optional[str]

        icon_data : typing.Optional[str]

        is_default : typing.Optional[bool]

        default_model_key : typing.Optional[str]

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

        allowed_models : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]

        instructions : typing.Optional[str]

        instructions_thread_id : typing.Optional[str]

        system_message : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]

        context_strategy : typing.Optional[str]

        context_window : typing.Optional[int]

        max_tool_calls : typing.Optional[int]

        parallel_tool_calls : typing.Optional[bool]

        service_tier : typing.Optional[str]

        store_responses : typing.Optional[bool]

        temperature : typing.Optional[float]
            Randomness (0.0-1.0). Lower=focused, higher=creative

        frequency_penalty : typing.Optional[float]

        presence_penalty : typing.Optional[float]

        logit_bias : typing.Optional[typing.Dict[str, typing.Any]]

        top_logprobs : typing.Optional[int]

        top_p : typing.Optional[float]

        output_mode : typing.Optional[str]

        response_format : typing.Optional[str]

        seed : typing.Optional[int]

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

        max_completion_tokens : typing.Optional[int]

        access_mode : typing.Optional[str]
            Access mode: private, organization, department, public

        access_departments : typing.Optional[typing.Sequence[str]]
            Department IDs with access (required when access_mode is 'department')

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

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

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

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

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

        api_enabled : typing.Optional[bool]

        public_enabled : typing.Optional[bool]

        is_active : typing.Optional[bool]

        streaming : typing.Optional[bool]

        memory_enabled : typing.Optional[bool]

        moderation_enabled : typing.Optional[bool]

        safety_level : typing.Optional[str]

        truncation : typing.Optional[bool]

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

        assistant_metadata : typing.Optional[typing.Dict[str, typing.Any]]

        text_config : typing.Optional[typing.Dict[str, typing.Any]]

        tool_configurations : typing.Optional[ToolConfigurationSchema]

        reasoning : typing.Optional[ReasoningConfigSchema]

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

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

        rule_ids : typing.Optional[typing.Sequence[str]]
            Rule IDs to attach/replace on assistant

        voice_profile_id : typing.Optional[str]

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

        Returns
        -------
        AssistantResponse
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.assistants.update_assistant(
                assistant_id="assistant_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_assistant(
            assistant_id,
            name=name,
            description=description,
            avatar_id=avatar_id,
            icon_id=icon_id,
            icon_type=icon_type,
            icon_data=icon_data,
            is_default=is_default,
            default_model_key=default_model_key,
            allowed_model_providers=allowed_model_providers,
            allowed_models=allowed_models,
            instructions=instructions,
            instructions_thread_id=instructions_thread_id,
            system_message=system_message,
            context_strategy=context_strategy,
            context_window=context_window,
            max_tool_calls=max_tool_calls,
            parallel_tool_calls=parallel_tool_calls,
            service_tier=service_tier,
            store_responses=store_responses,
            temperature=temperature,
            frequency_penalty=frequency_penalty,
            presence_penalty=presence_penalty,
            logit_bias=logit_bias,
            top_logprobs=top_logprobs,
            top_p=top_p,
            output_mode=output_mode,
            response_format=response_format,
            seed=seed,
            stop_sequences=stop_sequences,
            max_completion_tokens=max_completion_tokens,
            access_mode=access_mode,
            access_departments=access_departments,
            access_users=access_users,
            editable_by_users=editable_by_users,
            visible_in_chat_to_users=visible_in_chat_to_users,
            editable_by_roles=editable_by_roles,
            visible_to_roles=visible_to_roles,
            api_enabled=api_enabled,
            public_enabled=public_enabled,
            is_active=is_active,
            streaming=streaming,
            memory_enabled=memory_enabled,
            moderation_enabled=moderation_enabled,
            safety_level=safety_level,
            truncation=truncation,
            preset_prompts=preset_prompts,
            assistant_metadata=assistant_metadata,
            text_config=text_config,
            tool_configurations=tool_configurations,
            reasoning=reasoning,
            vector_store_ids=vector_store_ids,
            slice_ids=slice_ids,
            rule_ids=rule_ids,
            voice_profile_id=voice_profile_id,
            request_options=request_options,
        )
        return _response.data

    async def delete_assistant(
        self, assistant_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> None:
        """
        Soft delete an assistant.

        Parameters
        ----------
        assistant_id : str

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.assistants.delete_assistant(
                assistant_id="assistant_id",
            )


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

    async def get_assistant_history(
        self,
        assistant_id: str,
        *,
        action: typing.Optional[str] = None,
        user_id: typing.Optional[str] = None,
        start_date: typing.Optional[str] = None,
        end_date: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AppApiV1SchemasAssistantsAuditLogListResponse:
        """
        Get audit history for an assistant.

        Parameters
        ----------
        assistant_id : str

        action : typing.Optional[str]
            Filter by action

        user_id : typing.Optional[str]
            Filter by user

        start_date : typing.Optional[str]
            Start date (ISO 8601)

        end_date : typing.Optional[str]
            End date (ISO 8601)

        limit : typing.Optional[int]
            Items per page

        offset : typing.Optional[int]
            Number of items to skip

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

        Returns
        -------
        AppApiV1SchemasAssistantsAuditLogListResponse
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.assistants.get_assistant_history(
                assistant_id="assistant_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_assistant_history(
            assistant_id,
            action=action,
            user_id=user_id,
            start_date=start_date,
            end_date=end_date,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    async def convert_assistant_to_workflow(
        self,
        assistant_id: str,
        *,
        workflow_name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ConvertToWorkflowResponse:
        """
        Convert an assistant to use a workflow.

        Parameters
        ----------
        assistant_id : str

        workflow_name : typing.Optional[str]
            Workflow name (defaults to '{assistant.name} Workflow')

        description : typing.Optional[str]
            Workflow description

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

        Returns
        -------
        ConvertToWorkflowResponse
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.assistants.convert_assistant_to_workflow(
                assistant_id="assistant_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.convert_assistant_to_workflow(
            assistant_id, workflow_name=workflow_name, description=description, request_options=request_options
        )
        return _response.data

    async def get_assistant_workflow(
        self, assistant_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> WorkflowResponse:
        """
        Get the workflow linked to an assistant.

        Parameters
        ----------
        assistant_id : str

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

        Returns
        -------
        WorkflowResponse
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.assistants.get_assistant_workflow(
                assistant_id="assistant_id",
            )


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

    async def detach_assistant_workflow(
        self, assistant_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DetachWorkflowResponse:
        """
        Detach the workflow from an assistant (does not delete the workflow).

        Parameters
        ----------
        assistant_id : str

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

        Returns
        -------
        DetachWorkflowResponse
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.assistants.detach_assistant_workflow(
                assistant_id="assistant_id",
            )


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

    async def update_assistant_workflow(
        self,
        assistant_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        definition: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        is_active: typing.Optional[bool] = OMIT,
        external_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> WorkflowResponse:
        """
        Update the workflow linked to an assistant.

        Parameters
        ----------
        assistant_id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

        definition : typing.Optional[typing.Dict[str, typing.Any]]
            Updated workflow definition

        is_active : typing.Optional[bool]
            Active status

        external_id : typing.Optional[str]
            Flow-plate internal flow ID for correlation

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

        Returns
        -------
        WorkflowResponse
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.assistants.update_assistant_workflow(
                assistant_id="assistant_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_assistant_workflow(
            assistant_id,
            name=name,
            description=description,
            definition=definition,
            is_active=is_active,
            external_id=external_id,
            request_options=request_options,
        )
        return _response.data

    async def warm_assistant_cache(
        self, assistant_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Dict[str, typing.Any]:
        """
        Pre-warm the cache for an assistant.

        Fetches the assistant from the database (warming the page cache)
        and stores the context in cache so subsequent conversation requests skip
        the DB query entirely (~10-50ms saved per request).

        TTL: 30 minutes. Typically called by Flow-Plate after saving a flow that
        contains an assistant node.

        Returns the assistant_id and cache status.

        Parameters
        ----------
        assistant_id : str

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

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.assistants.warm_assistant_cache(
                assistant_id="assistant_id",
            )


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