# 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_assistant_audit_audit_log_list_response import (
    AppApiV1SchemasAssistantAuditAuditLogListResponse,
)
from ..types.assistant_list_response import AssistantListResponse
from ..types.assistant_response import AssistantResponse
from ..types.editor_schema_response import EditorSchemaResponse
from ..types.pin_action_response import PinActionResponse
from ..types.pinned_assistants_response import PinnedAssistantsResponse
from ..types.reasoning_config_schema import ReasoningConfigSchema
from ..types.tool_configuration_schema import ToolConfigurationSchema
from ..types.warm_cache_response import WarmCacheResponse
from .raw_client import AsyncRawAssistantsClient, RawAssistantsClient
from .types.assistant_create_access_mode import AssistantCreateAccessMode
from .types.assistant_create_output_mode import AssistantCreateOutputMode
from .types.assistant_create_response_format import AssistantCreateResponseFormat
from .types.assistant_create_safety_level import AssistantCreateSafetyLevel
from .types.assistant_create_service_tier import AssistantCreateServiceTier
from .types.assistant_update_access_mode import AssistantUpdateAccessMode
from .types.assistant_update_output_mode import AssistantUpdateOutputMode
from .types.assistant_update_response_format import AssistantUpdateResponseFormat
from .types.assistant_update_safety_level import AssistantUpdateSafetyLevel
from .types.assistant_update_service_tier import AssistantUpdateServiceTier
from .types.list_assistants_v1assistants_get_request_fields import ListAssistantsV1AssistantsGetRequestFields
from .types.list_assistants_v1assistants_get_request_sort_by import ListAssistantsV1AssistantsGetRequestSortBy
from .types.list_assistants_v1assistants_get_request_sort_order import ListAssistantsV1AssistantsGetRequestSortOrder

# 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 get_editor_schema(
        self, *, organization_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> EditorSchemaResponse:
        """
        Returns the complete server-driven form schema for the assistant editor. Includes sections, fields, types, validation rules, conditional visibility, and per-user permission flags. The schema is personalized based on the requesting user's role and capabilities in the organization.

        Parameters
        ----------
        organization_id : str
            Organization ID to scope the schema to

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

        Returns
        -------
        EditorSchemaResponse
            Successful Response

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

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

    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[ListAssistantsV1AssistantsGetRequestSortBy] = None,
        sort_order: typing.Optional[ListAssistantsV1AssistantsGetRequestSortOrder] = None,
        fields: typing.Optional[ListAssistantsV1AssistantsGetRequestFields] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AssistantListResponse:
        """
        List assistants for an organization with filters.

        Only returns assistants the user has access to.

        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[ListAssistantsV1AssistantsGetRequestSortBy]
            Sort field: name, created_at, or updated_at

        sort_order : typing.Optional[ListAssistantsV1AssistantsGetRequestSortOrder]
            Sort direction: asc or desc

        fields : typing.Optional[ListAssistantsV1AssistantsGetRequestFields]
            Response detail level: summary, standard, or 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,
        *,
        organization_id: str,
        name: str,
        assistant_create_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[AssistantCreateServiceTier] = 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[AssistantCreateOutputMode] = OMIT,
        response_format: typing.Optional[AssistantCreateResponseFormat] = 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[AssistantCreateAccessMode] = 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,
        delegate_to_whitelist: typing.Optional[typing.Sequence[str]] = OMIT,
        delegate_to_blacklist: typing.Optional[typing.Sequence[str]] = OMIT,
        accept_delegations_from: 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[AssistantCreateSafetyLevel] = OMIT,
        truncation: typing.Optional[bool] = OMIT,
        advanced_settings_enabled: typing.Optional[bool] = OMIT,
        knowledge_access_mode: typing.Optional[str] = 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
        ----------
        organization_id : str

        name : str
            Assistant name

        assistant_create_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]
            Deprecated -- use icon_id instead

        icon_data : typing.Optional[str]
            Deprecated -- use icon_id instead

        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 as list of message objects. Each dict should have 'role' and 'content' keys.

        context_strategy : typing.Optional[str]
            Context management strategy

        context_window : typing.Optional[int]
            Context window size in tokens

        max_tool_calls : typing.Optional[int]
            Max tool calls per response

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

        service_tier : typing.Optional[AssistantCreateServiceTier]
            Service tier for request processing

        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 (-2.0 to 2.0)

        presence_penalty : typing.Optional[float]
            Presence penalty (-2.0 to 2.0)

        logit_bias : typing.Optional[typing.Dict[str, typing.Any]]
            Token logit bias as {token_id: bias_value} pairs

        top_logprobs : typing.Optional[int]
            Number of top log probabilities to return

        top_p : typing.Optional[float]
            Nucleus sampling probability (0.0-1.0)

        output_mode : typing.Optional[AssistantCreateOutputMode]
            Output format mode

        response_format : typing.Optional[AssistantCreateResponseFormat]
            Response format type

        seed : typing.Optional[int]
            Random seed for deterministic outputs

        stop_sequences : typing.Optional[typing.Sequence[str]]
            Custom stop sequences

        max_completion_tokens : typing.Optional[int]
            Max completion tokens

        access_mode : typing.Optional[AssistantCreateAccessMode]
            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

        delegate_to_whitelist : typing.Optional[typing.Sequence[str]]
            If set, this assistant can ONLY delegate to these assistant IDs. Null = no restriction.

        delegate_to_blacklist : typing.Optional[typing.Sequence[str]]
            If set, this assistant CANNOT delegate to these assistant IDs. Null = no restriction.

        accept_delegations_from : typing.Optional[typing.Sequence[str]]
            If set, ONLY these assistant IDs can delegate to this assistant. Null = accepts all.

        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[AssistantCreateSafetyLevel]
            Content safety filtering level

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

        advanced_settings_enabled : typing.Optional[bool]
            Whether advanced settings are expanded in the editor UI

        knowledge_access_mode : typing.Optional[str]
            Knowledge access mode: 'user_scoped' (inherit user's accessible stores/slices) or 'fixed' (use assigned IDs)

        preset_prompts : typing.Optional[typing.Sequence[str]]
            Preset prompts shown to users

        metadata : typing.Optional[typing.Dict[str, typing.Any]]
            Custom metadata as key-value pairs

        text_config : typing.Optional[typing.Dict[str, typing.Any]]
            Text configuration as key-value pairs

        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 for structured output. Each dict should have 'name' and 'schema' keys.

        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(
            organization_id="organization_id",
            name="name",
            assistant_create_organization_id="organization_id",
        )
        """
        _response = self._raw_client.create_assistant(
            organization_id=organization_id,
            name=name,
            assistant_create_organization_id=assistant_create_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,
            delegate_to_whitelist=delegate_to_whitelist,
            delegate_to_blacklist=delegate_to_blacklist,
            accept_delegations_from=accept_delegations_from,
            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,
            advanced_settings_enabled=advanced_settings_enabled,
            knowledge_access_mode=knowledge_access_mode,
            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:
        """
        Retrieve the full configuration and metadata for a specific assistant.

        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[AssistantUpdateServiceTier] = 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[AssistantUpdateOutputMode] = OMIT,
        response_format: typing.Optional[AssistantUpdateResponseFormat] = 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[AssistantUpdateAccessMode] = 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,
        delegate_to_whitelist: typing.Optional[typing.Sequence[str]] = OMIT,
        delegate_to_blacklist: typing.Optional[typing.Sequence[str]] = OMIT,
        accept_delegations_from: 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[AssistantUpdateSafetyLevel] = 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's configuration. Only provided fields are modified. Requires edit access and CREATE_KNOWLEDGE capability.

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

        name : typing.Optional[str]
            Assistant name

        description : typing.Optional[str]
            Assistant description

        avatar_id : typing.Optional[str]
            Avatar ID from avatar library

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

        icon_type : typing.Optional[str]
            Deprecated -- use icon_id instead

        icon_data : typing.Optional[str]
            Deprecated -- use icon_id instead

        is_default : typing.Optional[bool]
            Whether this is the default assistant for the organization

        default_model_key : typing.Optional[str]
            Default AI model key (e.g. 'gpt-4o')

        allowed_model_providers : typing.Optional[typing.Sequence[str]]
            Allowed model provider slugs

        allowed_models : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]
            Per-provider model selection

        instructions : typing.Optional[str]
            System instructions

        instructions_thread_id : typing.Optional[str]
            Thread ID for AI-assisted instruction generation

        system_message : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
            System messages as list of message objects. Each dict should have 'role' and 'content' keys.

        context_strategy : typing.Optional[str]
            Context management strategy

        context_window : typing.Optional[int]
            Context window size in tokens

        max_tool_calls : typing.Optional[int]
            Max tool calls per response

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

        service_tier : typing.Optional[AssistantUpdateServiceTier]
            Service tier for request processing

        store_responses : typing.Optional[bool]
            Store API responses

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

        frequency_penalty : typing.Optional[float]
            Frequency penalty (-2.0 to 2.0)

        presence_penalty : typing.Optional[float]
            Presence penalty (-2.0 to 2.0)

        logit_bias : typing.Optional[typing.Dict[str, typing.Any]]
            Token logit bias as {token_id: bias_value} pairs

        top_logprobs : typing.Optional[int]
            Number of top log probabilities to return

        top_p : typing.Optional[float]
            Nucleus sampling probability (0.0-1.0)

        output_mode : typing.Optional[AssistantUpdateOutputMode]
            Output format mode

        response_format : typing.Optional[AssistantUpdateResponseFormat]
            Response format type

        seed : typing.Optional[int]
            Random seed for deterministic outputs

        stop_sequences : typing.Optional[typing.Sequence[str]]
            Custom stop sequences

        max_completion_tokens : typing.Optional[int]
            Max completion tokens

        access_mode : typing.Optional[AssistantUpdateAccessMode]
            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

        delegate_to_whitelist : typing.Optional[typing.Sequence[str]]
            If set, this assistant can ONLY delegate to these assistant IDs. Null = no restriction.

        delegate_to_blacklist : typing.Optional[typing.Sequence[str]]
            If set, this assistant CANNOT delegate to these assistant IDs. Null = no restriction.

        accept_delegations_from : typing.Optional[typing.Sequence[str]]
            If set, ONLY these assistant IDs can delegate to this assistant. Null = accepts all.

        api_enabled : typing.Optional[bool]
            Whether accessible via API

        public_enabled : typing.Optional[bool]
            Whether public website is enabled

        is_active : typing.Optional[bool]
            Whether assistant is active

        streaming : typing.Optional[bool]
            Whether streaming is enabled

        memory_enabled : typing.Optional[bool]
            Whether conversation memory is enabled

        moderation_enabled : typing.Optional[bool]
            Whether content moderation is enabled

        safety_level : typing.Optional[AssistantUpdateSafetyLevel]
            Content safety filtering level

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

        preset_prompts : typing.Optional[typing.Sequence[str]]
            Preset prompts shown to users

        assistant_metadata : typing.Optional[typing.Dict[str, typing.Any]]
            Custom metadata as key-value pairs

        text_config : typing.Optional[typing.Dict[str, typing.Any]]
            Text configuration as key-value pairs

        tool_configurations : typing.Optional[ToolConfigurationSchema]
            Tool configurations

        reasoning : typing.Optional[ReasoningConfigSchema]
            Reasoning configuration

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

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

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

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

        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,
            delegate_to_whitelist=delegate_to_whitelist,
            delegate_to_blacklist=delegate_to_blacklist,
            accept_delegations_from=accept_delegations_from,
            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,
    ) -> AppApiV1SchemasAssistantAuditAuditLogListResponse:
        """
        Retrieve the change history and audit log for a specific 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
        -------
        AppApiV1SchemasAssistantAuditAuditLogListResponse
            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 pin_assistant(
        self, assistant_id: str, *, organization_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> PinActionResponse:
        """
        Pin an assistant for the current user within an organization. The user must have at least view access to the assistant.

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

        organization_id : str
            Organization ID

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

        Returns
        -------
        PinActionResponse
            Successful Response

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

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

    def unpin_assistant(
        self, assistant_id: str, *, organization_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> PinActionResponse:
        """
        Unpin an assistant for the current user. Forced assistants (visible_in_chat_to_users) cannot be unpinned.

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

        organization_id : str
            Organization ID

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

        Returns
        -------
        PinActionResponse
            Successful Response

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

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

    def list_pinned_assistants(
        self, *, organization_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> PinnedAssistantsResponse:
        """
        Return the list of assistant IDs the current user has pinned within the specified organization.

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

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

        Returns
        -------
        PinnedAssistantsResponse
            Successful Response

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

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

    def warm_assistant_cache(
        self, assistant_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> WarmCacheResponse:
        """
        Pre-warm the cache for an assistant so subsequent conversation requests skip the DB query (~10-50ms saved). TTL: 30 minutes.

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

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

        Returns
        -------
        WarmCacheResponse
            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 get_editor_schema(
        self, *, organization_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> EditorSchemaResponse:
        """
        Returns the complete server-driven form schema for the assistant editor. Includes sections, fields, types, validation rules, conditional visibility, and per-user permission flags. The schema is personalized based on the requesting user's role and capabilities in the organization.

        Parameters
        ----------
        organization_id : str
            Organization ID to scope the schema to

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

        Returns
        -------
        EditorSchemaResponse
            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_editor_schema(
                organization_id="organization_id",
            )


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

    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[ListAssistantsV1AssistantsGetRequestSortBy] = None,
        sort_order: typing.Optional[ListAssistantsV1AssistantsGetRequestSortOrder] = None,
        fields: typing.Optional[ListAssistantsV1AssistantsGetRequestFields] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AssistantListResponse:
        """
        List assistants for an organization with filters.

        Only returns assistants the user has access to.

        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[ListAssistantsV1AssistantsGetRequestSortBy]
            Sort field: name, created_at, or updated_at

        sort_order : typing.Optional[ListAssistantsV1AssistantsGetRequestSortOrder]
            Sort direction: asc or desc

        fields : typing.Optional[ListAssistantsV1AssistantsGetRequestFields]
            Response detail level: summary, standard, or 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,
        *,
        organization_id: str,
        name: str,
        assistant_create_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[AssistantCreateServiceTier] = 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[AssistantCreateOutputMode] = OMIT,
        response_format: typing.Optional[AssistantCreateResponseFormat] = 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[AssistantCreateAccessMode] = 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,
        delegate_to_whitelist: typing.Optional[typing.Sequence[str]] = OMIT,
        delegate_to_blacklist: typing.Optional[typing.Sequence[str]] = OMIT,
        accept_delegations_from: 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[AssistantCreateSafetyLevel] = OMIT,
        truncation: typing.Optional[bool] = OMIT,
        advanced_settings_enabled: typing.Optional[bool] = OMIT,
        knowledge_access_mode: typing.Optional[str] = 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
        ----------
        organization_id : str

        name : str
            Assistant name

        assistant_create_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]
            Deprecated -- use icon_id instead

        icon_data : typing.Optional[str]
            Deprecated -- use icon_id instead

        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 as list of message objects. Each dict should have 'role' and 'content' keys.

        context_strategy : typing.Optional[str]
            Context management strategy

        context_window : typing.Optional[int]
            Context window size in tokens

        max_tool_calls : typing.Optional[int]
            Max tool calls per response

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

        service_tier : typing.Optional[AssistantCreateServiceTier]
            Service tier for request processing

        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 (-2.0 to 2.0)

        presence_penalty : typing.Optional[float]
            Presence penalty (-2.0 to 2.0)

        logit_bias : typing.Optional[typing.Dict[str, typing.Any]]
            Token logit bias as {token_id: bias_value} pairs

        top_logprobs : typing.Optional[int]
            Number of top log probabilities to return

        top_p : typing.Optional[float]
            Nucleus sampling probability (0.0-1.0)

        output_mode : typing.Optional[AssistantCreateOutputMode]
            Output format mode

        response_format : typing.Optional[AssistantCreateResponseFormat]
            Response format type

        seed : typing.Optional[int]
            Random seed for deterministic outputs

        stop_sequences : typing.Optional[typing.Sequence[str]]
            Custom stop sequences

        max_completion_tokens : typing.Optional[int]
            Max completion tokens

        access_mode : typing.Optional[AssistantCreateAccessMode]
            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

        delegate_to_whitelist : typing.Optional[typing.Sequence[str]]
            If set, this assistant can ONLY delegate to these assistant IDs. Null = no restriction.

        delegate_to_blacklist : typing.Optional[typing.Sequence[str]]
            If set, this assistant CANNOT delegate to these assistant IDs. Null = no restriction.

        accept_delegations_from : typing.Optional[typing.Sequence[str]]
            If set, ONLY these assistant IDs can delegate to this assistant. Null = accepts all.

        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[AssistantCreateSafetyLevel]
            Content safety filtering level

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

        advanced_settings_enabled : typing.Optional[bool]
            Whether advanced settings are expanded in the editor UI

        knowledge_access_mode : typing.Optional[str]
            Knowledge access mode: 'user_scoped' (inherit user's accessible stores/slices) or 'fixed' (use assigned IDs)

        preset_prompts : typing.Optional[typing.Sequence[str]]
            Preset prompts shown to users

        metadata : typing.Optional[typing.Dict[str, typing.Any]]
            Custom metadata as key-value pairs

        text_config : typing.Optional[typing.Dict[str, typing.Any]]
            Text configuration as key-value pairs

        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 for structured output. Each dict should have 'name' and 'schema' keys.

        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(
                organization_id="organization_id",
                name="name",
                assistant_create_organization_id="organization_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_assistant(
            organization_id=organization_id,
            name=name,
            assistant_create_organization_id=assistant_create_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,
            delegate_to_whitelist=delegate_to_whitelist,
            delegate_to_blacklist=delegate_to_blacklist,
            accept_delegations_from=accept_delegations_from,
            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,
            advanced_settings_enabled=advanced_settings_enabled,
            knowledge_access_mode=knowledge_access_mode,
            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:
        """
        Retrieve the full configuration and metadata for a specific assistant.

        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[AssistantUpdateServiceTier] = 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[AssistantUpdateOutputMode] = OMIT,
        response_format: typing.Optional[AssistantUpdateResponseFormat] = 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[AssistantUpdateAccessMode] = 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,
        delegate_to_whitelist: typing.Optional[typing.Sequence[str]] = OMIT,
        delegate_to_blacklist: typing.Optional[typing.Sequence[str]] = OMIT,
        accept_delegations_from: 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[AssistantUpdateSafetyLevel] = 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's configuration. Only provided fields are modified. Requires edit access and CREATE_KNOWLEDGE capability.

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

        name : typing.Optional[str]
            Assistant name

        description : typing.Optional[str]
            Assistant description

        avatar_id : typing.Optional[str]
            Avatar ID from avatar library

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

        icon_type : typing.Optional[str]
            Deprecated -- use icon_id instead

        icon_data : typing.Optional[str]
            Deprecated -- use icon_id instead

        is_default : typing.Optional[bool]
            Whether this is the default assistant for the organization

        default_model_key : typing.Optional[str]
            Default AI model key (e.g. 'gpt-4o')

        allowed_model_providers : typing.Optional[typing.Sequence[str]]
            Allowed model provider slugs

        allowed_models : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]
            Per-provider model selection

        instructions : typing.Optional[str]
            System instructions

        instructions_thread_id : typing.Optional[str]
            Thread ID for AI-assisted instruction generation

        system_message : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
            System messages as list of message objects. Each dict should have 'role' and 'content' keys.

        context_strategy : typing.Optional[str]
            Context management strategy

        context_window : typing.Optional[int]
            Context window size in tokens

        max_tool_calls : typing.Optional[int]
            Max tool calls per response

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

        service_tier : typing.Optional[AssistantUpdateServiceTier]
            Service tier for request processing

        store_responses : typing.Optional[bool]
            Store API responses

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

        frequency_penalty : typing.Optional[float]
            Frequency penalty (-2.0 to 2.0)

        presence_penalty : typing.Optional[float]
            Presence penalty (-2.0 to 2.0)

        logit_bias : typing.Optional[typing.Dict[str, typing.Any]]
            Token logit bias as {token_id: bias_value} pairs

        top_logprobs : typing.Optional[int]
            Number of top log probabilities to return

        top_p : typing.Optional[float]
            Nucleus sampling probability (0.0-1.0)

        output_mode : typing.Optional[AssistantUpdateOutputMode]
            Output format mode

        response_format : typing.Optional[AssistantUpdateResponseFormat]
            Response format type

        seed : typing.Optional[int]
            Random seed for deterministic outputs

        stop_sequences : typing.Optional[typing.Sequence[str]]
            Custom stop sequences

        max_completion_tokens : typing.Optional[int]
            Max completion tokens

        access_mode : typing.Optional[AssistantUpdateAccessMode]
            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

        delegate_to_whitelist : typing.Optional[typing.Sequence[str]]
            If set, this assistant can ONLY delegate to these assistant IDs. Null = no restriction.

        delegate_to_blacklist : typing.Optional[typing.Sequence[str]]
            If set, this assistant CANNOT delegate to these assistant IDs. Null = no restriction.

        accept_delegations_from : typing.Optional[typing.Sequence[str]]
            If set, ONLY these assistant IDs can delegate to this assistant. Null = accepts all.

        api_enabled : typing.Optional[bool]
            Whether accessible via API

        public_enabled : typing.Optional[bool]
            Whether public website is enabled

        is_active : typing.Optional[bool]
            Whether assistant is active

        streaming : typing.Optional[bool]
            Whether streaming is enabled

        memory_enabled : typing.Optional[bool]
            Whether conversation memory is enabled

        moderation_enabled : typing.Optional[bool]
            Whether content moderation is enabled

        safety_level : typing.Optional[AssistantUpdateSafetyLevel]
            Content safety filtering level

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

        preset_prompts : typing.Optional[typing.Sequence[str]]
            Preset prompts shown to users

        assistant_metadata : typing.Optional[typing.Dict[str, typing.Any]]
            Custom metadata as key-value pairs

        text_config : typing.Optional[typing.Dict[str, typing.Any]]
            Text configuration as key-value pairs

        tool_configurations : typing.Optional[ToolConfigurationSchema]
            Tool configurations

        reasoning : typing.Optional[ReasoningConfigSchema]
            Reasoning configuration

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

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

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

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

        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,
            delegate_to_whitelist=delegate_to_whitelist,
            delegate_to_blacklist=delegate_to_blacklist,
            accept_delegations_from=accept_delegations_from,
            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,
    ) -> AppApiV1SchemasAssistantAuditAuditLogListResponse:
        """
        Retrieve the change history and audit log for a specific 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
        -------
        AppApiV1SchemasAssistantAuditAuditLogListResponse
            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 pin_assistant(
        self, assistant_id: str, *, organization_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> PinActionResponse:
        """
        Pin an assistant for the current user within an organization. The user must have at least view access to the assistant.

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

        organization_id : str
            Organization ID

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

        Returns
        -------
        PinActionResponse
            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.pin_assistant(
                assistant_id="assistant_id",
                organization_id="organization_id",
            )


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

    async def unpin_assistant(
        self, assistant_id: str, *, organization_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> PinActionResponse:
        """
        Unpin an assistant for the current user. Forced assistants (visible_in_chat_to_users) cannot be unpinned.

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

        organization_id : str
            Organization ID

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

        Returns
        -------
        PinActionResponse
            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.unpin_assistant(
                assistant_id="assistant_id",
                organization_id="organization_id",
            )


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

    async def list_pinned_assistants(
        self, *, organization_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> PinnedAssistantsResponse:
        """
        Return the list of assistant IDs the current user has pinned within the specified organization.

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

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

        Returns
        -------
        PinnedAssistantsResponse
            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_pinned_assistants(
                organization_id="organization_id",
            )


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

    async def warm_assistant_cache(
        self, assistant_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> WarmCacheResponse:
        """
        Pre-warm the cache for an assistant so subsequent conversation requests skip the DB query (~10-50ms saved). TTL: 30 minutes.

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

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

        Returns
        -------
        WarmCacheResponse
            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
