# 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.knowledge_slice_list_response import KnowledgeSliceListResponse
from ..types.knowledge_slice_response import KnowledgeSliceResponse
from ..types.knowledge_vector_store_list_response import KnowledgeVectorStoreListResponse
from ..types.knowledge_vector_store_response import KnowledgeVectorStoreResponse
from .raw_client import AsyncRawKnowledgeClient, RawKnowledgeClient

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


class KnowledgeClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawKnowledgeClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawKnowledgeClient
        """
        return self._raw_client

    def list_slices(
        self,
        organization_id: str,
        *,
        status: typing.Optional[str] = None,
        type: typing.Optional[str] = None,
        search: typing.Optional[str] = None,
        skip: typing.Optional[int] = None,
        limit: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeSliceListResponse:
        """
        List knowledge slices for an organization.

        Parameters
        ----------
        organization_id : str

        status : typing.Optional[str]

        type : typing.Optional[str]

        search : typing.Optional[str]
            Filter by name (case-insensitive)

        skip : typing.Optional[int]

        limit : typing.Optional[int]

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

        Returns
        -------
        KnowledgeSliceListResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.list_slices(
            organization_id="organization_id",
        )
        """
        _response = self._raw_client.list_slices(
            organization_id,
            status=status,
            type=type,
            search=search,
            skip=skip,
            limit=limit,
            request_options=request_options,
        )
        return _response.data

    def create_slice(
        self,
        organization_id: str,
        *,
        name: str,
        owner_type: str,
        owner_id: str,
        description: typing.Optional[str] = OMIT,
        type: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeSliceResponse:
        """
        Create a new knowledge slice.

        Parameters
        ----------
        organization_id : str

        name : str

        owner_type : str

        owner_id : str

        description : typing.Optional[str]

        type : typing.Optional[str]

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

        Returns
        -------
        KnowledgeSliceResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.create_slice(
            organization_id="organization_id",
            name="name",
            owner_type="owner_type",
            owner_id="owner_id",
        )
        """
        _response = self._raw_client.create_slice(
            organization_id,
            name=name,
            owner_type=owner_type,
            owner_id=owner_id,
            description=description,
            type=type,
            request_options=request_options,
        )
        return _response.data

    def get_slice(
        self, organization_id: str, slice_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> KnowledgeSliceResponse:
        """
        Get a single knowledge slice by ID.

        Parameters
        ----------
        organization_id : str

        slice_id : str

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

        Returns
        -------
        KnowledgeSliceResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.get_slice(
            organization_id="organization_id",
            slice_id="slice_id",
        )
        """
        _response = self._raw_client.get_slice(organization_id, slice_id, request_options=request_options)
        return _response.data

    def update_slice(
        self,
        organization_id: str,
        slice_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeSliceResponse:
        """
        Update a knowledge slice's name or description.

        Parameters
        ----------
        organization_id : str

        slice_id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

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

        Returns
        -------
        KnowledgeSliceResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.update_slice(
            organization_id="organization_id",
            slice_id="slice_id",
        )
        """
        _response = self._raw_client.update_slice(
            organization_id, slice_id, name=name, description=description, request_options=request_options
        )
        return _response.data

    def archive_slice(
        self, organization_id: str, slice_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> KnowledgeSliceResponse:
        """
        Archive a knowledge slice.

        Parameters
        ----------
        organization_id : str

        slice_id : str

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

        Returns
        -------
        KnowledgeSliceResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.archive_slice(
            organization_id="organization_id",
            slice_id="slice_id",
        )
        """
        _response = self._raw_client.archive_slice(organization_id, slice_id, request_options=request_options)
        return _response.data

    def unarchive_slice(
        self, organization_id: str, slice_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> KnowledgeSliceResponse:
        """
        Unarchive a knowledge slice.

        Parameters
        ----------
        organization_id : str

        slice_id : str

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

        Returns
        -------
        KnowledgeSliceResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.unarchive_slice(
            organization_id="organization_id",
            slice_id="slice_id",
        )
        """
        _response = self._raw_client.unarchive_slice(organization_id, slice_id, request_options=request_options)
        return _response.data

    def list_composites(
        self,
        organization_id: str,
        *,
        skip: typing.Optional[int] = None,
        limit: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeSliceListResponse:
        """
        List composite slices for an organization.

        Parameters
        ----------
        organization_id : str

        skip : typing.Optional[int]

        limit : typing.Optional[int]

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

        Returns
        -------
        KnowledgeSliceListResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.list_composites(
            organization_id="organization_id",
        )
        """
        _response = self._raw_client.list_composites(
            organization_id, skip=skip, limit=limit, request_options=request_options
        )
        return _response.data

    def create_composite(
        self,
        organization_id: str,
        *,
        name: str,
        member_slice_ids: typing.Sequence[str],
        description: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeSliceResponse:
        """
        Create a composite slice with member slices.

        Parameters
        ----------
        organization_id : str

        name : str

        member_slice_ids : typing.Sequence[str]

        description : typing.Optional[str]

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

        Returns
        -------
        KnowledgeSliceResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.create_composite(
            organization_id="organization_id",
            name="name",
            member_slice_ids=["member_slice_ids"],
        )
        """
        _response = self._raw_client.create_composite(
            organization_id,
            name=name,
            member_slice_ids=member_slice_ids,
            description=description,
            request_options=request_options,
        )
        return _response.data

    def update_composite(
        self,
        organization_id: str,
        slice_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        member_slice_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeSliceResponse:
        """
        Update a composite slice, optionally replacing member slices.

        Parameters
        ----------
        organization_id : str

        slice_id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

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

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

        Returns
        -------
        KnowledgeSliceResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.update_composite(
            organization_id="organization_id",
            slice_id="slice_id",
        )
        """
        _response = self._raw_client.update_composite(
            organization_id,
            slice_id,
            name=name,
            description=description,
            member_slice_ids=member_slice_ids,
            request_options=request_options,
        )
        return _response.data

    def list_stores_by_slice(
        self,
        organization_id: str,
        slice_id: str,
        *,
        skip: typing.Optional[int] = None,
        limit: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeVectorStoreListResponse:
        """
        List accessible vector stores in a knowledge slice.

        Parameters
        ----------
        organization_id : str

        slice_id : str

        skip : typing.Optional[int]

        limit : typing.Optional[int]

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

        Returns
        -------
        KnowledgeVectorStoreListResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.list_stores_by_slice(
            organization_id="organization_id",
            slice_id="slice_id",
        )
        """
        _response = self._raw_client.list_stores_by_slice(
            organization_id, slice_id, skip=skip, limit=limit, request_options=request_options
        )
        return _response.data

    def create_store_in_slice(
        self,
        organization_id: str,
        slice_id: str,
        *,
        name: str,
        description: typing.Optional[str] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        access_target_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeVectorStoreResponse:
        """
        Create a new vector store within a knowledge slice.

        Parameters
        ----------
        organization_id : str

        slice_id : str

        name : str

        description : typing.Optional[str]

        access_mode : typing.Optional[str]

        access_target_id : typing.Optional[str]
            Target ID for department/user/group access modes

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

        Returns
        -------
        KnowledgeVectorStoreResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.create_store_in_slice(
            organization_id="organization_id",
            slice_id="slice_id",
            name="name",
        )
        """
        _response = self._raw_client.create_store_in_slice(
            organization_id,
            slice_id,
            name=name,
            description=description,
            access_mode=access_mode,
            access_target_id=access_target_id,
            request_options=request_options,
        )
        return _response.data

    def list_stores_for_org(
        self,
        organization_id: str,
        *,
        skip: typing.Optional[int] = None,
        limit: typing.Optional[int] = None,
        search: typing.Optional[str] = None,
        sort: typing.Optional[str] = None,
        order: typing.Optional[str] = None,
        slice_id: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeVectorStoreListResponse:
        """
        List vector stores accessible by the current user.

        Parameters
        ----------
        organization_id : str

        skip : typing.Optional[int]

        limit : typing.Optional[int]

        search : typing.Optional[str]
            Filter by name (case-insensitive)

        sort : typing.Optional[str]
            Sort column (name, created_at, data_size)

        order : typing.Optional[str]
            Sort direction (asc, desc)

        slice_id : typing.Optional[str]
            Filter by slice

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

        Returns
        -------
        KnowledgeVectorStoreListResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.list_stores_for_org(
            organization_id="organization_id",
        )
        """
        _response = self._raw_client.list_stores_for_org(
            organization_id,
            skip=skip,
            limit=limit,
            search=search,
            sort=sort,
            order=order,
            slice_id=slice_id,
            request_options=request_options,
        )
        return _response.data

    def create_store(
        self,
        organization_id: str,
        *,
        name: str,
        description: typing.Optional[str] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        access_target_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeVectorStoreResponse:
        """
        Create a new vector store without assigning it to a slice.

        Parameters
        ----------
        organization_id : str

        name : str

        description : typing.Optional[str]

        access_mode : typing.Optional[str]

        access_target_id : typing.Optional[str]
            Target ID for department/user/group access modes

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

        Returns
        -------
        KnowledgeVectorStoreResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.create_store(
            organization_id="organization_id",
            name="name",
        )
        """
        _response = self._raw_client.create_store(
            organization_id,
            name=name,
            description=description,
            access_mode=access_mode,
            access_target_id=access_target_id,
            request_options=request_options,
        )
        return _response.data

    def get_store(
        self, organization_id: str, store_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> KnowledgeVectorStoreResponse:
        """
        Get a specific vector store.

        Parameters
        ----------
        organization_id : str

        store_id : str

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

        Returns
        -------
        KnowledgeVectorStoreResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.get_store(
            organization_id="organization_id",
            store_id="store_id",
        )
        """
        _response = self._raw_client.get_store(organization_id, store_id, request_options=request_options)
        return _response.data

    def delete_store(
        self, organization_id: str, store_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> None:
        """
        Delete a vector store.

        Parameters
        ----------
        organization_id : str

        store_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.knowledge.delete_store(
            organization_id="organization_id",
            store_id="store_id",
        )
        """
        _response = self._raw_client.delete_store(organization_id, store_id, request_options=request_options)
        return _response.data

    def update_store(
        self,
        organization_id: str,
        store_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        slice_id: typing.Optional[str] = OMIT,
        slice_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeVectorStoreResponse:
        """
        Update a vector store.

        Access is checked at the store and slice level:
        - User must have access to the store being updated
        - For slice assignment, user must have write access to the target slice

        Parameters
        ----------
        organization_id : str

        store_id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

        access_mode : typing.Optional[str]

        slice_id : typing.Optional[str]

        slice_ids : typing.Optional[typing.Sequence[str]]
            Set multiple slice associations

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

        Returns
        -------
        KnowledgeVectorStoreResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.knowledge.update_store(
            organization_id="organization_id",
            store_id="store_id",
        )
        """
        _response = self._raw_client.update_store(
            organization_id,
            store_id,
            name=name,
            description=description,
            access_mode=access_mode,
            slice_id=slice_id,
            slice_ids=slice_ids,
            request_options=request_options,
        )
        return _response.data


class AsyncKnowledgeClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawKnowledgeClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawKnowledgeClient
        """
        return self._raw_client

    async def list_slices(
        self,
        organization_id: str,
        *,
        status: typing.Optional[str] = None,
        type: typing.Optional[str] = None,
        search: typing.Optional[str] = None,
        skip: typing.Optional[int] = None,
        limit: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeSliceListResponse:
        """
        List knowledge slices for an organization.

        Parameters
        ----------
        organization_id : str

        status : typing.Optional[str]

        type : typing.Optional[str]

        search : typing.Optional[str]
            Filter by name (case-insensitive)

        skip : typing.Optional[int]

        limit : typing.Optional[int]

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

        Returns
        -------
        KnowledgeSliceListResponse
            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.knowledge.list_slices(
                organization_id="organization_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_slices(
            organization_id,
            status=status,
            type=type,
            search=search,
            skip=skip,
            limit=limit,
            request_options=request_options,
        )
        return _response.data

    async def create_slice(
        self,
        organization_id: str,
        *,
        name: str,
        owner_type: str,
        owner_id: str,
        description: typing.Optional[str] = OMIT,
        type: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeSliceResponse:
        """
        Create a new knowledge slice.

        Parameters
        ----------
        organization_id : str

        name : str

        owner_type : str

        owner_id : str

        description : typing.Optional[str]

        type : typing.Optional[str]

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

        Returns
        -------
        KnowledgeSliceResponse
            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.knowledge.create_slice(
                organization_id="organization_id",
                name="name",
                owner_type="owner_type",
                owner_id="owner_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_slice(
            organization_id,
            name=name,
            owner_type=owner_type,
            owner_id=owner_id,
            description=description,
            type=type,
            request_options=request_options,
        )
        return _response.data

    async def get_slice(
        self, organization_id: str, slice_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> KnowledgeSliceResponse:
        """
        Get a single knowledge slice by ID.

        Parameters
        ----------
        organization_id : str

        slice_id : str

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

        Returns
        -------
        KnowledgeSliceResponse
            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.knowledge.get_slice(
                organization_id="organization_id",
                slice_id="slice_id",
            )


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

    async def update_slice(
        self,
        organization_id: str,
        slice_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeSliceResponse:
        """
        Update a knowledge slice's name or description.

        Parameters
        ----------
        organization_id : str

        slice_id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

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

        Returns
        -------
        KnowledgeSliceResponse
            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.knowledge.update_slice(
                organization_id="organization_id",
                slice_id="slice_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_slice(
            organization_id, slice_id, name=name, description=description, request_options=request_options
        )
        return _response.data

    async def archive_slice(
        self, organization_id: str, slice_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> KnowledgeSliceResponse:
        """
        Archive a knowledge slice.

        Parameters
        ----------
        organization_id : str

        slice_id : str

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

        Returns
        -------
        KnowledgeSliceResponse
            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.knowledge.archive_slice(
                organization_id="organization_id",
                slice_id="slice_id",
            )


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

    async def unarchive_slice(
        self, organization_id: str, slice_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> KnowledgeSliceResponse:
        """
        Unarchive a knowledge slice.

        Parameters
        ----------
        organization_id : str

        slice_id : str

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

        Returns
        -------
        KnowledgeSliceResponse
            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.knowledge.unarchive_slice(
                organization_id="organization_id",
                slice_id="slice_id",
            )


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

    async def list_composites(
        self,
        organization_id: str,
        *,
        skip: typing.Optional[int] = None,
        limit: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeSliceListResponse:
        """
        List composite slices for an organization.

        Parameters
        ----------
        organization_id : str

        skip : typing.Optional[int]

        limit : typing.Optional[int]

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

        Returns
        -------
        KnowledgeSliceListResponse
            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.knowledge.list_composites(
                organization_id="organization_id",
            )


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

    async def create_composite(
        self,
        organization_id: str,
        *,
        name: str,
        member_slice_ids: typing.Sequence[str],
        description: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeSliceResponse:
        """
        Create a composite slice with member slices.

        Parameters
        ----------
        organization_id : str

        name : str

        member_slice_ids : typing.Sequence[str]

        description : typing.Optional[str]

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

        Returns
        -------
        KnowledgeSliceResponse
            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.knowledge.create_composite(
                organization_id="organization_id",
                name="name",
                member_slice_ids=["member_slice_ids"],
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_composite(
            organization_id,
            name=name,
            member_slice_ids=member_slice_ids,
            description=description,
            request_options=request_options,
        )
        return _response.data

    async def update_composite(
        self,
        organization_id: str,
        slice_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        member_slice_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeSliceResponse:
        """
        Update a composite slice, optionally replacing member slices.

        Parameters
        ----------
        organization_id : str

        slice_id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

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

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

        Returns
        -------
        KnowledgeSliceResponse
            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.knowledge.update_composite(
                organization_id="organization_id",
                slice_id="slice_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_composite(
            organization_id,
            slice_id,
            name=name,
            description=description,
            member_slice_ids=member_slice_ids,
            request_options=request_options,
        )
        return _response.data

    async def list_stores_by_slice(
        self,
        organization_id: str,
        slice_id: str,
        *,
        skip: typing.Optional[int] = None,
        limit: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeVectorStoreListResponse:
        """
        List accessible vector stores in a knowledge slice.

        Parameters
        ----------
        organization_id : str

        slice_id : str

        skip : typing.Optional[int]

        limit : typing.Optional[int]

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

        Returns
        -------
        KnowledgeVectorStoreListResponse
            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.knowledge.list_stores_by_slice(
                organization_id="organization_id",
                slice_id="slice_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_stores_by_slice(
            organization_id, slice_id, skip=skip, limit=limit, request_options=request_options
        )
        return _response.data

    async def create_store_in_slice(
        self,
        organization_id: str,
        slice_id: str,
        *,
        name: str,
        description: typing.Optional[str] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        access_target_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeVectorStoreResponse:
        """
        Create a new vector store within a knowledge slice.

        Parameters
        ----------
        organization_id : str

        slice_id : str

        name : str

        description : typing.Optional[str]

        access_mode : typing.Optional[str]

        access_target_id : typing.Optional[str]
            Target ID for department/user/group access modes

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

        Returns
        -------
        KnowledgeVectorStoreResponse
            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.knowledge.create_store_in_slice(
                organization_id="organization_id",
                slice_id="slice_id",
                name="name",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_store_in_slice(
            organization_id,
            slice_id,
            name=name,
            description=description,
            access_mode=access_mode,
            access_target_id=access_target_id,
            request_options=request_options,
        )
        return _response.data

    async def list_stores_for_org(
        self,
        organization_id: str,
        *,
        skip: typing.Optional[int] = None,
        limit: typing.Optional[int] = None,
        search: typing.Optional[str] = None,
        sort: typing.Optional[str] = None,
        order: typing.Optional[str] = None,
        slice_id: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeVectorStoreListResponse:
        """
        List vector stores accessible by the current user.

        Parameters
        ----------
        organization_id : str

        skip : typing.Optional[int]

        limit : typing.Optional[int]

        search : typing.Optional[str]
            Filter by name (case-insensitive)

        sort : typing.Optional[str]
            Sort column (name, created_at, data_size)

        order : typing.Optional[str]
            Sort direction (asc, desc)

        slice_id : typing.Optional[str]
            Filter by slice

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

        Returns
        -------
        KnowledgeVectorStoreListResponse
            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.knowledge.list_stores_for_org(
                organization_id="organization_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_stores_for_org(
            organization_id,
            skip=skip,
            limit=limit,
            search=search,
            sort=sort,
            order=order,
            slice_id=slice_id,
            request_options=request_options,
        )
        return _response.data

    async def create_store(
        self,
        organization_id: str,
        *,
        name: str,
        description: typing.Optional[str] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        access_target_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeVectorStoreResponse:
        """
        Create a new vector store without assigning it to a slice.

        Parameters
        ----------
        organization_id : str

        name : str

        description : typing.Optional[str]

        access_mode : typing.Optional[str]

        access_target_id : typing.Optional[str]
            Target ID for department/user/group access modes

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

        Returns
        -------
        KnowledgeVectorStoreResponse
            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.knowledge.create_store(
                organization_id="organization_id",
                name="name",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_store(
            organization_id,
            name=name,
            description=description,
            access_mode=access_mode,
            access_target_id=access_target_id,
            request_options=request_options,
        )
        return _response.data

    async def get_store(
        self, organization_id: str, store_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> KnowledgeVectorStoreResponse:
        """
        Get a specific vector store.

        Parameters
        ----------
        organization_id : str

        store_id : str

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

        Returns
        -------
        KnowledgeVectorStoreResponse
            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.knowledge.get_store(
                organization_id="organization_id",
                store_id="store_id",
            )


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

    async def delete_store(
        self, organization_id: str, store_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> None:
        """
        Delete a vector store.

        Parameters
        ----------
        organization_id : str

        store_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.knowledge.delete_store(
                organization_id="organization_id",
                store_id="store_id",
            )


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

    async def update_store(
        self,
        organization_id: str,
        store_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        slice_id: typing.Optional[str] = OMIT,
        slice_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> KnowledgeVectorStoreResponse:
        """
        Update a vector store.

        Access is checked at the store and slice level:
        - User must have access to the store being updated
        - For slice assignment, user must have write access to the target slice

        Parameters
        ----------
        organization_id : str

        store_id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

        access_mode : typing.Optional[str]

        slice_id : typing.Optional[str]

        slice_ids : typing.Optional[typing.Sequence[str]]
            Set multiple slice associations

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

        Returns
        -------
        KnowledgeVectorStoreResponse
            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.knowledge.update_store(
                organization_id="organization_id",
                store_id="store_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_store(
            organization_id,
            store_id,
            name=name,
            description=description,
            access_mode=access_mode,
            slice_id=slice_id,
            slice_ids=slice_ids,
            request_options=request_options,
        )
        return _response.data
