# -*- coding: utf-8 -*-
# code generated by Prisma. DO NOT EDIT.
# pyright: reportUnusedImport=false
# fmt: off
from __future__ import annotations

# global imports for type checking
from builtins import bool as _bool
from builtins import int as _int
from builtins import float as _float
from builtins import str as _str
import sys
import decimal
import datetime
from typing import (
    TYPE_CHECKING,
    Optional,
    Iterable,
    Iterator,
    Sequence,
    Callable,
    ClassVar,
    NoReturn,
    TypeVar,
    Generic,
    Mapping,
    Tuple,
    Union,
    List,
    Dict,
    Type,
    Any,
    Set,
    overload,
    cast,
)
from typing_extensions import TypedDict, Literal


LiteralString = str
# -- template actions.py.jinja --
from typing import TypeVar
import warnings

from . import types, errors, bases
from ._compat import model_parse
from ._constants import CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED

if TYPE_CHECKING:
    from .client import Prisma
    from .bases import _PrismaModel


_PrismaModelT = TypeVar('_PrismaModelT', bound='_PrismaModel')


class LiteLLM_BudgetTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_BudgetTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_BudgetTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_BudgetTable WHERE budget_id = $1',
            'bbadfchfja',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_BudgetTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_BudgetTable.prisma().query_first(
            'SELECT * FROM LiteLLM_BudgetTable WHERE max_budget = $1',
            377401575.66282,
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_BudgetTableCreateInput,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_BudgetTable record.

        Parameters
        ----------
        data
            LiteLLM_BudgetTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_BudgetTable model

        Returns
        -------
        prisma.models.LiteLLM_BudgetTable
            The created LiteLLM_BudgetTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_BudgetTable record from just the required fields
        litellm_budgettable = await LiteLLM_BudgetTable.prisma().create(
            data={
                # data to create a LiteLLM_BudgetTable record
                'created_by': 'bbehjachib',
                'updated_by': 'cadfabfehe',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_BudgetTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_BudgetTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_BudgetTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_BudgetTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_BudgetTable record
                    'created_by': 'dgiiaaijj',
                    'updated_by': 'bfaiacjjfc',
                },
                {
                    # data to create a LiteLLM_BudgetTable record
                    'created_by': 'eigcfgbif',
                    'updated_by': 'bagcfbhiig',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_BudgetTableWhereUniqueInput,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_BudgetTable record.

        Parameters
        ----------
        where
            LiteLLM_BudgetTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_BudgetTable model

        Returns
        -------
        prisma.models.LiteLLM_BudgetTable
            The deleted LiteLLM_BudgetTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_budgettable = await LiteLLM_BudgetTable.prisma().delete(
            where={
                'budget_id': 'cghideieh',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_BudgetTableWhereUniqueInput,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_BudgetTable record.

        Parameters
        ----------
        where
            LiteLLM_BudgetTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_BudgetTable model

        Returns
        -------
        prisma.models.LiteLLM_BudgetTable
            The found LiteLLM_BudgetTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_budgettable = await LiteLLM_BudgetTable.prisma().find_unique(
            where={
                'budget_id': 'biabhbdai',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_BudgetTableWhereUniqueInput,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_BudgetTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_BudgetTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_BudgetTable model

        Returns
        -------
        prisma.models.LiteLLM_BudgetTable
            The found LiteLLM_BudgetTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_budgettable = await LiteLLM_BudgetTable.prisma().find_unique_or_raise(
            where={
                'budget_id': 'idghgaicb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_BudgetTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_BudgetTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None,
        order: Optional[Union[types.LiteLLM_BudgetTableOrderByInput, List[types.LiteLLM_BudgetTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_BudgetTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_BudgetTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_BudgetTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_BudgetTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_BudgetTable model
        order
            Order the returned LiteLLM_BudgetTable records by any field
        distinct
            Filter LiteLLM_BudgetTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_BudgetTable]
            The list of all LiteLLM_BudgetTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_BudgetTable records
        litellm_budgettables = await LiteLLM_BudgetTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_BudgetTable records ordered by the soft_budget field
        litellm_budgettables = await LiteLLM_BudgetTable.prisma().find_many(
            take=5,
            order={
                'soft_budget': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_BudgetTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_BudgetTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None,
        order: Optional[Union[types.LiteLLM_BudgetTableOrderByInput, List[types.LiteLLM_BudgetTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_BudgetTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_BudgetTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_BudgetTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_BudgetTable model
        order
            Order the returned LiteLLM_BudgetTable records by any field
        distinct
            Filter LiteLLM_BudgetTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_BudgetTable
            The first LiteLLM_BudgetTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_BudgetTable record ordered by the max_parallel_requests field
        litellm_budgettable = await LiteLLM_BudgetTable.prisma().find_first(
            skip=1,
            order={
                'max_parallel_requests': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_BudgetTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_BudgetTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None,
        order: Optional[Union[types.LiteLLM_BudgetTableOrderByInput, List[types.LiteLLM_BudgetTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_BudgetTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_BudgetTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_BudgetTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_BudgetTable model
        order
            Order the returned LiteLLM_BudgetTable records by any field
        distinct
            Filter LiteLLM_BudgetTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_BudgetTable
            The first LiteLLM_BudgetTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_BudgetTable record ordered by the tpm_limit field
        litellm_budgettable = await LiteLLM_BudgetTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'tpm_limit': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_BudgetTableUpdateInput,
        where: types.LiteLLM_BudgetTableWhereUniqueInput,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_BudgetTable record.

        Parameters
        ----------
        data
            LiteLLM_BudgetTable record data specifying what to update
        where
            LiteLLM_BudgetTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_BudgetTable model

        Returns
        -------
        prisma.models.LiteLLM_BudgetTable
            The updated LiteLLM_BudgetTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_budgettable = await LiteLLM_BudgetTable.prisma().update(
            where={
                'budget_id': 'fjfddhigg',
            },
            data={
                # data to update the LiteLLM_BudgetTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_BudgetTableWhereUniqueInput,
        data: types.LiteLLM_BudgetTableUpsertInput,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_BudgetTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_BudgetTable model

        Returns
        -------
        prisma.models.LiteLLM_BudgetTable
            The created or updated LiteLLM_BudgetTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_budgettable = await LiteLLM_BudgetTable.prisma().upsert(
            where={
                'budget_id': 'hjaecfifb',
            },
            data={
                'create': {
                    'budget_id': 'hjaecfifb',
                    'created_by': 'eigcfgbif',
                    'updated_by': 'bagcfbhiig',
                },
                'update': {
                    'created_by': 'eigcfgbif',
                    'updated_by': 'bagcfbhiig',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_BudgetTableUpdateManyMutationInput,
        where: types.LiteLLM_BudgetTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_BudgetTable records

        Parameters
        ----------
        data
            LiteLLM_BudgetTable data to update the selected LiteLLM_BudgetTable records to
        where
            Filter to select the LiteLLM_BudgetTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_BudgetTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_BudgetTable records
        total = await LiteLLM_BudgetTable.prisma().update_many(
            data={
                'rpm_limit': 25342983456
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_BudgetTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_BudgetTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_BudgetTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_BudgetTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_BudgetTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_BudgetTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_BudgetTable.prisma().count()

        # results: prisma.types.LiteLLM_BudgetTableCountAggregateOutput
        results = await LiteLLM_BudgetTable.prisma().count(
            select={
                '_all': True,
                'model_max_budget': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_BudgetTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_BudgetTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_BudgetTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_BudgetTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_BudgetTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_BudgetTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_BudgetTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_BudgetTableCountAggregateOutput]:
        """Count the number of LiteLLM_BudgetTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_BudgetTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_BudgetTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_BudgetTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_BudgetTable.prisma().count()

        # results: prisma.types.LiteLLM_BudgetTableCountAggregateOutput
        results = await LiteLLM_BudgetTable.prisma().count(
            select={
                '_all': True,
                'budget_duration': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_BudgetTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_BudgetTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_BudgetTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_BudgetTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_BudgetTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_BudgetTable records
        total = await LiteLLM_BudgetTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_BudgetTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_BudgetTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_BudgetTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_BudgetTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_BudgetTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_BudgetTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_BudgetTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_BudgetTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_BudgetTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_BudgetTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_BudgetTableGroupByOutput']:
        """Group LiteLLM_BudgetTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_BudgetTable fields to group records by
        where
            LiteLLM_BudgetTable filter to select records
        take
            Limit the maximum number of LiteLLM_BudgetTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_BudgetTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_BudgetTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_BudgetTable records by budget_reset_at values
        # and count how many records are in each group
        results = await LiteLLM_BudgetTable.prisma().group_by(
            ['budget_reset_at'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_CredentialsTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_CredentialsTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_CredentialsTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_CredentialsTable WHERE credential_id = $1',
            'bbejhfidcb',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_CredentialsTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_CredentialsTable.prisma().query_first(
            'SELECT * FROM LiteLLM_CredentialsTable WHERE credential_name = $1',
            'bgeecijdgg',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_CredentialsTableCreateInput,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_CredentialsTable record.

        Parameters
        ----------
        data
            LiteLLM_CredentialsTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_CredentialsTable model

        Returns
        -------
        prisma.models.LiteLLM_CredentialsTable
            The created LiteLLM_CredentialsTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_CredentialsTable record from just the required fields
        litellm_credentialstable = await LiteLLM_CredentialsTable.prisma().create(
            data={
                # data to create a LiteLLM_CredentialsTable record
                'credential_name': 'bdiicjafbj',
                'credential_values': Json({'bgehebiafc': True}),
                'created_by': 'bghffegacj',
                'updated_by': 'bhghchehcc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_CredentialsTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_CredentialsTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_CredentialsTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_CredentialsTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_CredentialsTable record
                    'credential_name': 'dcgchcbbf',
                    'credential_values': Json({'bdedcabahc': True}),
                    'created_by': 'ghfhiafcb',
                    'updated_by': 'heejgedji',
                },
                {
                    # data to create a LiteLLM_CredentialsTable record
                    'credential_name': 'bjgjgibgbf',
                    'credential_values': Json({'bbbgbhfjge': True}),
                    'created_by': 'igbehcbab',
                    'updated_by': 'bdadaadhag',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_CredentialsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_CredentialsTable record.

        Parameters
        ----------
        where
            LiteLLM_CredentialsTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_CredentialsTable model

        Returns
        -------
        prisma.models.LiteLLM_CredentialsTable
            The deleted LiteLLM_CredentialsTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_credentialstable = await LiteLLM_CredentialsTable.prisma().delete(
            where={
                'credential_id': 'bgiggdidbf',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_CredentialsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_CredentialsTable record.

        Parameters
        ----------
        where
            LiteLLM_CredentialsTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_CredentialsTable model

        Returns
        -------
        prisma.models.LiteLLM_CredentialsTable
            The found LiteLLM_CredentialsTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_credentialstable = await LiteLLM_CredentialsTable.prisma().find_unique(
            where={
                'credential_id': 'caaaedabfc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_CredentialsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_CredentialsTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_CredentialsTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_CredentialsTable model

        Returns
        -------
        prisma.models.LiteLLM_CredentialsTable
            The found LiteLLM_CredentialsTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_credentialstable = await LiteLLM_CredentialsTable.prisma().find_unique_or_raise(
            where={
                'credential_id': 'bigibebcib',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CredentialsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_CredentialsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_CredentialsTableOrderByInput, List[types.LiteLLM_CredentialsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_CredentialsTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_CredentialsTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_CredentialsTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_CredentialsTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_CredentialsTable model
        order
            Order the returned LiteLLM_CredentialsTable records by any field
        distinct
            Filter LiteLLM_CredentialsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_CredentialsTable]
            The list of all LiteLLM_CredentialsTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_CredentialsTable records
        litellm_credentialstables = await LiteLLM_CredentialsTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_CredentialsTable records ordered by the credential_values field
        litellm_credentialstables = await LiteLLM_CredentialsTable.prisma().find_many(
            take=5,
            order={
                'credential_values': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CredentialsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_CredentialsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_CredentialsTableOrderByInput, List[types.LiteLLM_CredentialsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_CredentialsTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_CredentialsTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_CredentialsTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_CredentialsTable model
        order
            Order the returned LiteLLM_CredentialsTable records by any field
        distinct
            Filter LiteLLM_CredentialsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_CredentialsTable
            The first LiteLLM_CredentialsTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_CredentialsTable record ordered by the credential_info field
        litellm_credentialstable = await LiteLLM_CredentialsTable.prisma().find_first(
            skip=1,
            order={
                'credential_info': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CredentialsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_CredentialsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_CredentialsTableOrderByInput, List[types.LiteLLM_CredentialsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_CredentialsTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_CredentialsTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_CredentialsTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_CredentialsTable model
        order
            Order the returned LiteLLM_CredentialsTable records by any field
        distinct
            Filter LiteLLM_CredentialsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_CredentialsTable
            The first LiteLLM_CredentialsTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_CredentialsTable record ordered by the created_at field
        litellm_credentialstable = await LiteLLM_CredentialsTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'created_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_CredentialsTableUpdateInput,
        where: types.LiteLLM_CredentialsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_CredentialsTable record.

        Parameters
        ----------
        data
            LiteLLM_CredentialsTable record data specifying what to update
        where
            LiteLLM_CredentialsTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_CredentialsTable model

        Returns
        -------
        prisma.models.LiteLLM_CredentialsTable
            The updated LiteLLM_CredentialsTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_credentialstable = await LiteLLM_CredentialsTable.prisma().update(
            where={
                'credential_id': 'bigaiehgcc',
            },
            data={
                # data to update the LiteLLM_CredentialsTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_CredentialsTableWhereUniqueInput,
        data: types.LiteLLM_CredentialsTableUpsertInput,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_CredentialsTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_CredentialsTable model

        Returns
        -------
        prisma.models.LiteLLM_CredentialsTable
            The created or updated LiteLLM_CredentialsTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_credentialstable = await LiteLLM_CredentialsTable.prisma().upsert(
            where={
                'credential_id': 'beeifcbebf',
            },
            data={
                'create': {
                    'credential_id': 'beeifcbebf',
                    'credential_name': 'bjgjgibgbf',
                    'credential_values': Json({'bbbgbhfjge': True}),
                    'created_by': 'igbehcbab',
                    'updated_by': 'bdadaadhag',
                },
                'update': {
                    'credential_name': 'bjgjgibgbf',
                    'credential_values': Json({'bbbgbhfjge': True}),
                    'created_by': 'igbehcbab',
                    'updated_by': 'bdadaadhag',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_CredentialsTableUpdateManyMutationInput,
        where: types.LiteLLM_CredentialsTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_CredentialsTable records

        Parameters
        ----------
        data
            LiteLLM_CredentialsTable data to update the selected LiteLLM_CredentialsTable records to
        where
            Filter to select the LiteLLM_CredentialsTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_CredentialsTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_CredentialsTable records
        total = await LiteLLM_CredentialsTable.prisma().update_many(
            data={
                'created_by': 'bgcigfahea'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CredentialsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_CredentialsTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_CredentialsTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_CredentialsTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_CredentialsTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_CredentialsTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_CredentialsTable.prisma().count()

        # results: prisma.types.LiteLLM_CredentialsTableCountAggregateOutput
        results = await LiteLLM_CredentialsTable.prisma().count(
            select={
                '_all': True,
                'updated_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_CredentialsTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CredentialsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_CredentialsTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_CredentialsTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_CredentialsTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CredentialsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_CredentialsTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_CredentialsTableCountAggregateOutput]:
        """Count the number of LiteLLM_CredentialsTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_CredentialsTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_CredentialsTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_CredentialsTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_CredentialsTable.prisma().count()

        # results: prisma.types.LiteLLM_CredentialsTableCountAggregateOutput
        results = await LiteLLM_CredentialsTable.prisma().count(
            select={
                '_all': True,
                'updated_by': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_CredentialsTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_CredentialsTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_CredentialsTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_CredentialsTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_CredentialsTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_CredentialsTable records
        total = await LiteLLM_CredentialsTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_CredentialsTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_CredentialsTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_CredentialsTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_CredentialsTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_CredentialsTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_CredentialsTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_CredentialsTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_CredentialsTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_CredentialsTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_CredentialsTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_CredentialsTableGroupByOutput']:
        """Group LiteLLM_CredentialsTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_CredentialsTable fields to group records by
        where
            LiteLLM_CredentialsTable filter to select records
        take
            Limit the maximum number of LiteLLM_CredentialsTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_CredentialsTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_CredentialsTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_CredentialsTable records by credential_id values
        # and count how many records are in each group
        results = await LiteLLM_CredentialsTable.prisma().group_by(
            ['credential_id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ProxyModelTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ProxyModelTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ProxyModelTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_ProxyModelTable WHERE model_id = $1',
            'bcejgaggif',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ProxyModelTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ProxyModelTable.prisma().query_first(
            'SELECT * FROM LiteLLM_ProxyModelTable WHERE model_name = $1',
            'idfjadbcc',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ProxyModelTableCreateInput,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ProxyModelTable record.

        Parameters
        ----------
        data
            LiteLLM_ProxyModelTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProxyModelTable model

        Returns
        -------
        prisma.models.LiteLLM_ProxyModelTable
            The created LiteLLM_ProxyModelTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ProxyModelTable record from just the required fields
        litellm_proxymodeltable = await LiteLLM_ProxyModelTable.prisma().create(
            data={
                # data to create a LiteLLM_ProxyModelTable record
                'model_name': 'hgdhbjhhj',
                'litellm_params': Json({'ecjjjfbae': True}),
                'created_by': 'bhhfibbigf',
                'updated_by': 'ijdbeffgg',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ProxyModelTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ProxyModelTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ProxyModelTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ProxyModelTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ProxyModelTable record
                    'model_name': 'jjfeafhfj',
                    'litellm_params': Json({'cbachdgfce': True}),
                    'created_by': 'chbfcacbd',
                    'updated_by': 'efggddide',
                },
                {
                    # data to create a LiteLLM_ProxyModelTable record
                    'model_name': 'caficfigfb',
                    'litellm_params': Json({'bfidgijfjc': True}),
                    'created_by': 'ihieecagf',
                    'updated_by': 'bghfciaafe',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ProxyModelTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ProxyModelTable record.

        Parameters
        ----------
        where
            LiteLLM_ProxyModelTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProxyModelTable model

        Returns
        -------
        prisma.models.LiteLLM_ProxyModelTable
            The deleted LiteLLM_ProxyModelTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_proxymodeltable = await LiteLLM_ProxyModelTable.prisma().delete(
            where={
                'model_id': 'bgchfhgceh',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ProxyModelTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ProxyModelTable record.

        Parameters
        ----------
        where
            LiteLLM_ProxyModelTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProxyModelTable model

        Returns
        -------
        prisma.models.LiteLLM_ProxyModelTable
            The found LiteLLM_ProxyModelTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_proxymodeltable = await LiteLLM_ProxyModelTable.prisma().find_unique(
            where={
                'model_id': 'cafeiaccbc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ProxyModelTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ProxyModelTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ProxyModelTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProxyModelTable model

        Returns
        -------
        prisma.models.LiteLLM_ProxyModelTable
            The found LiteLLM_ProxyModelTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_proxymodeltable = await LiteLLM_ProxyModelTable.prisma().find_unique_or_raise(
            where={
                'model_id': 'gaddfhfh',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ProxyModelTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ProxyModelTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ProxyModelTableOrderByInput, List[types.LiteLLM_ProxyModelTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ProxyModelTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ProxyModelTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ProxyModelTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ProxyModelTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProxyModelTable model
        order
            Order the returned LiteLLM_ProxyModelTable records by any field
        distinct
            Filter LiteLLM_ProxyModelTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ProxyModelTable]
            The list of all LiteLLM_ProxyModelTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ProxyModelTable records
        litellm_proxymodeltables = await LiteLLM_ProxyModelTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ProxyModelTable records ordered by the litellm_params field
        litellm_proxymodeltables = await LiteLLM_ProxyModelTable.prisma().find_many(
            take=5,
            order={
                'litellm_params': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ProxyModelTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ProxyModelTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ProxyModelTableOrderByInput, List[types.LiteLLM_ProxyModelTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ProxyModelTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ProxyModelTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ProxyModelTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProxyModelTable model
        order
            Order the returned LiteLLM_ProxyModelTable records by any field
        distinct
            Filter LiteLLM_ProxyModelTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ProxyModelTable
            The first LiteLLM_ProxyModelTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ProxyModelTable record ordered by the model_info field
        litellm_proxymodeltable = await LiteLLM_ProxyModelTable.prisma().find_first(
            skip=1,
            order={
                'model_info': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ProxyModelTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ProxyModelTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ProxyModelTableOrderByInput, List[types.LiteLLM_ProxyModelTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ProxyModelTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ProxyModelTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ProxyModelTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProxyModelTable model
        order
            Order the returned LiteLLM_ProxyModelTable records by any field
        distinct
            Filter LiteLLM_ProxyModelTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ProxyModelTable
            The first LiteLLM_ProxyModelTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ProxyModelTable record ordered by the created_at field
        litellm_proxymodeltable = await LiteLLM_ProxyModelTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'created_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ProxyModelTableUpdateInput,
        where: types.LiteLLM_ProxyModelTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ProxyModelTable record.

        Parameters
        ----------
        data
            LiteLLM_ProxyModelTable record data specifying what to update
        where
            LiteLLM_ProxyModelTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProxyModelTable model

        Returns
        -------
        prisma.models.LiteLLM_ProxyModelTable
            The updated LiteLLM_ProxyModelTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_proxymodeltable = await LiteLLM_ProxyModelTable.prisma().update(
            where={
                'model_id': 'gieegcbeg',
            },
            data={
                # data to update the LiteLLM_ProxyModelTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ProxyModelTableWhereUniqueInput,
        data: types.LiteLLM_ProxyModelTableUpsertInput,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ProxyModelTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProxyModelTable model

        Returns
        -------
        prisma.models.LiteLLM_ProxyModelTable
            The created or updated LiteLLM_ProxyModelTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_proxymodeltable = await LiteLLM_ProxyModelTable.prisma().upsert(
            where={
                'model_id': 'bgcffadich',
            },
            data={
                'create': {
                    'model_id': 'bgcffadich',
                    'model_name': 'caficfigfb',
                    'litellm_params': Json({'bfidgijfjc': True}),
                    'created_by': 'ihieecagf',
                    'updated_by': 'bghfciaafe',
                },
                'update': {
                    'model_name': 'caficfigfb',
                    'litellm_params': Json({'bfidgijfjc': True}),
                    'created_by': 'ihieecagf',
                    'updated_by': 'bghfciaafe',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ProxyModelTableUpdateManyMutationInput,
        where: types.LiteLLM_ProxyModelTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ProxyModelTable records

        Parameters
        ----------
        data
            LiteLLM_ProxyModelTable data to update the selected LiteLLM_ProxyModelTable records to
        where
            Filter to select the LiteLLM_ProxyModelTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_ProxyModelTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ProxyModelTable records
        total = await LiteLLM_ProxyModelTable.prisma().update_many(
            data={
                'created_by': 'fcbichhci'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ProxyModelTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ProxyModelTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ProxyModelTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ProxyModelTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ProxyModelTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ProxyModelTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ProxyModelTable.prisma().count()

        # results: prisma.types.LiteLLM_ProxyModelTableCountAggregateOutput
        results = await LiteLLM_ProxyModelTable.prisma().count(
            select={
                '_all': True,
                'updated_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ProxyModelTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ProxyModelTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ProxyModelTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_ProxyModelTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ProxyModelTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ProxyModelTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ProxyModelTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ProxyModelTableCountAggregateOutput]:
        """Count the number of LiteLLM_ProxyModelTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ProxyModelTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ProxyModelTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ProxyModelTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ProxyModelTable.prisma().count()

        # results: prisma.types.LiteLLM_ProxyModelTableCountAggregateOutput
        results = await LiteLLM_ProxyModelTable.prisma().count(
            select={
                '_all': True,
                'updated_by': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ProxyModelTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ProxyModelTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ProxyModelTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_ProxyModelTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ProxyModelTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ProxyModelTable records
        total = await LiteLLM_ProxyModelTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ProxyModelTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ProxyModelTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ProxyModelTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ProxyModelTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ProxyModelTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ProxyModelTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ProxyModelTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ProxyModelTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ProxyModelTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ProxyModelTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ProxyModelTableGroupByOutput']:
        """Group LiteLLM_ProxyModelTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ProxyModelTable fields to group records by
        where
            LiteLLM_ProxyModelTable filter to select records
        take
            Limit the maximum number of LiteLLM_ProxyModelTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ProxyModelTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_ProxyModelTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ProxyModelTable records by model_id values
        # and count how many records are in each group
        results = await LiteLLM_ProxyModelTable.prisma().group_by(
            ['model_id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_AgentsTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_AgentsTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_AgentsTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_AgentsTable WHERE agent_id = $1',
            'bcggadccgf',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_AgentsTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_AgentsTable.prisma().query_first(
            'SELECT * FROM LiteLLM_AgentsTable WHERE agent_name = $1',
            'jdcfdcgc',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_AgentsTableCreateInput,
        include: Optional[types.LiteLLM_AgentsTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_AgentsTable record.

        Parameters
        ----------
        data
            LiteLLM_AgentsTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_AgentsTable model

        Returns
        -------
        prisma.models.LiteLLM_AgentsTable
            The created LiteLLM_AgentsTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_AgentsTable record from just the required fields
        litellm_agentstable = await LiteLLM_AgentsTable.prisma().create(
            data={
                # data to create a LiteLLM_AgentsTable record
                'agent_name': 'cafdaehjid',
                'agent_card_params': Json({'gifdddbia': True}),
                'created_by': 'bchehecef',
                'updated_by': 'jeijcbhfe',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_AgentsTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_AgentsTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_AgentsTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_AgentsTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_AgentsTable record
                    'agent_name': 'bjgejjabff',
                    'agent_card_params': Json({'bcciijbibg': True}),
                    'created_by': 'cffcachfd',
                    'updated_by': 'bccdfhdigc',
                },
                {
                    # data to create a LiteLLM_AgentsTable record
                    'agent_name': 'febcgjbfj',
                    'agent_card_params': Json({'bageiegghg': True}),
                    'created_by': 'faidicegb',
                    'updated_by': 'bacecgfhbe',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_AgentsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_AgentsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_AgentsTable record.

        Parameters
        ----------
        where
            LiteLLM_AgentsTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_AgentsTable model

        Returns
        -------
        prisma.models.LiteLLM_AgentsTable
            The deleted LiteLLM_AgentsTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_agentstable = await LiteLLM_AgentsTable.prisma().delete(
            where={
                'agent_id': 'ihcahiead',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_AgentsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_AgentsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_AgentsTable record.

        Parameters
        ----------
        where
            LiteLLM_AgentsTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_AgentsTable model

        Returns
        -------
        prisma.models.LiteLLM_AgentsTable
            The found LiteLLM_AgentsTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_agentstable = await LiteLLM_AgentsTable.prisma().find_unique(
            where={
                'agent_id': 'biheheiajg',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_AgentsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_AgentsTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_AgentsTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_AgentsTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_AgentsTable model

        Returns
        -------
        prisma.models.LiteLLM_AgentsTable
            The found LiteLLM_AgentsTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_agentstable = await LiteLLM_AgentsTable.prisma().find_unique_or_raise(
            where={
                'agent_id': 'jbgijghgb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AgentsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_AgentsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_AgentsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_AgentsTableOrderByInput, List[types.LiteLLM_AgentsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_AgentsTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_AgentsTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_AgentsTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_AgentsTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_AgentsTable model
        order
            Order the returned LiteLLM_AgentsTable records by any field
        distinct
            Filter LiteLLM_AgentsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_AgentsTable]
            The list of all LiteLLM_AgentsTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_AgentsTable records
        litellm_agentstables = await LiteLLM_AgentsTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_AgentsTable records ordered by the litellm_params field
        litellm_agentstables = await LiteLLM_AgentsTable.prisma().find_many(
            take=5,
            order={
                'litellm_params': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AgentsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_AgentsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_AgentsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_AgentsTableOrderByInput, List[types.LiteLLM_AgentsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_AgentsTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_AgentsTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_AgentsTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_AgentsTable model
        order
            Order the returned LiteLLM_AgentsTable records by any field
        distinct
            Filter LiteLLM_AgentsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_AgentsTable
            The first LiteLLM_AgentsTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_AgentsTable record ordered by the agent_card_params field
        litellm_agentstable = await LiteLLM_AgentsTable.prisma().find_first(
            skip=1,
            order={
                'agent_card_params': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AgentsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_AgentsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_AgentsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_AgentsTableOrderByInput, List[types.LiteLLM_AgentsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_AgentsTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_AgentsTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_AgentsTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_AgentsTable model
        order
            Order the returned LiteLLM_AgentsTable records by any field
        distinct
            Filter LiteLLM_AgentsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_AgentsTable
            The first LiteLLM_AgentsTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_AgentsTable record ordered by the static_headers field
        litellm_agentstable = await LiteLLM_AgentsTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'static_headers': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_AgentsTableUpdateInput,
        where: types.LiteLLM_AgentsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_AgentsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_AgentsTable record.

        Parameters
        ----------
        data
            LiteLLM_AgentsTable record data specifying what to update
        where
            LiteLLM_AgentsTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_AgentsTable model

        Returns
        -------
        prisma.models.LiteLLM_AgentsTable
            The updated LiteLLM_AgentsTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_agentstable = await LiteLLM_AgentsTable.prisma().update(
            where={
                'agent_id': 'hgjcghfbi',
            },
            data={
                # data to update the LiteLLM_AgentsTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_AgentsTableWhereUniqueInput,
        data: types.LiteLLM_AgentsTableUpsertInput,
        include: Optional[types.LiteLLM_AgentsTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_AgentsTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_AgentsTable model

        Returns
        -------
        prisma.models.LiteLLM_AgentsTable
            The created or updated LiteLLM_AgentsTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_agentstable = await LiteLLM_AgentsTable.prisma().upsert(
            where={
                'agent_id': 'icadbcehj',
            },
            data={
                'create': {
                    'agent_id': 'icadbcehj',
                    'agent_name': 'febcgjbfj',
                    'agent_card_params': Json({'bageiegghg': True}),
                    'created_by': 'faidicegb',
                    'updated_by': 'bacecgfhbe',
                },
                'update': {
                    'agent_name': 'febcgjbfj',
                    'agent_card_params': Json({'bageiegghg': True}),
                    'created_by': 'faidicegb',
                    'updated_by': 'bacecgfhbe',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_AgentsTableUpdateManyMutationInput,
        where: types.LiteLLM_AgentsTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_AgentsTable records

        Parameters
        ----------
        data
            LiteLLM_AgentsTable data to update the selected LiteLLM_AgentsTable records to
        where
            Filter to select the LiteLLM_AgentsTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_AgentsTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_AgentsTable records
        total = await LiteLLM_AgentsTable.prisma().update_many(
            data={
                'extra_headers': ['jchciaee']
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AgentsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_AgentsTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_AgentsTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_AgentsTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_AgentsTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_AgentsTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_AgentsTable.prisma().count()

        # results: prisma.types.LiteLLM_AgentsTableCountAggregateOutput
        results = await LiteLLM_AgentsTable.prisma().count(
            select={
                '_all': True,
                'agent_access_groups': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_AgentsTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AgentsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_AgentsTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_AgentsTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_AgentsTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AgentsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_AgentsTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_AgentsTableCountAggregateOutput]:
        """Count the number of LiteLLM_AgentsTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_AgentsTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_AgentsTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_AgentsTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_AgentsTable.prisma().count()

        # results: prisma.types.LiteLLM_AgentsTableCountAggregateOutput
        results = await LiteLLM_AgentsTable.prisma().count(
            select={
                '_all': True,
                'object_permission_id': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_AgentsTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_AgentsTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_AgentsTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_AgentsTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_AgentsTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_AgentsTable records
        total = await LiteLLM_AgentsTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_AgentsTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_AgentsTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_AgentsTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_AgentsTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_AgentsTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_AgentsTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_AgentsTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_AgentsTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_AgentsTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_AgentsTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_AgentsTableGroupByOutput']:
        """Group LiteLLM_AgentsTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_AgentsTable fields to group records by
        where
            LiteLLM_AgentsTable filter to select records
        take
            Limit the maximum number of LiteLLM_AgentsTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_AgentsTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_AgentsTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_AgentsTable records by spend values
        # and count how many records are in each group
        results = await LiteLLM_AgentsTable.prisma().group_by(
            ['spend'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_OrganizationTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_OrganizationTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_OrganizationTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_OrganizationTable WHERE organization_id = $1',
            'deeificjd',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_OrganizationTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_OrganizationTable.prisma().query_first(
            'SELECT * FROM LiteLLM_OrganizationTable WHERE organization_alias = $1',
            'bbcbhebbda',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_OrganizationTableCreateInput,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_OrganizationTable record.

        Parameters
        ----------
        data
            LiteLLM_OrganizationTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationTable model

        Returns
        -------
        prisma.models.LiteLLM_OrganizationTable
            The created LiteLLM_OrganizationTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_OrganizationTable record from just the required fields
        litellm_organizationtable = await LiteLLM_OrganizationTable.prisma().create(
            data={
                # data to create a LiteLLM_OrganizationTable record
                'organization_alias': 'bejfijgcfb',
                'budget_id': 'caifcbgii',
                'created_by': 'igaibbfgj',
                'updated_by': 'bggajdcbbi',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_OrganizationTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_OrganizationTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_OrganizationTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_OrganizationTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_OrganizationTable record
                    'organization_alias': 'fcfhgbjed',
                    'budget_id': 'hdgcajhjg',
                    'created_by': 'ejdjahicb',
                    'updated_by': 'gdjgigfgc',
                },
                {
                    # data to create a LiteLLM_OrganizationTable record
                    'organization_alias': 'gfeaahdeh',
                    'budget_id': 'bjafcgbffc',
                    'created_by': 'hihegjif',
                    'updated_by': 'bdjidcidac',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_OrganizationTableWhereUniqueInput,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_OrganizationTable record.

        Parameters
        ----------
        where
            LiteLLM_OrganizationTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationTable model

        Returns
        -------
        prisma.models.LiteLLM_OrganizationTable
            The deleted LiteLLM_OrganizationTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_organizationtable = await LiteLLM_OrganizationTable.prisma().delete(
            where={
                'organization_id': 'ifgaaagff',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_OrganizationTableWhereUniqueInput,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_OrganizationTable record.

        Parameters
        ----------
        where
            LiteLLM_OrganizationTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationTable model

        Returns
        -------
        prisma.models.LiteLLM_OrganizationTable
            The found LiteLLM_OrganizationTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_organizationtable = await LiteLLM_OrganizationTable.prisma().find_unique(
            where={
                'organization_id': 'befcddgjce',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_OrganizationTableWhereUniqueInput,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_OrganizationTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_OrganizationTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationTable model

        Returns
        -------
        prisma.models.LiteLLM_OrganizationTable
            The found LiteLLM_OrganizationTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_organizationtable = await LiteLLM_OrganizationTable.prisma().find_unique_or_raise(
            where={
                'organization_id': 'bfhdbjjgfd',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_OrganizationTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_OrganizationTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None,
        order: Optional[Union[types.LiteLLM_OrganizationTableOrderByInput, List[types.LiteLLM_OrganizationTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_OrganizationTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_OrganizationTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_OrganizationTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_OrganizationTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationTable model
        order
            Order the returned LiteLLM_OrganizationTable records by any field
        distinct
            Filter LiteLLM_OrganizationTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_OrganizationTable]
            The list of all LiteLLM_OrganizationTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_OrganizationTable records
        litellm_organizationtables = await LiteLLM_OrganizationTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_OrganizationTable records ordered by the budget_id field
        litellm_organizationtables = await LiteLLM_OrganizationTable.prisma().find_many(
            take=5,
            order={
                'budget_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_OrganizationTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_OrganizationTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None,
        order: Optional[Union[types.LiteLLM_OrganizationTableOrderByInput, List[types.LiteLLM_OrganizationTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_OrganizationTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_OrganizationTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_OrganizationTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationTable model
        order
            Order the returned LiteLLM_OrganizationTable records by any field
        distinct
            Filter LiteLLM_OrganizationTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_OrganizationTable
            The first LiteLLM_OrganizationTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_OrganizationTable record ordered by the metadata field
        litellm_organizationtable = await LiteLLM_OrganizationTable.prisma().find_first(
            skip=1,
            order={
                'metadata': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_OrganizationTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_OrganizationTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None,
        order: Optional[Union[types.LiteLLM_OrganizationTableOrderByInput, List[types.LiteLLM_OrganizationTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_OrganizationTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_OrganizationTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_OrganizationTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationTable model
        order
            Order the returned LiteLLM_OrganizationTable records by any field
        distinct
            Filter LiteLLM_OrganizationTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_OrganizationTable
            The first LiteLLM_OrganizationTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_OrganizationTable record ordered by the models field
        litellm_organizationtable = await LiteLLM_OrganizationTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'models': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_OrganizationTableUpdateInput,
        where: types.LiteLLM_OrganizationTableWhereUniqueInput,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_OrganizationTable record.

        Parameters
        ----------
        data
            LiteLLM_OrganizationTable record data specifying what to update
        where
            LiteLLM_OrganizationTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationTable model

        Returns
        -------
        prisma.models.LiteLLM_OrganizationTable
            The updated LiteLLM_OrganizationTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_organizationtable = await LiteLLM_OrganizationTable.prisma().update(
            where={
                'organization_id': 'cabdjadaji',
            },
            data={
                # data to update the LiteLLM_OrganizationTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_OrganizationTableWhereUniqueInput,
        data: types.LiteLLM_OrganizationTableUpsertInput,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_OrganizationTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationTable model

        Returns
        -------
        prisma.models.LiteLLM_OrganizationTable
            The created or updated LiteLLM_OrganizationTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_organizationtable = await LiteLLM_OrganizationTable.prisma().upsert(
            where={
                'organization_id': 'faajgfadf',
            },
            data={
                'create': {
                    'organization_id': 'faajgfadf',
                    'organization_alias': 'gfeaahdeh',
                    'budget_id': 'bjafcgbffc',
                    'created_by': 'hihegjif',
                    'updated_by': 'bdjidcidac',
                },
                'update': {
                    'organization_alias': 'gfeaahdeh',
                    'budget_id': 'bjafcgbffc',
                    'created_by': 'hihegjif',
                    'updated_by': 'bdjidcidac',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_OrganizationTableUpdateManyMutationInput,
        where: types.LiteLLM_OrganizationTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_OrganizationTable records

        Parameters
        ----------
        data
            LiteLLM_OrganizationTable data to update the selected LiteLLM_OrganizationTable records to
        where
            Filter to select the LiteLLM_OrganizationTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_OrganizationTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_OrganizationTable records
        total = await LiteLLM_OrganizationTable.prisma().update_many(
            data={
                'spend': 1800624392.207706
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_OrganizationTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_OrganizationTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_OrganizationTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_OrganizationTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_OrganizationTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_OrganizationTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_OrganizationTable.prisma().count()

        # results: prisma.types.LiteLLM_OrganizationTableCountAggregateOutput
        results = await LiteLLM_OrganizationTable.prisma().count(
            select={
                '_all': True,
                'model_spend': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_OrganizationTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_OrganizationTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_OrganizationTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_OrganizationTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_OrganizationTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_OrganizationTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_OrganizationTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_OrganizationTableCountAggregateOutput]:
        """Count the number of LiteLLM_OrganizationTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_OrganizationTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_OrganizationTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_OrganizationTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_OrganizationTable.prisma().count()

        # results: prisma.types.LiteLLM_OrganizationTableCountAggregateOutput
        results = await LiteLLM_OrganizationTable.prisma().count(
            select={
                '_all': True,
                'object_permission_id': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_OrganizationTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_OrganizationTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_OrganizationTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_OrganizationTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_OrganizationTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_OrganizationTable records
        total = await LiteLLM_OrganizationTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_OrganizationTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_OrganizationTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_OrganizationTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_OrganizationTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_OrganizationTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_OrganizationTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_OrganizationTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_OrganizationTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_OrganizationTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_OrganizationTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_OrganizationTableGroupByOutput']:
        """Group LiteLLM_OrganizationTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_OrganizationTable fields to group records by
        where
            LiteLLM_OrganizationTable filter to select records
        take
            Limit the maximum number of LiteLLM_OrganizationTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_OrganizationTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_OrganizationTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_OrganizationTable records by created_at values
        # and count how many records are in each group
        results = await LiteLLM_OrganizationTable.prisma().group_by(
            ['created_at'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ModelTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ModelTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ModelTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_ModelTable WHERE id = $1',
            1672112838,
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ModelTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ModelTable.prisma().query_first(
            'SELECT * FROM LiteLLM_ModelTable WHERE model_aliases = $1',
            Json({'jcgghhgdj': True}),
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ModelTableCreateInput,
        include: Optional[types.LiteLLM_ModelTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ModelTable record.

        Parameters
        ----------
        data
            LiteLLM_ModelTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ModelTable model

        Returns
        -------
        prisma.models.LiteLLM_ModelTable
            The created LiteLLM_ModelTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ModelTable record from just the required fields
        litellm_modeltable = await LiteLLM_ModelTable.prisma().create(
            data={
                # data to create a LiteLLM_ModelTable record
                'created_by': 'beehgcebbg',
                'updated_by': 'bhdiaidiaf',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ModelTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ModelTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ModelTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ModelTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ModelTable record
                    'created_by': 'deajegcfi',
                    'updated_by': 'gabahhhjf',
                },
                {
                    # data to create a LiteLLM_ModelTable record
                    'created_by': 'cjagadcjg',
                    'updated_by': 'bifficggej',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ModelTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ModelTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ModelTable record.

        Parameters
        ----------
        where
            LiteLLM_ModelTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ModelTable model

        Returns
        -------
        prisma.models.LiteLLM_ModelTable
            The deleted LiteLLM_ModelTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_modeltable = await LiteLLM_ModelTable.prisma().delete(
            where={
                'id': 1611009182,
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ModelTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ModelTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ModelTable record.

        Parameters
        ----------
        where
            LiteLLM_ModelTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ModelTable model

        Returns
        -------
        prisma.models.LiteLLM_ModelTable
            The found LiteLLM_ModelTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_modeltable = await LiteLLM_ModelTable.prisma().find_unique(
            where={
                'id': 446673791,
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ModelTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ModelTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ModelTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ModelTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ModelTable model

        Returns
        -------
        prisma.models.LiteLLM_ModelTable
            The found LiteLLM_ModelTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_modeltable = await LiteLLM_ModelTable.prisma().find_unique_or_raise(
            where={
                'id': 300568396,
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ModelTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ModelTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ModelTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ModelTableOrderByInput, List[types.LiteLLM_ModelTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ModelTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ModelTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ModelTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ModelTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ModelTable model
        order
            Order the returned LiteLLM_ModelTable records by any field
        distinct
            Filter LiteLLM_ModelTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ModelTable]
            The list of all LiteLLM_ModelTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ModelTable records
        litellm_modeltables = await LiteLLM_ModelTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ModelTable records ordered by the created_at field
        litellm_modeltables = await LiteLLM_ModelTable.prisma().find_many(
            take=5,
            order={
                'created_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ModelTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ModelTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ModelTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ModelTableOrderByInput, List[types.LiteLLM_ModelTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ModelTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ModelTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ModelTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ModelTable model
        order
            Order the returned LiteLLM_ModelTable records by any field
        distinct
            Filter LiteLLM_ModelTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ModelTable
            The first LiteLLM_ModelTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ModelTable record ordered by the created_by field
        litellm_modeltable = await LiteLLM_ModelTable.prisma().find_first(
            skip=1,
            order={
                'created_by': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ModelTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ModelTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ModelTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ModelTableOrderByInput, List[types.LiteLLM_ModelTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ModelTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ModelTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ModelTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ModelTable model
        order
            Order the returned LiteLLM_ModelTable records by any field
        distinct
            Filter LiteLLM_ModelTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ModelTable
            The first LiteLLM_ModelTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ModelTable record ordered by the updated_at field
        litellm_modeltable = await LiteLLM_ModelTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'updated_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ModelTableUpdateInput,
        where: types.LiteLLM_ModelTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ModelTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ModelTable record.

        Parameters
        ----------
        data
            LiteLLM_ModelTable record data specifying what to update
        where
            LiteLLM_ModelTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ModelTable model

        Returns
        -------
        prisma.models.LiteLLM_ModelTable
            The updated LiteLLM_ModelTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_modeltable = await LiteLLM_ModelTable.prisma().update(
            where={
                'id': 632626069,
            },
            data={
                # data to update the LiteLLM_ModelTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ModelTableWhereUniqueInput,
        data: types.LiteLLM_ModelTableUpsertInput,
        include: Optional[types.LiteLLM_ModelTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ModelTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ModelTable model

        Returns
        -------
        prisma.models.LiteLLM_ModelTable
            The created or updated LiteLLM_ModelTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_modeltable = await LiteLLM_ModelTable.prisma().upsert(
            where={
                'id': 1724011690,
            },
            data={
                'create': {
                    'id': 1724011690,
                    'created_by': 'cjagadcjg',
                    'updated_by': 'bifficggej',
                },
                'update': {
                    'created_by': 'cjagadcjg',
                    'updated_by': 'bifficggej',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ModelTableUpdateManyMutationInput,
        where: types.LiteLLM_ModelTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ModelTable records

        Parameters
        ----------
        data
            LiteLLM_ModelTable data to update the selected LiteLLM_ModelTable records to
        where
            Filter to select the LiteLLM_ModelTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_ModelTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ModelTable records
        total = await LiteLLM_ModelTable.prisma().update_many(
            data={
                'updated_by': 'ehabfhegh'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ModelTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ModelTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ModelTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ModelTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ModelTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ModelTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ModelTable.prisma().count()

        # results: prisma.types.LiteLLM_ModelTableCountAggregateOutput
        results = await LiteLLM_ModelTable.prisma().count(
            select={
                '_all': True,
                'id': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ModelTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ModelTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ModelTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_ModelTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ModelTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ModelTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ModelTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ModelTableCountAggregateOutput]:
        """Count the number of LiteLLM_ModelTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ModelTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ModelTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ModelTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ModelTable.prisma().count()

        # results: prisma.types.LiteLLM_ModelTableCountAggregateOutput
        results = await LiteLLM_ModelTable.prisma().count(
            select={
                '_all': True,
                'model_aliases': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ModelTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ModelTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ModelTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_ModelTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ModelTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ModelTable records
        total = await LiteLLM_ModelTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ModelTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ModelTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ModelTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ModelTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ModelTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ModelTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ModelTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ModelTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ModelTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ModelTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ModelTableGroupByOutput']:
        """Group LiteLLM_ModelTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ModelTable fields to group records by
        where
            LiteLLM_ModelTable filter to select records
        take
            Limit the maximum number of LiteLLM_ModelTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ModelTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_ModelTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ModelTable records by created_at values
        # and count how many records are in each group
        results = await LiteLLM_ModelTable.prisma().group_by(
            ['created_at'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_TeamTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_TeamTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_TeamTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_TeamTable WHERE team_id = $1',
            'bcajcajjbc',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_TeamTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_TeamTable.prisma().query_first(
            'SELECT * FROM LiteLLM_TeamTable WHERE team_alias = $1',
            'bfdgheeegf',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_TeamTableCreateInput,
        include: Optional[types.LiteLLM_TeamTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_TeamTable record.

        Parameters
        ----------
        data
            LiteLLM_TeamTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamTable model

        Returns
        -------
        prisma.models.LiteLLM_TeamTable
            The created LiteLLM_TeamTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_TeamTable record from just the required fields
        litellm_teamtable = await LiteLLM_TeamTable.prisma().create(
            data={
                # data to create a LiteLLM_TeamTable record
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_TeamTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_TeamTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_TeamTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_TeamTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_TeamTable record
                },
                {
                    # data to create a LiteLLM_TeamTable record
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_TeamTableWhereUniqueInput,
        include: Optional[types.LiteLLM_TeamTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_TeamTable record.

        Parameters
        ----------
        where
            LiteLLM_TeamTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamTable model

        Returns
        -------
        prisma.models.LiteLLM_TeamTable
            The deleted LiteLLM_TeamTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_teamtable = await LiteLLM_TeamTable.prisma().delete(
            where={
                'team_id': 'ececbijji',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_TeamTableWhereUniqueInput,
        include: Optional[types.LiteLLM_TeamTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_TeamTable record.

        Parameters
        ----------
        where
            LiteLLM_TeamTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamTable model

        Returns
        -------
        prisma.models.LiteLLM_TeamTable
            The found LiteLLM_TeamTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_teamtable = await LiteLLM_TeamTable.prisma().find_unique(
            where={
                'team_id': 'cbcfgdcdhf',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_TeamTableWhereUniqueInput,
        include: Optional[types.LiteLLM_TeamTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_TeamTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_TeamTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamTable model

        Returns
        -------
        prisma.models.LiteLLM_TeamTable
            The found LiteLLM_TeamTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_teamtable = await LiteLLM_TeamTable.prisma().find_unique_or_raise(
            where={
                'team_id': 'fdgjfbhia',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TeamTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_TeamTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_TeamTableInclude] = None,
        order: Optional[Union[types.LiteLLM_TeamTableOrderByInput, List[types.LiteLLM_TeamTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_TeamTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_TeamTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_TeamTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_TeamTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamTable model
        order
            Order the returned LiteLLM_TeamTable records by any field
        distinct
            Filter LiteLLM_TeamTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_TeamTable]
            The list of all LiteLLM_TeamTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_TeamTable records
        litellm_teamtables = await LiteLLM_TeamTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_TeamTable records ordered by the organization_id field
        litellm_teamtables = await LiteLLM_TeamTable.prisma().find_many(
            take=5,
            order={
                'organization_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TeamTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_TeamTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_TeamTableInclude] = None,
        order: Optional[Union[types.LiteLLM_TeamTableOrderByInput, List[types.LiteLLM_TeamTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_TeamTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_TeamTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_TeamTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamTable model
        order
            Order the returned LiteLLM_TeamTable records by any field
        distinct
            Filter LiteLLM_TeamTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_TeamTable
            The first LiteLLM_TeamTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_TeamTable record ordered by the object_permission_id field
        litellm_teamtable = await LiteLLM_TeamTable.prisma().find_first(
            skip=1,
            order={
                'object_permission_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TeamTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_TeamTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_TeamTableInclude] = None,
        order: Optional[Union[types.LiteLLM_TeamTableOrderByInput, List[types.LiteLLM_TeamTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_TeamTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_TeamTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_TeamTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamTable model
        order
            Order the returned LiteLLM_TeamTable records by any field
        distinct
            Filter LiteLLM_TeamTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_TeamTable
            The first LiteLLM_TeamTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_TeamTable record ordered by the admins field
        litellm_teamtable = await LiteLLM_TeamTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'admins': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_TeamTableUpdateInput,
        where: types.LiteLLM_TeamTableWhereUniqueInput,
        include: Optional[types.LiteLLM_TeamTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_TeamTable record.

        Parameters
        ----------
        data
            LiteLLM_TeamTable record data specifying what to update
        where
            LiteLLM_TeamTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamTable model

        Returns
        -------
        prisma.models.LiteLLM_TeamTable
            The updated LiteLLM_TeamTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_teamtable = await LiteLLM_TeamTable.prisma().update(
            where={
                'team_id': 'jcehcdchh',
            },
            data={
                # data to update the LiteLLM_TeamTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_TeamTableWhereUniqueInput,
        data: types.LiteLLM_TeamTableUpsertInput,
        include: Optional[types.LiteLLM_TeamTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_TeamTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamTable model

        Returns
        -------
        prisma.models.LiteLLM_TeamTable
            The created or updated LiteLLM_TeamTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_teamtable = await LiteLLM_TeamTable.prisma().upsert(
            where={
                'team_id': 'bgcbjdhjcc',
            },
            data={
                'create': {
                    'team_id': 'bgcbjdhjcc',
                },
                'update': {
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_TeamTableUpdateManyMutationInput,
        where: types.LiteLLM_TeamTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_TeamTable records

        Parameters
        ----------
        data
            LiteLLM_TeamTable data to update the selected LiteLLM_TeamTable records to
        where
            Filter to select the LiteLLM_TeamTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_TeamTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_TeamTable records
        total = await LiteLLM_TeamTable.prisma().update_many(
            data={
                'members': ['bieiidcabj']
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TeamTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_TeamTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_TeamTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_TeamTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_TeamTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_TeamTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_TeamTable.prisma().count()

        # results: prisma.types.LiteLLM_TeamTableCountAggregateOutput
        results = await LiteLLM_TeamTable.prisma().count(
            select={
                '_all': True,
                'members_with_roles': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_TeamTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TeamTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_TeamTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_TeamTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_TeamTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TeamTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_TeamTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_TeamTableCountAggregateOutput]:
        """Count the number of LiteLLM_TeamTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_TeamTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_TeamTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_TeamTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_TeamTable.prisma().count()

        # results: prisma.types.LiteLLM_TeamTableCountAggregateOutput
        results = await LiteLLM_TeamTable.prisma().count(
            select={
                '_all': True,
                'metadata': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_TeamTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_TeamTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_TeamTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_TeamTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_TeamTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_TeamTable records
        total = await LiteLLM_TeamTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_TeamTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_TeamTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_TeamTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_TeamTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_TeamTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_TeamTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_TeamTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_TeamTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_TeamTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_TeamTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_TeamTableGroupByOutput']:
        """Group LiteLLM_TeamTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_TeamTable fields to group records by
        where
            LiteLLM_TeamTable filter to select records
        take
            Limit the maximum number of LiteLLM_TeamTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_TeamTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_TeamTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_TeamTable records by max_budget values
        # and count how many records are in each group
        results = await LiteLLM_TeamTable.prisma().group_by(
            ['max_budget'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ProjectTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ProjectTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ProjectTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_ProjectTable WHERE project_id = $1',
            'bjcbfcieaa',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ProjectTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ProjectTable.prisma().query_first(
            'SELECT * FROM LiteLLM_ProjectTable WHERE project_alias = $1',
            'cbaaechiej',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ProjectTableCreateInput,
        include: Optional[types.LiteLLM_ProjectTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ProjectTable record.

        Parameters
        ----------
        data
            LiteLLM_ProjectTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProjectTable model

        Returns
        -------
        prisma.models.LiteLLM_ProjectTable
            The created LiteLLM_ProjectTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ProjectTable record from just the required fields
        litellm_projecttable = await LiteLLM_ProjectTable.prisma().create(
            data={
                # data to create a LiteLLM_ProjectTable record
                'created_by': 'iejbeaaeg',
                'updated_by': 'jcibfcbhf',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ProjectTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ProjectTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ProjectTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ProjectTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ProjectTable record
                    'created_by': 'chdadcaga',
                    'updated_by': 'jicieifbh',
                },
                {
                    # data to create a LiteLLM_ProjectTable record
                    'created_by': 'fbahdheji',
                    'updated_by': 'cbbheiicgh',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ProjectTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ProjectTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ProjectTable record.

        Parameters
        ----------
        where
            LiteLLM_ProjectTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProjectTable model

        Returns
        -------
        prisma.models.LiteLLM_ProjectTable
            The deleted LiteLLM_ProjectTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_projecttable = await LiteLLM_ProjectTable.prisma().delete(
            where={
                'project_id': 'beabjeejdg',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ProjectTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ProjectTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ProjectTable record.

        Parameters
        ----------
        where
            LiteLLM_ProjectTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProjectTable model

        Returns
        -------
        prisma.models.LiteLLM_ProjectTable
            The found LiteLLM_ProjectTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_projecttable = await LiteLLM_ProjectTable.prisma().find_unique(
            where={
                'project_id': 'bcjhgahffd',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ProjectTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ProjectTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ProjectTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ProjectTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProjectTable model

        Returns
        -------
        prisma.models.LiteLLM_ProjectTable
            The found LiteLLM_ProjectTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_projecttable = await LiteLLM_ProjectTable.prisma().find_unique_or_raise(
            where={
                'project_id': 'fbjeiiffa',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ProjectTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ProjectTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ProjectTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ProjectTableOrderByInput, List[types.LiteLLM_ProjectTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ProjectTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ProjectTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ProjectTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ProjectTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProjectTable model
        order
            Order the returned LiteLLM_ProjectTable records by any field
        distinct
            Filter LiteLLM_ProjectTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ProjectTable]
            The list of all LiteLLM_ProjectTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ProjectTable records
        litellm_projecttables = await LiteLLM_ProjectTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ProjectTable records ordered by the description field
        litellm_projecttables = await LiteLLM_ProjectTable.prisma().find_many(
            take=5,
            order={
                'description': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ProjectTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ProjectTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ProjectTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ProjectTableOrderByInput, List[types.LiteLLM_ProjectTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ProjectTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ProjectTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ProjectTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProjectTable model
        order
            Order the returned LiteLLM_ProjectTable records by any field
        distinct
            Filter LiteLLM_ProjectTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ProjectTable
            The first LiteLLM_ProjectTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ProjectTable record ordered by the team_id field
        litellm_projecttable = await LiteLLM_ProjectTable.prisma().find_first(
            skip=1,
            order={
                'team_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ProjectTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ProjectTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ProjectTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ProjectTableOrderByInput, List[types.LiteLLM_ProjectTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ProjectTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ProjectTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ProjectTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProjectTable model
        order
            Order the returned LiteLLM_ProjectTable records by any field
        distinct
            Filter LiteLLM_ProjectTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ProjectTable
            The first LiteLLM_ProjectTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ProjectTable record ordered by the budget_id field
        litellm_projecttable = await LiteLLM_ProjectTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'budget_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ProjectTableUpdateInput,
        where: types.LiteLLM_ProjectTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ProjectTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ProjectTable record.

        Parameters
        ----------
        data
            LiteLLM_ProjectTable record data specifying what to update
        where
            LiteLLM_ProjectTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProjectTable model

        Returns
        -------
        prisma.models.LiteLLM_ProjectTable
            The updated LiteLLM_ProjectTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_projecttable = await LiteLLM_ProjectTable.prisma().update(
            where={
                'project_id': 'jhgidcgbf',
            },
            data={
                # data to update the LiteLLM_ProjectTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ProjectTableWhereUniqueInput,
        data: types.LiteLLM_ProjectTableUpsertInput,
        include: Optional[types.LiteLLM_ProjectTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ProjectTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ProjectTable model

        Returns
        -------
        prisma.models.LiteLLM_ProjectTable
            The created or updated LiteLLM_ProjectTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_projecttable = await LiteLLM_ProjectTable.prisma().upsert(
            where={
                'project_id': 'bgjgecfejc',
            },
            data={
                'create': {
                    'project_id': 'bgjgecfejc',
                    'created_by': 'fbahdheji',
                    'updated_by': 'cbbheiicgh',
                },
                'update': {
                    'created_by': 'fbahdheji',
                    'updated_by': 'cbbheiicgh',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ProjectTableUpdateManyMutationInput,
        where: types.LiteLLM_ProjectTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ProjectTable records

        Parameters
        ----------
        data
            LiteLLM_ProjectTable data to update the selected LiteLLM_ProjectTable records to
        where
            Filter to select the LiteLLM_ProjectTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_ProjectTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ProjectTable records
        total = await LiteLLM_ProjectTable.prisma().update_many(
            data={
                'metadata': Json({'bgjcgchib': True})
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ProjectTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ProjectTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ProjectTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ProjectTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ProjectTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ProjectTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ProjectTable.prisma().count()

        # results: prisma.types.LiteLLM_ProjectTableCountAggregateOutput
        results = await LiteLLM_ProjectTable.prisma().count(
            select={
                '_all': True,
                'models': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ProjectTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ProjectTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ProjectTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_ProjectTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ProjectTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ProjectTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ProjectTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ProjectTableCountAggregateOutput]:
        """Count the number of LiteLLM_ProjectTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ProjectTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ProjectTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ProjectTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ProjectTable.prisma().count()

        # results: prisma.types.LiteLLM_ProjectTableCountAggregateOutput
        results = await LiteLLM_ProjectTable.prisma().count(
            select={
                '_all': True,
                'spend': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ProjectTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ProjectTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ProjectTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_ProjectTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ProjectTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ProjectTable records
        total = await LiteLLM_ProjectTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ProjectTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ProjectTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ProjectTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ProjectTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ProjectTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ProjectTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ProjectTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ProjectTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ProjectTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ProjectTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ProjectTableGroupByOutput']:
        """Group LiteLLM_ProjectTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ProjectTable fields to group records by
        where
            LiteLLM_ProjectTable filter to select records
        take
            Limit the maximum number of LiteLLM_ProjectTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ProjectTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_ProjectTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ProjectTable records by model_spend values
        # and count how many records are in each group
        results = await LiteLLM_ProjectTable.prisma().group_by(
            ['model_spend'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_DeletedTeamTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_DeletedTeamTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_DeletedTeamTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_DeletedTeamTable WHERE id = $1',
            'bacdaibgfa',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_DeletedTeamTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_DeletedTeamTable.prisma().query_first(
            'SELECT * FROM LiteLLM_DeletedTeamTable WHERE team_id = $1',
            'dchgibach',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_DeletedTeamTableCreateInput,
        include: Optional[types.LiteLLM_DeletedTeamTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_DeletedTeamTable record.

        Parameters
        ----------
        data
            LiteLLM_DeletedTeamTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedTeamTable model

        Returns
        -------
        prisma.models.LiteLLM_DeletedTeamTable
            The created LiteLLM_DeletedTeamTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_DeletedTeamTable record from just the required fields
        litellm_deletedteamtable = await LiteLLM_DeletedTeamTable.prisma().create(
            data={
                # data to create a LiteLLM_DeletedTeamTable record
                'team_id': 'fchheijjc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_DeletedTeamTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_DeletedTeamTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_DeletedTeamTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_DeletedTeamTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_DeletedTeamTable record
                    'team_id': 'cacjdfhejh',
                },
                {
                    # data to create a LiteLLM_DeletedTeamTable record
                    'team_id': 'bdbifjhbbi',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_DeletedTeamTableWhereUniqueInput,
        include: Optional[types.LiteLLM_DeletedTeamTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_DeletedTeamTable record.

        Parameters
        ----------
        where
            LiteLLM_DeletedTeamTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedTeamTable model

        Returns
        -------
        prisma.models.LiteLLM_DeletedTeamTable
            The deleted LiteLLM_DeletedTeamTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_deletedteamtable = await LiteLLM_DeletedTeamTable.prisma().delete(
            where={
                'id': 'cbccbbcdfb',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_DeletedTeamTableWhereUniqueInput,
        include: Optional[types.LiteLLM_DeletedTeamTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_DeletedTeamTable record.

        Parameters
        ----------
        where
            LiteLLM_DeletedTeamTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedTeamTable model

        Returns
        -------
        prisma.models.LiteLLM_DeletedTeamTable
            The found LiteLLM_DeletedTeamTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_deletedteamtable = await LiteLLM_DeletedTeamTable.prisma().find_unique(
            where={
                'id': 'bacejedaca',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_DeletedTeamTableWhereUniqueInput,
        include: Optional[types.LiteLLM_DeletedTeamTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_DeletedTeamTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_DeletedTeamTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedTeamTable model

        Returns
        -------
        prisma.models.LiteLLM_DeletedTeamTable
            The found LiteLLM_DeletedTeamTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_deletedteamtable = await LiteLLM_DeletedTeamTable.prisma().find_unique_or_raise(
            where={
                'id': 'bhbhdahfaj',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeletedTeamTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeletedTeamTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DeletedTeamTableInclude] = None,
        order: Optional[Union[types.LiteLLM_DeletedTeamTableOrderByInput, List[types.LiteLLM_DeletedTeamTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DeletedTeamTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_DeletedTeamTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_DeletedTeamTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_DeletedTeamTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedTeamTable model
        order
            Order the returned LiteLLM_DeletedTeamTable records by any field
        distinct
            Filter LiteLLM_DeletedTeamTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_DeletedTeamTable]
            The list of all LiteLLM_DeletedTeamTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_DeletedTeamTable records
        litellm_deletedteamtables = await LiteLLM_DeletedTeamTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_DeletedTeamTable records ordered by the team_alias field
        litellm_deletedteamtables = await LiteLLM_DeletedTeamTable.prisma().find_many(
            take=5,
            order={
                'team_alias': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeletedTeamTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeletedTeamTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DeletedTeamTableInclude] = None,
        order: Optional[Union[types.LiteLLM_DeletedTeamTableOrderByInput, List[types.LiteLLM_DeletedTeamTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DeletedTeamTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_DeletedTeamTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DeletedTeamTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedTeamTable model
        order
            Order the returned LiteLLM_DeletedTeamTable records by any field
        distinct
            Filter LiteLLM_DeletedTeamTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DeletedTeamTable
            The first LiteLLM_DeletedTeamTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DeletedTeamTable record ordered by the organization_id field
        litellm_deletedteamtable = await LiteLLM_DeletedTeamTable.prisma().find_first(
            skip=1,
            order={
                'organization_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeletedTeamTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeletedTeamTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DeletedTeamTableInclude] = None,
        order: Optional[Union[types.LiteLLM_DeletedTeamTableOrderByInput, List[types.LiteLLM_DeletedTeamTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DeletedTeamTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_DeletedTeamTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DeletedTeamTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedTeamTable model
        order
            Order the returned LiteLLM_DeletedTeamTable records by any field
        distinct
            Filter LiteLLM_DeletedTeamTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DeletedTeamTable
            The first LiteLLM_DeletedTeamTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DeletedTeamTable record ordered by the object_permission_id field
        litellm_deletedteamtable = await LiteLLM_DeletedTeamTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'object_permission_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_DeletedTeamTableUpdateInput,
        where: types.LiteLLM_DeletedTeamTableWhereUniqueInput,
        include: Optional[types.LiteLLM_DeletedTeamTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_DeletedTeamTable record.

        Parameters
        ----------
        data
            LiteLLM_DeletedTeamTable record data specifying what to update
        where
            LiteLLM_DeletedTeamTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedTeamTable model

        Returns
        -------
        prisma.models.LiteLLM_DeletedTeamTable
            The updated LiteLLM_DeletedTeamTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_deletedteamtable = await LiteLLM_DeletedTeamTable.prisma().update(
            where={
                'id': 'bfjibceaec',
            },
            data={
                # data to update the LiteLLM_DeletedTeamTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_DeletedTeamTableWhereUniqueInput,
        data: types.LiteLLM_DeletedTeamTableUpsertInput,
        include: Optional[types.LiteLLM_DeletedTeamTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_DeletedTeamTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedTeamTable model

        Returns
        -------
        prisma.models.LiteLLM_DeletedTeamTable
            The created or updated LiteLLM_DeletedTeamTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_deletedteamtable = await LiteLLM_DeletedTeamTable.prisma().upsert(
            where={
                'id': 'ibhgcdbgd',
            },
            data={
                'create': {
                    'id': 'ibhgcdbgd',
                    'team_id': 'bdbifjhbbi',
                },
                'update': {
                    'team_id': 'bdbifjhbbi',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_DeletedTeamTableUpdateManyMutationInput,
        where: types.LiteLLM_DeletedTeamTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_DeletedTeamTable records

        Parameters
        ----------
        data
            LiteLLM_DeletedTeamTable data to update the selected LiteLLM_DeletedTeamTable records to
        where
            Filter to select the LiteLLM_DeletedTeamTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_DeletedTeamTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_DeletedTeamTable records
        total = await LiteLLM_DeletedTeamTable.prisma().update_many(
            data={
                'admins': ['badaffhddg']
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeletedTeamTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeletedTeamTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_DeletedTeamTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DeletedTeamTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DeletedTeamTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DeletedTeamTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DeletedTeamTable.prisma().count()

        # results: prisma.types.LiteLLM_DeletedTeamTableCountAggregateOutput
        results = await LiteLLM_DeletedTeamTable.prisma().count(
            select={
                '_all': True,
                'members': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_DeletedTeamTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeletedTeamTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeletedTeamTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_DeletedTeamTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_DeletedTeamTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeletedTeamTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeletedTeamTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_DeletedTeamTableCountAggregateOutput]:
        """Count the number of LiteLLM_DeletedTeamTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DeletedTeamTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DeletedTeamTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DeletedTeamTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DeletedTeamTable.prisma().count()

        # results: prisma.types.LiteLLM_DeletedTeamTableCountAggregateOutput
        results = await LiteLLM_DeletedTeamTable.prisma().count(
            select={
                '_all': True,
                'members_with_roles': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_DeletedTeamTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_DeletedTeamTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_DeletedTeamTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_DeletedTeamTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_DeletedTeamTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_DeletedTeamTable records
        total = await LiteLLM_DeletedTeamTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_DeletedTeamTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_DeletedTeamTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_DeletedTeamTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_DeletedTeamTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_DeletedTeamTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_DeletedTeamTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_DeletedTeamTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_DeletedTeamTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_DeletedTeamTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_DeletedTeamTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_DeletedTeamTableGroupByOutput']:
        """Group LiteLLM_DeletedTeamTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_DeletedTeamTable fields to group records by
        where
            LiteLLM_DeletedTeamTable filter to select records
        take
            Limit the maximum number of LiteLLM_DeletedTeamTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_DeletedTeamTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_DeletedTeamTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_DeletedTeamTable records by metadata values
        # and count how many records are in each group
        results = await LiteLLM_DeletedTeamTable.prisma().group_by(
            ['metadata'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_UserTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_UserTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_UserTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_UserTable WHERE user_id = $1',
            'bbdbfcfihd',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_UserTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_UserTable.prisma().query_first(
            'SELECT * FROM LiteLLM_UserTable WHERE user_alias = $1',
            'cbagggbji',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_UserTableCreateInput,
        include: Optional[types.LiteLLM_UserTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_UserTable record.

        Parameters
        ----------
        data
            LiteLLM_UserTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserTable model

        Returns
        -------
        prisma.models.LiteLLM_UserTable
            The created LiteLLM_UserTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_UserTable record from just the required fields
        litellm_usertable = await LiteLLM_UserTable.prisma().create(
            data={
                # data to create a LiteLLM_UserTable record
                'user_id': 'bchgafhjed',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_UserTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_UserTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_UserTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_UserTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_UserTable record
                    'user_id': 'heffgjdei',
                },
                {
                    # data to create a LiteLLM_UserTable record
                    'user_id': 'dahihgbeb',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_UserTableWhereUniqueInput,
        include: Optional[types.LiteLLM_UserTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_UserTable record.

        Parameters
        ----------
        where
            LiteLLM_UserTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserTable model

        Returns
        -------
        prisma.models.LiteLLM_UserTable
            The deleted LiteLLM_UserTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_usertable = await LiteLLM_UserTable.prisma().delete(
            where={
                'user_id': 'bgheaejbcc',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_UserTableWhereUniqueInput,
        include: Optional[types.LiteLLM_UserTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_UserTable record.

        Parameters
        ----------
        where
            LiteLLM_UserTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserTable model

        Returns
        -------
        prisma.models.LiteLLM_UserTable
            The found LiteLLM_UserTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_usertable = await LiteLLM_UserTable.prisma().find_unique(
            where={
                'user_id': 'bfcgifeged',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_UserTableWhereUniqueInput,
        include: Optional[types.LiteLLM_UserTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_UserTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_UserTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserTable model

        Returns
        -------
        prisma.models.LiteLLM_UserTable
            The found LiteLLM_UserTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_usertable = await LiteLLM_UserTable.prisma().find_unique_or_raise(
            where={
                'user_id': 'jfiahhbae',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UserTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_UserTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_UserTableInclude] = None,
        order: Optional[Union[types.LiteLLM_UserTableOrderByInput, List[types.LiteLLM_UserTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_UserTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_UserTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_UserTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_UserTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserTable model
        order
            Order the returned LiteLLM_UserTable records by any field
        distinct
            Filter LiteLLM_UserTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_UserTable]
            The list of all LiteLLM_UserTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_UserTable records
        litellm_usertables = await LiteLLM_UserTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_UserTable records ordered by the team_id field
        litellm_usertables = await LiteLLM_UserTable.prisma().find_many(
            take=5,
            order={
                'team_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UserTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_UserTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_UserTableInclude] = None,
        order: Optional[Union[types.LiteLLM_UserTableOrderByInput, List[types.LiteLLM_UserTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_UserTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_UserTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_UserTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserTable model
        order
            Order the returned LiteLLM_UserTable records by any field
        distinct
            Filter LiteLLM_UserTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_UserTable
            The first LiteLLM_UserTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_UserTable record ordered by the sso_user_id field
        litellm_usertable = await LiteLLM_UserTable.prisma().find_first(
            skip=1,
            order={
                'sso_user_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UserTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_UserTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_UserTableInclude] = None,
        order: Optional[Union[types.LiteLLM_UserTableOrderByInput, List[types.LiteLLM_UserTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_UserTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_UserTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_UserTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserTable model
        order
            Order the returned LiteLLM_UserTable records by any field
        distinct
            Filter LiteLLM_UserTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_UserTable
            The first LiteLLM_UserTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_UserTable record ordered by the organization_id field
        litellm_usertable = await LiteLLM_UserTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'organization_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_UserTableUpdateInput,
        where: types.LiteLLM_UserTableWhereUniqueInput,
        include: Optional[types.LiteLLM_UserTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_UserTable record.

        Parameters
        ----------
        data
            LiteLLM_UserTable record data specifying what to update
        where
            LiteLLM_UserTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserTable model

        Returns
        -------
        prisma.models.LiteLLM_UserTable
            The updated LiteLLM_UserTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_usertable = await LiteLLM_UserTable.prisma().update(
            where={
                'user_id': 'bfbdafajcb',
            },
            data={
                # data to update the LiteLLM_UserTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_UserTableWhereUniqueInput,
        data: types.LiteLLM_UserTableUpsertInput,
        include: Optional[types.LiteLLM_UserTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_UserTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserTable model

        Returns
        -------
        prisma.models.LiteLLM_UserTable
            The created or updated LiteLLM_UserTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_usertable = await LiteLLM_UserTable.prisma().upsert(
            where={
                'user_id': 'caeghehde',
            },
            data={
                'create': {
                    'user_id': 'caeghehde',
                },
                'update': {
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_UserTableUpdateManyMutationInput,
        where: types.LiteLLM_UserTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_UserTable records

        Parameters
        ----------
        data
            LiteLLM_UserTable data to update the selected LiteLLM_UserTable records to
        where
            Filter to select the LiteLLM_UserTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_UserTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_UserTable records
        total = await LiteLLM_UserTable.prisma().update_many(
            data={
                'object_permission_id': 'caghgfbggd'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UserTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_UserTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_UserTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_UserTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_UserTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_UserTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_UserTable.prisma().count()

        # results: prisma.types.LiteLLM_UserTableCountAggregateOutput
        results = await LiteLLM_UserTable.prisma().count(
            select={
                '_all': True,
                'password': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_UserTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UserTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_UserTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_UserTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_UserTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UserTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_UserTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_UserTableCountAggregateOutput]:
        """Count the number of LiteLLM_UserTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_UserTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_UserTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_UserTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_UserTable.prisma().count()

        # results: prisma.types.LiteLLM_UserTableCountAggregateOutput
        results = await LiteLLM_UserTable.prisma().count(
            select={
                '_all': True,
                'teams': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_UserTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_UserTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_UserTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_UserTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_UserTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_UserTable records
        total = await LiteLLM_UserTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_UserTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_UserTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_UserTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_UserTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_UserTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_UserTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_UserTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_UserTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_UserTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_UserTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_UserTableGroupByOutput']:
        """Group LiteLLM_UserTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_UserTable fields to group records by
        where
            LiteLLM_UserTable filter to select records
        take
            Limit the maximum number of LiteLLM_UserTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_UserTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_UserTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_UserTable records by user_role values
        # and count how many records are in each group
        results = await LiteLLM_UserTable.prisma().group_by(
            ['user_role'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ObjectPermissionTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ObjectPermissionTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ObjectPermissionTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_ObjectPermissionTable WHERE object_permission_id = $1',
            'bbidjbbjaa',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ObjectPermissionTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ObjectPermissionTable.prisma().query_first(
            'SELECT * FROM LiteLLM_ObjectPermissionTable WHERE mcp_servers = $1',
            ['bfijhaejdd'],
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ObjectPermissionTableCreateInput,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ObjectPermissionTable record.

        Parameters
        ----------
        data
            LiteLLM_ObjectPermissionTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ObjectPermissionTable model

        Returns
        -------
        prisma.models.LiteLLM_ObjectPermissionTable
            The created LiteLLM_ObjectPermissionTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ObjectPermissionTable record from just the required fields
        litellm_objectpermissiontable = await LiteLLM_ObjectPermissionTable.prisma().create(
            data={
                # data to create a LiteLLM_ObjectPermissionTable record
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ObjectPermissionTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ObjectPermissionTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ObjectPermissionTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ObjectPermissionTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ObjectPermissionTable record
                },
                {
                    # data to create a LiteLLM_ObjectPermissionTable record
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ObjectPermissionTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ObjectPermissionTable record.

        Parameters
        ----------
        where
            LiteLLM_ObjectPermissionTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ObjectPermissionTable model

        Returns
        -------
        prisma.models.LiteLLM_ObjectPermissionTable
            The deleted LiteLLM_ObjectPermissionTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_objectpermissiontable = await LiteLLM_ObjectPermissionTable.prisma().delete(
            where={
                'object_permission_id': 'bcedehfiji',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ObjectPermissionTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ObjectPermissionTable record.

        Parameters
        ----------
        where
            LiteLLM_ObjectPermissionTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ObjectPermissionTable model

        Returns
        -------
        prisma.models.LiteLLM_ObjectPermissionTable
            The found LiteLLM_ObjectPermissionTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_objectpermissiontable = await LiteLLM_ObjectPermissionTable.prisma().find_unique(
            where={
                'object_permission_id': 'bdgjicijhb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ObjectPermissionTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ObjectPermissionTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ObjectPermissionTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ObjectPermissionTable model

        Returns
        -------
        prisma.models.LiteLLM_ObjectPermissionTable
            The found LiteLLM_ObjectPermissionTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_objectpermissiontable = await LiteLLM_ObjectPermissionTable.prisma().find_unique_or_raise(
            where={
                'object_permission_id': 'bghifjdeia',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ObjectPermissionTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ObjectPermissionTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ObjectPermissionTableOrderByInput, List[types.LiteLLM_ObjectPermissionTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ObjectPermissionTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ObjectPermissionTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ObjectPermissionTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ObjectPermissionTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ObjectPermissionTable model
        order
            Order the returned LiteLLM_ObjectPermissionTable records by any field
        distinct
            Filter LiteLLM_ObjectPermissionTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ObjectPermissionTable]
            The list of all LiteLLM_ObjectPermissionTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ObjectPermissionTable records
        litellm_objectpermissiontables = await LiteLLM_ObjectPermissionTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ObjectPermissionTable records ordered by the mcp_access_groups field
        litellm_objectpermissiontables = await LiteLLM_ObjectPermissionTable.prisma().find_many(
            take=5,
            order={
                'mcp_access_groups': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ObjectPermissionTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ObjectPermissionTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ObjectPermissionTableOrderByInput, List[types.LiteLLM_ObjectPermissionTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ObjectPermissionTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ObjectPermissionTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ObjectPermissionTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ObjectPermissionTable model
        order
            Order the returned LiteLLM_ObjectPermissionTable records by any field
        distinct
            Filter LiteLLM_ObjectPermissionTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ObjectPermissionTable
            The first LiteLLM_ObjectPermissionTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ObjectPermissionTable record ordered by the mcp_tool_permissions field
        litellm_objectpermissiontable = await LiteLLM_ObjectPermissionTable.prisma().find_first(
            skip=1,
            order={
                'mcp_tool_permissions': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ObjectPermissionTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ObjectPermissionTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ObjectPermissionTableOrderByInput, List[types.LiteLLM_ObjectPermissionTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ObjectPermissionTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ObjectPermissionTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ObjectPermissionTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ObjectPermissionTable model
        order
            Order the returned LiteLLM_ObjectPermissionTable records by any field
        distinct
            Filter LiteLLM_ObjectPermissionTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ObjectPermissionTable
            The first LiteLLM_ObjectPermissionTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ObjectPermissionTable record ordered by the vector_stores field
        litellm_objectpermissiontable = await LiteLLM_ObjectPermissionTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'vector_stores': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ObjectPermissionTableUpdateInput,
        where: types.LiteLLM_ObjectPermissionTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ObjectPermissionTable record.

        Parameters
        ----------
        data
            LiteLLM_ObjectPermissionTable record data specifying what to update
        where
            LiteLLM_ObjectPermissionTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ObjectPermissionTable model

        Returns
        -------
        prisma.models.LiteLLM_ObjectPermissionTable
            The updated LiteLLM_ObjectPermissionTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_objectpermissiontable = await LiteLLM_ObjectPermissionTable.prisma().update(
            where={
                'object_permission_id': 'eadfcbbcb',
            },
            data={
                # data to update the LiteLLM_ObjectPermissionTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ObjectPermissionTableWhereUniqueInput,
        data: types.LiteLLM_ObjectPermissionTableUpsertInput,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ObjectPermissionTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ObjectPermissionTable model

        Returns
        -------
        prisma.models.LiteLLM_ObjectPermissionTable
            The created or updated LiteLLM_ObjectPermissionTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_objectpermissiontable = await LiteLLM_ObjectPermissionTable.prisma().upsert(
            where={
                'object_permission_id': 'geihgahba',
            },
            data={
                'create': {
                    'object_permission_id': 'geihgahba',
                },
                'update': {
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ObjectPermissionTableUpdateManyMutationInput,
        where: types.LiteLLM_ObjectPermissionTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ObjectPermissionTable records

        Parameters
        ----------
        data
            LiteLLM_ObjectPermissionTable data to update the selected LiteLLM_ObjectPermissionTable records to
        where
            Filter to select the LiteLLM_ObjectPermissionTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_ObjectPermissionTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ObjectPermissionTable records
        total = await LiteLLM_ObjectPermissionTable.prisma().update_many(
            data={
                'agents': ['gahdcdhbj']
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ObjectPermissionTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ObjectPermissionTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ObjectPermissionTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ObjectPermissionTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ObjectPermissionTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ObjectPermissionTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ObjectPermissionTable.prisma().count()

        # results: prisma.types.LiteLLM_ObjectPermissionTableCountAggregateOutput
        results = await LiteLLM_ObjectPermissionTable.prisma().count(
            select={
                '_all': True,
                'agent_access_groups': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ObjectPermissionTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ObjectPermissionTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ObjectPermissionTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_ObjectPermissionTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ObjectPermissionTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ObjectPermissionTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ObjectPermissionTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ObjectPermissionTableCountAggregateOutput]:
        """Count the number of LiteLLM_ObjectPermissionTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ObjectPermissionTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ObjectPermissionTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ObjectPermissionTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ObjectPermissionTable.prisma().count()

        # results: prisma.types.LiteLLM_ObjectPermissionTableCountAggregateOutput
        results = await LiteLLM_ObjectPermissionTable.prisma().count(
            select={
                '_all': True,
                'blocked_tools': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ObjectPermissionTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ObjectPermissionTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ObjectPermissionTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_ObjectPermissionTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ObjectPermissionTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ObjectPermissionTable records
        total = await LiteLLM_ObjectPermissionTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ObjectPermissionTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ObjectPermissionTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ObjectPermissionTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ObjectPermissionTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ObjectPermissionTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ObjectPermissionTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ObjectPermissionTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ObjectPermissionTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ObjectPermissionTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ObjectPermissionTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ObjectPermissionTableGroupByOutput']:
        """Group LiteLLM_ObjectPermissionTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ObjectPermissionTable fields to group records by
        where
            LiteLLM_ObjectPermissionTable filter to select records
        take
            Limit the maximum number of LiteLLM_ObjectPermissionTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ObjectPermissionTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_ObjectPermissionTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ObjectPermissionTable records by object_permission_id values
        # and count how many records are in each group
        results = await LiteLLM_ObjectPermissionTable.prisma().group_by(
            ['object_permission_id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_MCPServerTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_MCPServerTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_MCPServerTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_MCPServerTable WHERE server_id = $1',
            'begiijahea',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_MCPServerTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_MCPServerTable.prisma().query_first(
            'SELECT * FROM LiteLLM_MCPServerTable WHERE server_name = $1',
            'gcjadjaaf',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_MCPServerTableCreateInput,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_MCPServerTable record.

        Parameters
        ----------
        data
            LiteLLM_MCPServerTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPServerTable model

        Returns
        -------
        prisma.models.LiteLLM_MCPServerTable
            The created LiteLLM_MCPServerTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_MCPServerTable record from just the required fields
        litellm_mcpservertable = await LiteLLM_MCPServerTable.prisma().create(
            data={
                # data to create a LiteLLM_MCPServerTable record
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_MCPServerTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_MCPServerTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_MCPServerTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_MCPServerTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_MCPServerTable record
                },
                {
                    # data to create a LiteLLM_MCPServerTable record
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_MCPServerTableWhereUniqueInput,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_MCPServerTable record.

        Parameters
        ----------
        where
            LiteLLM_MCPServerTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPServerTable model

        Returns
        -------
        prisma.models.LiteLLM_MCPServerTable
            The deleted LiteLLM_MCPServerTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_mcpservertable = await LiteLLM_MCPServerTable.prisma().delete(
            where={
                'server_id': 'bcbebgiaic',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_MCPServerTableWhereUniqueInput,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_MCPServerTable record.

        Parameters
        ----------
        where
            LiteLLM_MCPServerTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPServerTable model

        Returns
        -------
        prisma.models.LiteLLM_MCPServerTable
            The found LiteLLM_MCPServerTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_mcpservertable = await LiteLLM_MCPServerTable.prisma().find_unique(
            where={
                'server_id': 'ijigbdcbj',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_MCPServerTableWhereUniqueInput,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_MCPServerTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_MCPServerTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPServerTable model

        Returns
        -------
        prisma.models.LiteLLM_MCPServerTable
            The found LiteLLM_MCPServerTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_mcpservertable = await LiteLLM_MCPServerTable.prisma().find_unique_or_raise(
            where={
                'server_id': 'gfidhicai',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_MCPServerTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_MCPServerTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None,
        order: Optional[Union[types.LiteLLM_MCPServerTableOrderByInput, List[types.LiteLLM_MCPServerTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_MCPServerTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_MCPServerTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_MCPServerTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_MCPServerTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPServerTable model
        order
            Order the returned LiteLLM_MCPServerTable records by any field
        distinct
            Filter LiteLLM_MCPServerTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_MCPServerTable]
            The list of all LiteLLM_MCPServerTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_MCPServerTable records
        litellm_mcpservertables = await LiteLLM_MCPServerTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_MCPServerTable records ordered by the alias field
        litellm_mcpservertables = await LiteLLM_MCPServerTable.prisma().find_many(
            take=5,
            order={
                'alias': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_MCPServerTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_MCPServerTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None,
        order: Optional[Union[types.LiteLLM_MCPServerTableOrderByInput, List[types.LiteLLM_MCPServerTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_MCPServerTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_MCPServerTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_MCPServerTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPServerTable model
        order
            Order the returned LiteLLM_MCPServerTable records by any field
        distinct
            Filter LiteLLM_MCPServerTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_MCPServerTable
            The first LiteLLM_MCPServerTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_MCPServerTable record ordered by the description field
        litellm_mcpservertable = await LiteLLM_MCPServerTable.prisma().find_first(
            skip=1,
            order={
                'description': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_MCPServerTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_MCPServerTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None,
        order: Optional[Union[types.LiteLLM_MCPServerTableOrderByInput, List[types.LiteLLM_MCPServerTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_MCPServerTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_MCPServerTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_MCPServerTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPServerTable model
        order
            Order the returned LiteLLM_MCPServerTable records by any field
        distinct
            Filter LiteLLM_MCPServerTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_MCPServerTable
            The first LiteLLM_MCPServerTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_MCPServerTable record ordered by the url field
        litellm_mcpservertable = await LiteLLM_MCPServerTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'url': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_MCPServerTableUpdateInput,
        where: types.LiteLLM_MCPServerTableWhereUniqueInput,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_MCPServerTable record.

        Parameters
        ----------
        data
            LiteLLM_MCPServerTable record data specifying what to update
        where
            LiteLLM_MCPServerTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPServerTable model

        Returns
        -------
        prisma.models.LiteLLM_MCPServerTable
            The updated LiteLLM_MCPServerTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_mcpservertable = await LiteLLM_MCPServerTable.prisma().update(
            where={
                'server_id': 'jfegcaafh',
            },
            data={
                # data to update the LiteLLM_MCPServerTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_MCPServerTableWhereUniqueInput,
        data: types.LiteLLM_MCPServerTableUpsertInput,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_MCPServerTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPServerTable model

        Returns
        -------
        prisma.models.LiteLLM_MCPServerTable
            The created or updated LiteLLM_MCPServerTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_mcpservertable = await LiteLLM_MCPServerTable.prisma().upsert(
            where={
                'server_id': 'bcbeiajjfa',
            },
            data={
                'create': {
                    'server_id': 'bcbeiajjfa',
                },
                'update': {
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_MCPServerTableUpdateManyMutationInput,
        where: types.LiteLLM_MCPServerTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_MCPServerTable records

        Parameters
        ----------
        data
            LiteLLM_MCPServerTable data to update the selected LiteLLM_MCPServerTable records to
        where
            Filter to select the LiteLLM_MCPServerTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_MCPServerTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_MCPServerTable records
        total = await LiteLLM_MCPServerTable.prisma().update_many(
            data={
                'spec_path': 'baehicaajf'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_MCPServerTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_MCPServerTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_MCPServerTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_MCPServerTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_MCPServerTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_MCPServerTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_MCPServerTable.prisma().count()

        # results: prisma.types.LiteLLM_MCPServerTableCountAggregateOutput
        results = await LiteLLM_MCPServerTable.prisma().count(
            select={
                '_all': True,
                'transport': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_MCPServerTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_MCPServerTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_MCPServerTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_MCPServerTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_MCPServerTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_MCPServerTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_MCPServerTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_MCPServerTableCountAggregateOutput]:
        """Count the number of LiteLLM_MCPServerTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_MCPServerTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_MCPServerTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_MCPServerTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_MCPServerTable.prisma().count()

        # results: prisma.types.LiteLLM_MCPServerTableCountAggregateOutput
        results = await LiteLLM_MCPServerTable.prisma().count(
            select={
                '_all': True,
                'auth_type': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_MCPServerTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_MCPServerTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_MCPServerTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_MCPServerTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_MCPServerTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_MCPServerTable records
        total = await LiteLLM_MCPServerTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_MCPServerTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_MCPServerTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_MCPServerTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_MCPServerTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_MCPServerTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_MCPServerTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_MCPServerTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_MCPServerTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_MCPServerTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_MCPServerTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_MCPServerTableGroupByOutput']:
        """Group LiteLLM_MCPServerTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_MCPServerTable fields to group records by
        where
            LiteLLM_MCPServerTable filter to select records
        take
            Limit the maximum number of LiteLLM_MCPServerTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_MCPServerTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_MCPServerTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_MCPServerTable records by credentials values
        # and count how many records are in each group
        results = await LiteLLM_MCPServerTable.prisma().group_by(
            ['credentials'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_MCPUserCredentialsActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_MCPUserCredentials]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_MCPUserCredentials.prisma().query_raw(
            'SELECT * FROM LiteLLM_MCPUserCredentials WHERE id = $1',
            'bdachdeiga',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_MCPUserCredentials
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_MCPUserCredentials.prisma().query_first(
            'SELECT * FROM LiteLLM_MCPUserCredentials WHERE user_id = $1',
            'ijdafccef',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_MCPUserCredentialsCreateInput,
        include: Optional[types.LiteLLM_MCPUserCredentialsInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_MCPUserCredentials record.

        Parameters
        ----------
        data
            LiteLLM_MCPUserCredentials record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPUserCredentials model

        Returns
        -------
        prisma.models.LiteLLM_MCPUserCredentials
            The created LiteLLM_MCPUserCredentials record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_MCPUserCredentials record from just the required fields
        litellm_mcpusercredentials = await LiteLLM_MCPUserCredentials.prisma().create(
            data={
                # data to create a LiteLLM_MCPUserCredentials record
                'user_id': 'ciaaiddag',
                'server_id': 'fejggijff',
                'credential_b64': 'hghjaaai',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_MCPUserCredentialsCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_MCPUserCredentials records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_MCPUserCredentials record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_MCPUserCredentials.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_MCPUserCredentials record
                    'user_id': 'cajicjjdef',
                    'server_id': 'cefjaadec',
                    'credential_b64': 'ibbigdigd',
                },
                {
                    # data to create a LiteLLM_MCPUserCredentials record
                    'user_id': 'bdiiiabbii',
                    'server_id': 'hfcfhhadh',
                    'credential_b64': 'bbihggdcji',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_MCPUserCredentialsWhereUniqueInput,
        include: Optional[types.LiteLLM_MCPUserCredentialsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_MCPUserCredentials record.

        Parameters
        ----------
        where
            LiteLLM_MCPUserCredentials filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPUserCredentials model

        Returns
        -------
        prisma.models.LiteLLM_MCPUserCredentials
            The deleted LiteLLM_MCPUserCredentials record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_mcpusercredentials = await LiteLLM_MCPUserCredentials.prisma().delete(
            where={
                'id': 'hgjgibdgd',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_MCPUserCredentialsWhereUniqueInput,
        include: Optional[types.LiteLLM_MCPUserCredentialsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_MCPUserCredentials record.

        Parameters
        ----------
        where
            LiteLLM_MCPUserCredentials filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPUserCredentials model

        Returns
        -------
        prisma.models.LiteLLM_MCPUserCredentials
            The found LiteLLM_MCPUserCredentials record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_mcpusercredentials = await LiteLLM_MCPUserCredentials.prisma().find_unique(
            where={
                'id': 'bcbecjfice',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_MCPUserCredentialsWhereUniqueInput,
        include: Optional[types.LiteLLM_MCPUserCredentialsInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_MCPUserCredentials record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_MCPUserCredentials filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPUserCredentials model

        Returns
        -------
        prisma.models.LiteLLM_MCPUserCredentials
            The found LiteLLM_MCPUserCredentials record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_mcpusercredentials = await LiteLLM_MCPUserCredentials.prisma().find_unique_or_raise(
            where={
                'id': 'bacbebhjjd',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_MCPUserCredentialsWhereInput] = None,
        cursor: Optional[types.LiteLLM_MCPUserCredentialsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_MCPUserCredentialsInclude] = None,
        order: Optional[Union[types.LiteLLM_MCPUserCredentialsOrderByInput, List[types.LiteLLM_MCPUserCredentialsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_MCPUserCredentialsScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_MCPUserCredentials records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_MCPUserCredentials records returned
        skip
            Ignore the first N results
        where
            LiteLLM_MCPUserCredentials filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPUserCredentials model
        order
            Order the returned LiteLLM_MCPUserCredentials records by any field
        distinct
            Filter LiteLLM_MCPUserCredentials records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_MCPUserCredentials]
            The list of all LiteLLM_MCPUserCredentials records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_MCPUserCredentials records
        litellm_mcpusercredentials = await LiteLLM_MCPUserCredentials.prisma().find_many(take=10)

        # find the first 5 LiteLLM_MCPUserCredentials records ordered by the server_id field
        litellm_mcpusercredentials = await LiteLLM_MCPUserCredentials.prisma().find_many(
            take=5,
            order={
                'server_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_MCPUserCredentialsWhereInput] = None,
        cursor: Optional[types.LiteLLM_MCPUserCredentialsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_MCPUserCredentialsInclude] = None,
        order: Optional[Union[types.LiteLLM_MCPUserCredentialsOrderByInput, List[types.LiteLLM_MCPUserCredentialsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_MCPUserCredentialsScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_MCPUserCredentials record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_MCPUserCredentials filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPUserCredentials model
        order
            Order the returned LiteLLM_MCPUserCredentials records by any field
        distinct
            Filter LiteLLM_MCPUserCredentials records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_MCPUserCredentials
            The first LiteLLM_MCPUserCredentials record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_MCPUserCredentials record ordered by the credential_b64 field
        litellm_mcpusercredentials = await LiteLLM_MCPUserCredentials.prisma().find_first(
            skip=1,
            order={
                'credential_b64': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_MCPUserCredentialsWhereInput] = None,
        cursor: Optional[types.LiteLLM_MCPUserCredentialsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_MCPUserCredentialsInclude] = None,
        order: Optional[Union[types.LiteLLM_MCPUserCredentialsOrderByInput, List[types.LiteLLM_MCPUserCredentialsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_MCPUserCredentialsScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_MCPUserCredentials record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_MCPUserCredentials filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPUserCredentials model
        order
            Order the returned LiteLLM_MCPUserCredentials records by any field
        distinct
            Filter LiteLLM_MCPUserCredentials records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_MCPUserCredentials
            The first LiteLLM_MCPUserCredentials record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_MCPUserCredentials record ordered by the created_at field
        litellm_mcpusercredentials = await LiteLLM_MCPUserCredentials.prisma().find_first_or_raise(
            skip=1,
            order={
                'created_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_MCPUserCredentialsUpdateInput,
        where: types.LiteLLM_MCPUserCredentialsWhereUniqueInput,
        include: Optional[types.LiteLLM_MCPUserCredentialsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_MCPUserCredentials record.

        Parameters
        ----------
        data
            LiteLLM_MCPUserCredentials record data specifying what to update
        where
            LiteLLM_MCPUserCredentials filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPUserCredentials model

        Returns
        -------
        prisma.models.LiteLLM_MCPUserCredentials
            The updated LiteLLM_MCPUserCredentials record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_mcpusercredentials = await LiteLLM_MCPUserCredentials.prisma().update(
            where={
                'id': 'dfbfaddhe',
            },
            data={
                # data to update the LiteLLM_MCPUserCredentials record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_MCPUserCredentialsWhereUniqueInput,
        data: types.LiteLLM_MCPUserCredentialsUpsertInput,
        include: Optional[types.LiteLLM_MCPUserCredentialsInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_MCPUserCredentials filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_MCPUserCredentials model

        Returns
        -------
        prisma.models.LiteLLM_MCPUserCredentials
            The created or updated LiteLLM_MCPUserCredentials record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_mcpusercredentials = await LiteLLM_MCPUserCredentials.prisma().upsert(
            where={
                'id': 'bdcbbieibf',
            },
            data={
                'create': {
                    'id': 'bdcbbieibf',
                    'user_id': 'bdiiiabbii',
                    'server_id': 'hfcfhhadh',
                    'credential_b64': 'bbihggdcji',
                },
                'update': {
                    'user_id': 'bdiiiabbii',
                    'server_id': 'hfcfhhadh',
                    'credential_b64': 'bbihggdcji',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_MCPUserCredentialsUpdateManyMutationInput,
        where: types.LiteLLM_MCPUserCredentialsWhereInput,
    ) -> int:
        """Update multiple LiteLLM_MCPUserCredentials records

        Parameters
        ----------
        data
            LiteLLM_MCPUserCredentials data to update the selected LiteLLM_MCPUserCredentials records to
        where
            Filter to select the LiteLLM_MCPUserCredentials records to update

        Returns
        -------
        int
            The total number of LiteLLM_MCPUserCredentials records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_MCPUserCredentials records
        total = await LiteLLM_MCPUserCredentials.prisma().update_many(
            data={
                'updated_at': datetime.datetime.utcnow()
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_MCPUserCredentialsWhereInput] = None,
        cursor: Optional[types.LiteLLM_MCPUserCredentialsWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_MCPUserCredentials records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_MCPUserCredentials fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_MCPUserCredentials filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_MCPUserCredentialsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_MCPUserCredentials.prisma().count()

        # results: prisma.types.LiteLLM_MCPUserCredentialsCountAggregateOutput
        results = await LiteLLM_MCPUserCredentials.prisma().count(
            select={
                '_all': True,
                'id': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_MCPUserCredentialsCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_MCPUserCredentialsWhereInput] = None,
        cursor: Optional[types.LiteLLM_MCPUserCredentialsWhereUniqueInput] = None,
    ) -> types.LiteLLM_MCPUserCredentialsCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_MCPUserCredentialsCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_MCPUserCredentialsWhereInput] = None,
        cursor: Optional[types.LiteLLM_MCPUserCredentialsWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_MCPUserCredentialsCountAggregateOutput]:
        """Count the number of LiteLLM_MCPUserCredentials records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_MCPUserCredentials fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_MCPUserCredentials filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_MCPUserCredentialsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_MCPUserCredentials.prisma().count()

        # results: prisma.types.LiteLLM_MCPUserCredentialsCountAggregateOutput
        results = await LiteLLM_MCPUserCredentials.prisma().count(
            select={
                '_all': True,
                'user_id': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_MCPUserCredentialsCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_MCPUserCredentialsWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_MCPUserCredentials records.

        Parameters
        ----------
        where
            Optional LiteLLM_MCPUserCredentials filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_MCPUserCredentials records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_MCPUserCredentials records
        total = await LiteLLM_MCPUserCredentials.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_MCPUserCredentialsScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_MCPUserCredentialsWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_MCPUserCredentialsAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_MCPUserCredentialsSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_MCPUserCredentialsMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_MCPUserCredentialsMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_MCPUserCredentialsScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_MCPUserCredentialsCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_MCPUserCredentialsScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_MCPUserCredentialsScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_MCPUserCredentialsGroupByOutput']:
        """Group LiteLLM_MCPUserCredentials records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_MCPUserCredentials fields to group records by
        where
            LiteLLM_MCPUserCredentials filter to select records
        take
            Limit the maximum number of LiteLLM_MCPUserCredentials records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_MCPUserCredentialsGroupByOutput]
            A list of dictionaries representing the LiteLLM_MCPUserCredentials record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_MCPUserCredentials records by server_id values
        # and count how many records are in each group
        results = await LiteLLM_MCPUserCredentials.prisma().group_by(
            ['server_id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_VerificationTokenActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_VerificationToken]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_VerificationToken.prisma().query_raw(
            'SELECT * FROM LiteLLM_VerificationToken WHERE token = $1',
            'dgjhdcggi',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_VerificationToken
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_VerificationToken.prisma().query_first(
            'SELECT * FROM LiteLLM_VerificationToken WHERE key_name = $1',
            'bbjbcdfabd',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_VerificationTokenCreateInput,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_VerificationToken record.

        Parameters
        ----------
        data
            LiteLLM_VerificationToken record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_VerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_VerificationToken
            The created LiteLLM_VerificationToken record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_VerificationToken record from just the required fields
        litellm_verificationtoken = await LiteLLM_VerificationToken.prisma().create(
            data={
                # data to create a LiteLLM_VerificationToken record
                'token': 'gchfgbcec',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_VerificationTokenCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_VerificationToken records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_VerificationToken record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_VerificationToken.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_VerificationToken record
                    'token': 'bihcjfcjah',
                },
                {
                    # data to create a LiteLLM_VerificationToken record
                    'token': 'bhjdcicaii',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_VerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_VerificationToken record.

        Parameters
        ----------
        where
            LiteLLM_VerificationToken filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_VerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_VerificationToken
            The deleted LiteLLM_VerificationToken record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_verificationtoken = await LiteLLM_VerificationToken.prisma().delete(
            where={
                'token': 'bibedjhcej',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_VerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_VerificationToken record.

        Parameters
        ----------
        where
            LiteLLM_VerificationToken filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_VerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_VerificationToken
            The found LiteLLM_VerificationToken record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_verificationtoken = await LiteLLM_VerificationToken.prisma().find_unique(
            where={
                'token': 'bjcdajabfa',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_VerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_VerificationToken record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_VerificationToken filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_VerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_VerificationToken
            The found LiteLLM_VerificationToken record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_verificationtoken = await LiteLLM_VerificationToken.prisma().find_unique_or_raise(
            where={
                'token': 'bchhceeeff',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_VerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_VerificationTokenWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None,
        order: Optional[Union[types.LiteLLM_VerificationTokenOrderByInput, List[types.LiteLLM_VerificationTokenOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_VerificationTokenScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_VerificationToken records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_VerificationToken records returned
        skip
            Ignore the first N results
        where
            LiteLLM_VerificationToken filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_VerificationToken model
        order
            Order the returned LiteLLM_VerificationToken records by any field
        distinct
            Filter LiteLLM_VerificationToken records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_VerificationToken]
            The list of all LiteLLM_VerificationToken records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_VerificationToken records
        litellm_verificationtokens = await LiteLLM_VerificationToken.prisma().find_many(take=10)

        # find the first 5 LiteLLM_VerificationToken records ordered by the key_alias field
        litellm_verificationtokens = await LiteLLM_VerificationToken.prisma().find_many(
            take=5,
            order={
                'key_alias': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_VerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_VerificationTokenWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None,
        order: Optional[Union[types.LiteLLM_VerificationTokenOrderByInput, List[types.LiteLLM_VerificationTokenOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_VerificationTokenScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_VerificationToken record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_VerificationToken filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_VerificationToken model
        order
            Order the returned LiteLLM_VerificationToken records by any field
        distinct
            Filter LiteLLM_VerificationToken records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_VerificationToken
            The first LiteLLM_VerificationToken record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_VerificationToken record ordered by the soft_budget_cooldown field
        litellm_verificationtoken = await LiteLLM_VerificationToken.prisma().find_first(
            skip=1,
            order={
                'soft_budget_cooldown': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_VerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_VerificationTokenWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None,
        order: Optional[Union[types.LiteLLM_VerificationTokenOrderByInput, List[types.LiteLLM_VerificationTokenOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_VerificationTokenScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_VerificationToken record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_VerificationToken filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_VerificationToken model
        order
            Order the returned LiteLLM_VerificationToken records by any field
        distinct
            Filter LiteLLM_VerificationToken records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_VerificationToken
            The first LiteLLM_VerificationToken record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_VerificationToken record ordered by the spend field
        litellm_verificationtoken = await LiteLLM_VerificationToken.prisma().find_first_or_raise(
            skip=1,
            order={
                'spend': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_VerificationTokenUpdateInput,
        where: types.LiteLLM_VerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_VerificationToken record.

        Parameters
        ----------
        data
            LiteLLM_VerificationToken record data specifying what to update
        where
            LiteLLM_VerificationToken filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_VerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_VerificationToken
            The updated LiteLLM_VerificationToken record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_verificationtoken = await LiteLLM_VerificationToken.prisma().update(
            where={
                'token': 'bbgaifhdaa',
            },
            data={
                # data to update the LiteLLM_VerificationToken record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_VerificationTokenWhereUniqueInput,
        data: types.LiteLLM_VerificationTokenUpsertInput,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_VerificationToken filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_VerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_VerificationToken
            The created or updated LiteLLM_VerificationToken record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_verificationtoken = await LiteLLM_VerificationToken.prisma().upsert(
            where={
                'token': 'dgbcdaegb',
            },
            data={
                'create': {
                    'token': 'dgbcdaegb',
                },
                'update': {
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_VerificationTokenUpdateManyMutationInput,
        where: types.LiteLLM_VerificationTokenWhereInput,
    ) -> int:
        """Update multiple LiteLLM_VerificationToken records

        Parameters
        ----------
        data
            LiteLLM_VerificationToken data to update the selected LiteLLM_VerificationToken records to
        where
            Filter to select the LiteLLM_VerificationToken records to update

        Returns
        -------
        int
            The total number of LiteLLM_VerificationToken records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_VerificationToken records
        total = await LiteLLM_VerificationToken.prisma().update_many(
            data={
                'expires': datetime.datetime.utcnow()
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_VerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_VerificationTokenWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_VerificationToken records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_VerificationToken fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_VerificationToken filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_VerificationTokenCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_VerificationToken.prisma().count()

        # results: prisma.types.LiteLLM_VerificationTokenCountAggregateOutput
        results = await LiteLLM_VerificationToken.prisma().count(
            select={
                '_all': True,
                'models': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_VerificationTokenCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_VerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_VerificationTokenWhereUniqueInput] = None,
    ) -> types.LiteLLM_VerificationTokenCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_VerificationTokenCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_VerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_VerificationTokenWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_VerificationTokenCountAggregateOutput]:
        """Count the number of LiteLLM_VerificationToken records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_VerificationToken fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_VerificationToken filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_VerificationTokenCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_VerificationToken.prisma().count()

        # results: prisma.types.LiteLLM_VerificationTokenCountAggregateOutput
        results = await LiteLLM_VerificationToken.prisma().count(
            select={
                '_all': True,
                'aliases': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_VerificationTokenCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_VerificationTokenWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_VerificationToken records.

        Parameters
        ----------
        where
            Optional LiteLLM_VerificationToken filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_VerificationToken records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_VerificationToken records
        total = await LiteLLM_VerificationToken.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_VerificationTokenScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_VerificationTokenWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_VerificationTokenAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_VerificationTokenSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_VerificationTokenMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_VerificationTokenMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_VerificationTokenScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_VerificationTokenCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_VerificationTokenScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_VerificationTokenScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_VerificationTokenGroupByOutput']:
        """Group LiteLLM_VerificationToken records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_VerificationToken fields to group records by
        where
            LiteLLM_VerificationToken filter to select records
        take
            Limit the maximum number of LiteLLM_VerificationToken records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_VerificationTokenGroupByOutput]
            A list of dictionaries representing the LiteLLM_VerificationToken record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_VerificationToken records by config values
        # and count how many records are in each group
        results = await LiteLLM_VerificationToken.prisma().group_by(
            ['config'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_JWTKeyMappingActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_JWTKeyMapping]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_JWTKeyMapping.prisma().query_raw(
            'SELECT * FROM LiteLLM_JWTKeyMapping WHERE id = $1',
            'beagfbbjig',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_JWTKeyMapping
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_JWTKeyMapping.prisma().query_first(
            'SELECT * FROM LiteLLM_JWTKeyMapping WHERE jwt_claim_name = $1',
            'beicihhijb',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_JWTKeyMappingCreateInput,
        include: Optional[types.LiteLLM_JWTKeyMappingInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_JWTKeyMapping record.

        Parameters
        ----------
        data
            LiteLLM_JWTKeyMapping record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_JWTKeyMapping model

        Returns
        -------
        prisma.models.LiteLLM_JWTKeyMapping
            The created LiteLLM_JWTKeyMapping record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_JWTKeyMapping record from just the required fields
        litellm_jwtkeymapping = await LiteLLM_JWTKeyMapping.prisma().create(
            data={
                # data to create a LiteLLM_JWTKeyMapping record
                'jwt_claim_name': 'fgggcdcjg',
                'jwt_claim_value': 'ccjbbjigf',
                'token': 'bhfaabbaha',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_JWTKeyMappingCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_JWTKeyMapping records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_JWTKeyMapping record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_JWTKeyMapping.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_JWTKeyMapping record
                    'jwt_claim_name': 'ebajedhhf',
                    'jwt_claim_value': 'jajacedge',
                    'token': 'hffgbabgf',
                },
                {
                    # data to create a LiteLLM_JWTKeyMapping record
                    'jwt_claim_name': 'biacbiieja',
                    'jwt_claim_value': 'cjejbgbff',
                    'token': 'fgeahddae',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_JWTKeyMappingWhereUniqueInput,
        include: Optional[types.LiteLLM_JWTKeyMappingInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_JWTKeyMapping record.

        Parameters
        ----------
        where
            LiteLLM_JWTKeyMapping filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_JWTKeyMapping model

        Returns
        -------
        prisma.models.LiteLLM_JWTKeyMapping
            The deleted LiteLLM_JWTKeyMapping record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_jwtkeymapping = await LiteLLM_JWTKeyMapping.prisma().delete(
            where={
                'id': 'diageigcf',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_JWTKeyMappingWhereUniqueInput,
        include: Optional[types.LiteLLM_JWTKeyMappingInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_JWTKeyMapping record.

        Parameters
        ----------
        where
            LiteLLM_JWTKeyMapping filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_JWTKeyMapping model

        Returns
        -------
        prisma.models.LiteLLM_JWTKeyMapping
            The found LiteLLM_JWTKeyMapping record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_jwtkeymapping = await LiteLLM_JWTKeyMapping.prisma().find_unique(
            where={
                'id': 'badagbgeha',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_JWTKeyMappingWhereUniqueInput,
        include: Optional[types.LiteLLM_JWTKeyMappingInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_JWTKeyMapping record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_JWTKeyMapping filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_JWTKeyMapping model

        Returns
        -------
        prisma.models.LiteLLM_JWTKeyMapping
            The found LiteLLM_JWTKeyMapping record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_jwtkeymapping = await LiteLLM_JWTKeyMapping.prisma().find_unique_or_raise(
            where={
                'id': 'ibgebbjch',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_JWTKeyMappingWhereInput] = None,
        cursor: Optional[types.LiteLLM_JWTKeyMappingWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_JWTKeyMappingInclude] = None,
        order: Optional[Union[types.LiteLLM_JWTKeyMappingOrderByInput, List[types.LiteLLM_JWTKeyMappingOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_JWTKeyMappingScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_JWTKeyMapping records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_JWTKeyMapping records returned
        skip
            Ignore the first N results
        where
            LiteLLM_JWTKeyMapping filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_JWTKeyMapping model
        order
            Order the returned LiteLLM_JWTKeyMapping records by any field
        distinct
            Filter LiteLLM_JWTKeyMapping records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_JWTKeyMapping]
            The list of all LiteLLM_JWTKeyMapping records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_JWTKeyMapping records
        litellm_jwtkeymappings = await LiteLLM_JWTKeyMapping.prisma().find_many(take=10)

        # find the first 5 LiteLLM_JWTKeyMapping records ordered by the jwt_claim_value field
        litellm_jwtkeymappings = await LiteLLM_JWTKeyMapping.prisma().find_many(
            take=5,
            order={
                'jwt_claim_value': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_JWTKeyMappingWhereInput] = None,
        cursor: Optional[types.LiteLLM_JWTKeyMappingWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_JWTKeyMappingInclude] = None,
        order: Optional[Union[types.LiteLLM_JWTKeyMappingOrderByInput, List[types.LiteLLM_JWTKeyMappingOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_JWTKeyMappingScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_JWTKeyMapping record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_JWTKeyMapping filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_JWTKeyMapping model
        order
            Order the returned LiteLLM_JWTKeyMapping records by any field
        distinct
            Filter LiteLLM_JWTKeyMapping records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_JWTKeyMapping
            The first LiteLLM_JWTKeyMapping record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_JWTKeyMapping record ordered by the token field
        litellm_jwtkeymapping = await LiteLLM_JWTKeyMapping.prisma().find_first(
            skip=1,
            order={
                'token': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_JWTKeyMappingWhereInput] = None,
        cursor: Optional[types.LiteLLM_JWTKeyMappingWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_JWTKeyMappingInclude] = None,
        order: Optional[Union[types.LiteLLM_JWTKeyMappingOrderByInput, List[types.LiteLLM_JWTKeyMappingOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_JWTKeyMappingScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_JWTKeyMapping record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_JWTKeyMapping filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_JWTKeyMapping model
        order
            Order the returned LiteLLM_JWTKeyMapping records by any field
        distinct
            Filter LiteLLM_JWTKeyMapping records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_JWTKeyMapping
            The first LiteLLM_JWTKeyMapping record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_JWTKeyMapping record ordered by the description field
        litellm_jwtkeymapping = await LiteLLM_JWTKeyMapping.prisma().find_first_or_raise(
            skip=1,
            order={
                'description': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_JWTKeyMappingUpdateInput,
        where: types.LiteLLM_JWTKeyMappingWhereUniqueInput,
        include: Optional[types.LiteLLM_JWTKeyMappingInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_JWTKeyMapping record.

        Parameters
        ----------
        data
            LiteLLM_JWTKeyMapping record data specifying what to update
        where
            LiteLLM_JWTKeyMapping filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_JWTKeyMapping model

        Returns
        -------
        prisma.models.LiteLLM_JWTKeyMapping
            The updated LiteLLM_JWTKeyMapping record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_jwtkeymapping = await LiteLLM_JWTKeyMapping.prisma().update(
            where={
                'id': 'baieajjiee',
            },
            data={
                # data to update the LiteLLM_JWTKeyMapping record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_JWTKeyMappingWhereUniqueInput,
        data: types.LiteLLM_JWTKeyMappingUpsertInput,
        include: Optional[types.LiteLLM_JWTKeyMappingInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_JWTKeyMapping filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_JWTKeyMapping model

        Returns
        -------
        prisma.models.LiteLLM_JWTKeyMapping
            The created or updated LiteLLM_JWTKeyMapping record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_jwtkeymapping = await LiteLLM_JWTKeyMapping.prisma().upsert(
            where={
                'id': 'bahjhaccfd',
            },
            data={
                'create': {
                    'id': 'bahjhaccfd',
                    'jwt_claim_name': 'biacbiieja',
                    'jwt_claim_value': 'cjejbgbff',
                    'token': 'fgeahddae',
                },
                'update': {
                    'jwt_claim_name': 'biacbiieja',
                    'jwt_claim_value': 'cjejbgbff',
                    'token': 'fgeahddae',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_JWTKeyMappingUpdateManyMutationInput,
        where: types.LiteLLM_JWTKeyMappingWhereInput,
    ) -> int:
        """Update multiple LiteLLM_JWTKeyMapping records

        Parameters
        ----------
        data
            LiteLLM_JWTKeyMapping data to update the selected LiteLLM_JWTKeyMapping records to
        where
            Filter to select the LiteLLM_JWTKeyMapping records to update

        Returns
        -------
        int
            The total number of LiteLLM_JWTKeyMapping records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_JWTKeyMapping records
        total = await LiteLLM_JWTKeyMapping.prisma().update_many(
            data={
                'is_active': True
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_JWTKeyMappingWhereInput] = None,
        cursor: Optional[types.LiteLLM_JWTKeyMappingWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_JWTKeyMapping records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_JWTKeyMapping fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_JWTKeyMapping filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_JWTKeyMappingCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_JWTKeyMapping.prisma().count()

        # results: prisma.types.LiteLLM_JWTKeyMappingCountAggregateOutput
        results = await LiteLLM_JWTKeyMapping.prisma().count(
            select={
                '_all': True,
                'created_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_JWTKeyMappingCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_JWTKeyMappingWhereInput] = None,
        cursor: Optional[types.LiteLLM_JWTKeyMappingWhereUniqueInput] = None,
    ) -> types.LiteLLM_JWTKeyMappingCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_JWTKeyMappingCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_JWTKeyMappingWhereInput] = None,
        cursor: Optional[types.LiteLLM_JWTKeyMappingWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_JWTKeyMappingCountAggregateOutput]:
        """Count the number of LiteLLM_JWTKeyMapping records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_JWTKeyMapping fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_JWTKeyMapping filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_JWTKeyMappingCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_JWTKeyMapping.prisma().count()

        # results: prisma.types.LiteLLM_JWTKeyMappingCountAggregateOutput
        results = await LiteLLM_JWTKeyMapping.prisma().count(
            select={
                '_all': True,
                'created_by': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_JWTKeyMappingCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_JWTKeyMappingWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_JWTKeyMapping records.

        Parameters
        ----------
        where
            Optional LiteLLM_JWTKeyMapping filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_JWTKeyMapping records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_JWTKeyMapping records
        total = await LiteLLM_JWTKeyMapping.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_JWTKeyMappingScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_JWTKeyMappingWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_JWTKeyMappingAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_JWTKeyMappingSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_JWTKeyMappingMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_JWTKeyMappingMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_JWTKeyMappingScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_JWTKeyMappingCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_JWTKeyMappingScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_JWTKeyMappingScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_JWTKeyMappingGroupByOutput']:
        """Group LiteLLM_JWTKeyMapping records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_JWTKeyMapping fields to group records by
        where
            LiteLLM_JWTKeyMapping filter to select records
        take
            Limit the maximum number of LiteLLM_JWTKeyMapping records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_JWTKeyMappingGroupByOutput]
            A list of dictionaries representing the LiteLLM_JWTKeyMapping record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_JWTKeyMapping records by updated_at values
        # and count how many records are in each group
        results = await LiteLLM_JWTKeyMapping.prisma().group_by(
            ['updated_at'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_DeprecatedVerificationTokenActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_DeprecatedVerificationToken]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_DeprecatedVerificationToken.prisma().query_raw(
            'SELECT * FROM LiteLLM_DeprecatedVerificationToken WHERE id = $1',
            'bbcigiadhb',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_DeprecatedVerificationToken
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_DeprecatedVerificationToken.prisma().query_first(
            'SELECT * FROM LiteLLM_DeprecatedVerificationToken WHERE token = $1',
            'cfjagbbae',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_DeprecatedVerificationTokenCreateInput,
        include: Optional[types.LiteLLM_DeprecatedVerificationTokenInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_DeprecatedVerificationToken record.

        Parameters
        ----------
        data
            LiteLLM_DeprecatedVerificationToken record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeprecatedVerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_DeprecatedVerificationToken
            The created LiteLLM_DeprecatedVerificationToken record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_DeprecatedVerificationToken record from just the required fields
        litellm_deprecatedverificationtoken = await LiteLLM_DeprecatedVerificationToken.prisma().create(
            data={
                # data to create a LiteLLM_DeprecatedVerificationToken record
                'token': 'bbbfhdidef',
                'active_token_id': 'bdadhibhec',
                'revoke_at': datetime.datetime.utcnow(),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_DeprecatedVerificationTokenCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_DeprecatedVerificationToken records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_DeprecatedVerificationToken record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_DeprecatedVerificationToken.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_DeprecatedVerificationToken record
                    'token': 'bfhdjaiejf',
                    'active_token_id': 'bbjfijjadg',
                    'revoke_at': datetime.datetime.utcnow(),
                },
                {
                    # data to create a LiteLLM_DeprecatedVerificationToken record
                    'token': 'hdjacbehh',
                    'active_token_id': 'bhcccbeaba',
                    'revoke_at': datetime.datetime.utcnow(),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_DeprecatedVerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_DeprecatedVerificationTokenInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_DeprecatedVerificationToken record.

        Parameters
        ----------
        where
            LiteLLM_DeprecatedVerificationToken filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeprecatedVerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_DeprecatedVerificationToken
            The deleted LiteLLM_DeprecatedVerificationToken record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_deprecatedverificationtoken = await LiteLLM_DeprecatedVerificationToken.prisma().delete(
            where={
                'id': 'bcgjbdgjdj',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_DeprecatedVerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_DeprecatedVerificationTokenInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_DeprecatedVerificationToken record.

        Parameters
        ----------
        where
            LiteLLM_DeprecatedVerificationToken filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeprecatedVerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_DeprecatedVerificationToken
            The found LiteLLM_DeprecatedVerificationToken record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_deprecatedverificationtoken = await LiteLLM_DeprecatedVerificationToken.prisma().find_unique(
            where={
                'id': 'fhdbhifae',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_DeprecatedVerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_DeprecatedVerificationTokenInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_DeprecatedVerificationToken record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_DeprecatedVerificationToken filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeprecatedVerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_DeprecatedVerificationToken
            The found LiteLLM_DeprecatedVerificationToken record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_deprecatedverificationtoken = await LiteLLM_DeprecatedVerificationToken.prisma().find_unique_or_raise(
            where={
                'id': 'beeacgfcej',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DeprecatedVerificationTokenInclude] = None,
        order: Optional[Union[types.LiteLLM_DeprecatedVerificationTokenOrderByInput, List[types.LiteLLM_DeprecatedVerificationTokenOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DeprecatedVerificationTokenScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_DeprecatedVerificationToken records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_DeprecatedVerificationToken records returned
        skip
            Ignore the first N results
        where
            LiteLLM_DeprecatedVerificationToken filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeprecatedVerificationToken model
        order
            Order the returned LiteLLM_DeprecatedVerificationToken records by any field
        distinct
            Filter LiteLLM_DeprecatedVerificationToken records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_DeprecatedVerificationToken]
            The list of all LiteLLM_DeprecatedVerificationToken records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_DeprecatedVerificationToken records
        litellm_deprecatedverificationtokens = await LiteLLM_DeprecatedVerificationToken.prisma().find_many(take=10)

        # find the first 5 LiteLLM_DeprecatedVerificationToken records ordered by the active_token_id field
        litellm_deprecatedverificationtokens = await LiteLLM_DeprecatedVerificationToken.prisma().find_many(
            take=5,
            order={
                'active_token_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DeprecatedVerificationTokenInclude] = None,
        order: Optional[Union[types.LiteLLM_DeprecatedVerificationTokenOrderByInput, List[types.LiteLLM_DeprecatedVerificationTokenOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DeprecatedVerificationTokenScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_DeprecatedVerificationToken record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DeprecatedVerificationToken filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeprecatedVerificationToken model
        order
            Order the returned LiteLLM_DeprecatedVerificationToken records by any field
        distinct
            Filter LiteLLM_DeprecatedVerificationToken records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DeprecatedVerificationToken
            The first LiteLLM_DeprecatedVerificationToken record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DeprecatedVerificationToken record ordered by the revoke_at field
        litellm_deprecatedverificationtoken = await LiteLLM_DeprecatedVerificationToken.prisma().find_first(
            skip=1,
            order={
                'revoke_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DeprecatedVerificationTokenInclude] = None,
        order: Optional[Union[types.LiteLLM_DeprecatedVerificationTokenOrderByInput, List[types.LiteLLM_DeprecatedVerificationTokenOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DeprecatedVerificationTokenScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_DeprecatedVerificationToken record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DeprecatedVerificationToken filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeprecatedVerificationToken model
        order
            Order the returned LiteLLM_DeprecatedVerificationToken records by any field
        distinct
            Filter LiteLLM_DeprecatedVerificationToken records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DeprecatedVerificationToken
            The first LiteLLM_DeprecatedVerificationToken record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DeprecatedVerificationToken record ordered by the created_at field
        litellm_deprecatedverificationtoken = await LiteLLM_DeprecatedVerificationToken.prisma().find_first_or_raise(
            skip=1,
            order={
                'created_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_DeprecatedVerificationTokenUpdateInput,
        where: types.LiteLLM_DeprecatedVerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_DeprecatedVerificationTokenInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_DeprecatedVerificationToken record.

        Parameters
        ----------
        data
            LiteLLM_DeprecatedVerificationToken record data specifying what to update
        where
            LiteLLM_DeprecatedVerificationToken filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeprecatedVerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_DeprecatedVerificationToken
            The updated LiteLLM_DeprecatedVerificationToken record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_deprecatedverificationtoken = await LiteLLM_DeprecatedVerificationToken.prisma().update(
            where={
                'id': 'bbifhdiicc',
            },
            data={
                # data to update the LiteLLM_DeprecatedVerificationToken record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_DeprecatedVerificationTokenWhereUniqueInput,
        data: types.LiteLLM_DeprecatedVerificationTokenUpsertInput,
        include: Optional[types.LiteLLM_DeprecatedVerificationTokenInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_DeprecatedVerificationToken filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeprecatedVerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_DeprecatedVerificationToken
            The created or updated LiteLLM_DeprecatedVerificationToken record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_deprecatedverificationtoken = await LiteLLM_DeprecatedVerificationToken.prisma().upsert(
            where={
                'id': 'bgjeccejad',
            },
            data={
                'create': {
                    'id': 'bgjeccejad',
                    'token': 'hdjacbehh',
                    'active_token_id': 'bhcccbeaba',
                    'revoke_at': datetime.datetime.utcnow(),
                },
                'update': {
                    'token': 'hdjacbehh',
                    'active_token_id': 'bhcccbeaba',
                    'revoke_at': datetime.datetime.utcnow(),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_DeprecatedVerificationTokenUpdateManyMutationInput,
        where: types.LiteLLM_DeprecatedVerificationTokenWhereInput,
    ) -> int:
        """Update multiple LiteLLM_DeprecatedVerificationToken records

        Parameters
        ----------
        data
            LiteLLM_DeprecatedVerificationToken data to update the selected LiteLLM_DeprecatedVerificationToken records to
        where
            Filter to select the LiteLLM_DeprecatedVerificationToken records to update

        Returns
        -------
        int
            The total number of LiteLLM_DeprecatedVerificationToken records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_DeprecatedVerificationToken records
        total = await LiteLLM_DeprecatedVerificationToken.prisma().update_many(
            data={
                'id': 'bjagdgabbg'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_DeprecatedVerificationToken records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DeprecatedVerificationToken fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DeprecatedVerificationToken filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DeprecatedVerificationTokenCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DeprecatedVerificationToken.prisma().count()

        # results: prisma.types.LiteLLM_DeprecatedVerificationTokenCountAggregateOutput
        results = await LiteLLM_DeprecatedVerificationToken.prisma().count(
            select={
                '_all': True,
                'token': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_DeprecatedVerificationTokenCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereUniqueInput] = None,
    ) -> types.LiteLLM_DeprecatedVerificationTokenCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_DeprecatedVerificationTokenCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_DeprecatedVerificationTokenCountAggregateOutput]:
        """Count the number of LiteLLM_DeprecatedVerificationToken records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DeprecatedVerificationToken fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DeprecatedVerificationToken filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DeprecatedVerificationTokenCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DeprecatedVerificationToken.prisma().count()

        # results: prisma.types.LiteLLM_DeprecatedVerificationTokenCountAggregateOutput
        results = await LiteLLM_DeprecatedVerificationToken.prisma().count(
            select={
                '_all': True,
                'active_token_id': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_DeprecatedVerificationTokenCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_DeprecatedVerificationTokenWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_DeprecatedVerificationToken records.

        Parameters
        ----------
        where
            Optional LiteLLM_DeprecatedVerificationToken filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_DeprecatedVerificationToken records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_DeprecatedVerificationToken records
        total = await LiteLLM_DeprecatedVerificationToken.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_DeprecatedVerificationTokenScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_DeprecatedVerificationTokenWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_DeprecatedVerificationTokenAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_DeprecatedVerificationTokenSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_DeprecatedVerificationTokenMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_DeprecatedVerificationTokenMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_DeprecatedVerificationTokenScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_DeprecatedVerificationTokenCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_DeprecatedVerificationTokenScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_DeprecatedVerificationTokenScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_DeprecatedVerificationTokenGroupByOutput']:
        """Group LiteLLM_DeprecatedVerificationToken records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_DeprecatedVerificationToken fields to group records by
        where
            LiteLLM_DeprecatedVerificationToken filter to select records
        take
            Limit the maximum number of LiteLLM_DeprecatedVerificationToken records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_DeprecatedVerificationTokenGroupByOutput]
            A list of dictionaries representing the LiteLLM_DeprecatedVerificationToken record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_DeprecatedVerificationToken records by revoke_at values
        # and count how many records are in each group
        results = await LiteLLM_DeprecatedVerificationToken.prisma().group_by(
            ['revoke_at'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_DeletedVerificationTokenActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_DeletedVerificationToken]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_DeletedVerificationToken.prisma().query_raw(
            'SELECT * FROM LiteLLM_DeletedVerificationToken WHERE id = $1',
            'bjbbcffdij',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_DeletedVerificationToken
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_DeletedVerificationToken.prisma().query_first(
            'SELECT * FROM LiteLLM_DeletedVerificationToken WHERE token = $1',
            'begcgchdi',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_DeletedVerificationTokenCreateInput,
        include: Optional[types.LiteLLM_DeletedVerificationTokenInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_DeletedVerificationToken record.

        Parameters
        ----------
        data
            LiteLLM_DeletedVerificationToken record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedVerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_DeletedVerificationToken
            The created LiteLLM_DeletedVerificationToken record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_DeletedVerificationToken record from just the required fields
        litellm_deletedverificationtoken = await LiteLLM_DeletedVerificationToken.prisma().create(
            data={
                # data to create a LiteLLM_DeletedVerificationToken record
                'token': 'bhbjceagbb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_DeletedVerificationTokenCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_DeletedVerificationToken records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_DeletedVerificationToken record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_DeletedVerificationToken.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_DeletedVerificationToken record
                    'token': 'bjeifffjdg',
                },
                {
                    # data to create a LiteLLM_DeletedVerificationToken record
                    'token': 'bdidcfdfjd',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_DeletedVerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_DeletedVerificationTokenInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_DeletedVerificationToken record.

        Parameters
        ----------
        where
            LiteLLM_DeletedVerificationToken filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedVerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_DeletedVerificationToken
            The deleted LiteLLM_DeletedVerificationToken record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_deletedverificationtoken = await LiteLLM_DeletedVerificationToken.prisma().delete(
            where={
                'id': 'dfeggejja',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_DeletedVerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_DeletedVerificationTokenInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_DeletedVerificationToken record.

        Parameters
        ----------
        where
            LiteLLM_DeletedVerificationToken filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedVerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_DeletedVerificationToken
            The found LiteLLM_DeletedVerificationToken record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_deletedverificationtoken = await LiteLLM_DeletedVerificationToken.prisma().find_unique(
            where={
                'id': 'gehbgghbj',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_DeletedVerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_DeletedVerificationTokenInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_DeletedVerificationToken record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_DeletedVerificationToken filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedVerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_DeletedVerificationToken
            The found LiteLLM_DeletedVerificationToken record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_deletedverificationtoken = await LiteLLM_DeletedVerificationToken.prisma().find_unique_or_raise(
            where={
                'id': 'dfhaijeie',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeletedVerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeletedVerificationTokenWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DeletedVerificationTokenInclude] = None,
        order: Optional[Union[types.LiteLLM_DeletedVerificationTokenOrderByInput, List[types.LiteLLM_DeletedVerificationTokenOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DeletedVerificationTokenScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_DeletedVerificationToken records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_DeletedVerificationToken records returned
        skip
            Ignore the first N results
        where
            LiteLLM_DeletedVerificationToken filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedVerificationToken model
        order
            Order the returned LiteLLM_DeletedVerificationToken records by any field
        distinct
            Filter LiteLLM_DeletedVerificationToken records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_DeletedVerificationToken]
            The list of all LiteLLM_DeletedVerificationToken records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_DeletedVerificationToken records
        litellm_deletedverificationtokens = await LiteLLM_DeletedVerificationToken.prisma().find_many(take=10)

        # find the first 5 LiteLLM_DeletedVerificationToken records ordered by the key_name field
        litellm_deletedverificationtokens = await LiteLLM_DeletedVerificationToken.prisma().find_many(
            take=5,
            order={
                'key_name': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeletedVerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeletedVerificationTokenWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DeletedVerificationTokenInclude] = None,
        order: Optional[Union[types.LiteLLM_DeletedVerificationTokenOrderByInput, List[types.LiteLLM_DeletedVerificationTokenOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DeletedVerificationTokenScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_DeletedVerificationToken record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DeletedVerificationToken filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedVerificationToken model
        order
            Order the returned LiteLLM_DeletedVerificationToken records by any field
        distinct
            Filter LiteLLM_DeletedVerificationToken records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DeletedVerificationToken
            The first LiteLLM_DeletedVerificationToken record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DeletedVerificationToken record ordered by the key_alias field
        litellm_deletedverificationtoken = await LiteLLM_DeletedVerificationToken.prisma().find_first(
            skip=1,
            order={
                'key_alias': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeletedVerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeletedVerificationTokenWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DeletedVerificationTokenInclude] = None,
        order: Optional[Union[types.LiteLLM_DeletedVerificationTokenOrderByInput, List[types.LiteLLM_DeletedVerificationTokenOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DeletedVerificationTokenScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_DeletedVerificationToken record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DeletedVerificationToken filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedVerificationToken model
        order
            Order the returned LiteLLM_DeletedVerificationToken records by any field
        distinct
            Filter LiteLLM_DeletedVerificationToken records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DeletedVerificationToken
            The first LiteLLM_DeletedVerificationToken record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DeletedVerificationToken record ordered by the soft_budget_cooldown field
        litellm_deletedverificationtoken = await LiteLLM_DeletedVerificationToken.prisma().find_first_or_raise(
            skip=1,
            order={
                'soft_budget_cooldown': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_DeletedVerificationTokenUpdateInput,
        where: types.LiteLLM_DeletedVerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_DeletedVerificationTokenInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_DeletedVerificationToken record.

        Parameters
        ----------
        data
            LiteLLM_DeletedVerificationToken record data specifying what to update
        where
            LiteLLM_DeletedVerificationToken filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedVerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_DeletedVerificationToken
            The updated LiteLLM_DeletedVerificationToken record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_deletedverificationtoken = await LiteLLM_DeletedVerificationToken.prisma().update(
            where={
                'id': 'gbcdjgicb',
            },
            data={
                # data to update the LiteLLM_DeletedVerificationToken record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_DeletedVerificationTokenWhereUniqueInput,
        data: types.LiteLLM_DeletedVerificationTokenUpsertInput,
        include: Optional[types.LiteLLM_DeletedVerificationTokenInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_DeletedVerificationToken filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DeletedVerificationToken model

        Returns
        -------
        prisma.models.LiteLLM_DeletedVerificationToken
            The created or updated LiteLLM_DeletedVerificationToken record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_deletedverificationtoken = await LiteLLM_DeletedVerificationToken.prisma().upsert(
            where={
                'id': 'biaibdagac',
            },
            data={
                'create': {
                    'id': 'biaibdagac',
                    'token': 'bdidcfdfjd',
                },
                'update': {
                    'token': 'bdidcfdfjd',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_DeletedVerificationTokenUpdateManyMutationInput,
        where: types.LiteLLM_DeletedVerificationTokenWhereInput,
    ) -> int:
        """Update multiple LiteLLM_DeletedVerificationToken records

        Parameters
        ----------
        data
            LiteLLM_DeletedVerificationToken data to update the selected LiteLLM_DeletedVerificationToken records to
        where
            Filter to select the LiteLLM_DeletedVerificationToken records to update

        Returns
        -------
        int
            The total number of LiteLLM_DeletedVerificationToken records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_DeletedVerificationToken records
        total = await LiteLLM_DeletedVerificationToken.prisma().update_many(
            data={
                'spend': 1151748123.7806
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeletedVerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeletedVerificationTokenWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_DeletedVerificationToken records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DeletedVerificationToken fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DeletedVerificationToken filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DeletedVerificationTokenCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DeletedVerificationToken.prisma().count()

        # results: prisma.types.LiteLLM_DeletedVerificationTokenCountAggregateOutput
        results = await LiteLLM_DeletedVerificationToken.prisma().count(
            select={
                '_all': True,
                'expires': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_DeletedVerificationTokenCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeletedVerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeletedVerificationTokenWhereUniqueInput] = None,
    ) -> types.LiteLLM_DeletedVerificationTokenCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_DeletedVerificationTokenCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DeletedVerificationTokenWhereInput] = None,
        cursor: Optional[types.LiteLLM_DeletedVerificationTokenWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_DeletedVerificationTokenCountAggregateOutput]:
        """Count the number of LiteLLM_DeletedVerificationToken records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DeletedVerificationToken fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DeletedVerificationToken filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DeletedVerificationTokenCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DeletedVerificationToken.prisma().count()

        # results: prisma.types.LiteLLM_DeletedVerificationTokenCountAggregateOutput
        results = await LiteLLM_DeletedVerificationToken.prisma().count(
            select={
                '_all': True,
                'models': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_DeletedVerificationTokenCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_DeletedVerificationTokenWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_DeletedVerificationToken records.

        Parameters
        ----------
        where
            Optional LiteLLM_DeletedVerificationToken filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_DeletedVerificationToken records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_DeletedVerificationToken records
        total = await LiteLLM_DeletedVerificationToken.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_DeletedVerificationTokenScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_DeletedVerificationTokenWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_DeletedVerificationTokenAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_DeletedVerificationTokenSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_DeletedVerificationTokenMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_DeletedVerificationTokenMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_DeletedVerificationTokenScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_DeletedVerificationTokenCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_DeletedVerificationTokenScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_DeletedVerificationTokenScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_DeletedVerificationTokenGroupByOutput']:
        """Group LiteLLM_DeletedVerificationToken records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_DeletedVerificationToken fields to group records by
        where
            LiteLLM_DeletedVerificationToken filter to select records
        take
            Limit the maximum number of LiteLLM_DeletedVerificationToken records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_DeletedVerificationTokenGroupByOutput]
            A list of dictionaries representing the LiteLLM_DeletedVerificationToken record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_DeletedVerificationToken records by aliases values
        # and count how many records are in each group
        results = await LiteLLM_DeletedVerificationToken.prisma().group_by(
            ['aliases'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_EndUserTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_EndUserTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_EndUserTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_EndUserTable WHERE user_id = $1',
            'eeejidbif',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_EndUserTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_EndUserTable.prisma().query_first(
            'SELECT * FROM LiteLLM_EndUserTable WHERE alias = $1',
            'efgbahec',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_EndUserTableCreateInput,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_EndUserTable record.

        Parameters
        ----------
        data
            LiteLLM_EndUserTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_EndUserTable model

        Returns
        -------
        prisma.models.LiteLLM_EndUserTable
            The created LiteLLM_EndUserTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_EndUserTable record from just the required fields
        litellm_endusertable = await LiteLLM_EndUserTable.prisma().create(
            data={
                # data to create a LiteLLM_EndUserTable record
                'user_id': 'hgjaiebfb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_EndUserTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_EndUserTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_EndUserTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_EndUserTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_EndUserTable record
                    'user_id': 'bddefjjabc',
                },
                {
                    # data to create a LiteLLM_EndUserTable record
                    'user_id': 'bbbghgbadh',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_EndUserTableWhereUniqueInput,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_EndUserTable record.

        Parameters
        ----------
        where
            LiteLLM_EndUserTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_EndUserTable model

        Returns
        -------
        prisma.models.LiteLLM_EndUserTable
            The deleted LiteLLM_EndUserTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_endusertable = await LiteLLM_EndUserTable.prisma().delete(
            where={
                'user_id': 'bbhcgagaic',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_EndUserTableWhereUniqueInput,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_EndUserTable record.

        Parameters
        ----------
        where
            LiteLLM_EndUserTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_EndUserTable model

        Returns
        -------
        prisma.models.LiteLLM_EndUserTable
            The found LiteLLM_EndUserTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_endusertable = await LiteLLM_EndUserTable.prisma().find_unique(
            where={
                'user_id': 'ddaabegbb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_EndUserTableWhereUniqueInput,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_EndUserTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_EndUserTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_EndUserTable model

        Returns
        -------
        prisma.models.LiteLLM_EndUserTable
            The found LiteLLM_EndUserTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_endusertable = await LiteLLM_EndUserTable.prisma().find_unique_or_raise(
            where={
                'user_id': 'bhgibfgbbc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_EndUserTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_EndUserTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None,
        order: Optional[Union[types.LiteLLM_EndUserTableOrderByInput, List[types.LiteLLM_EndUserTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_EndUserTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_EndUserTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_EndUserTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_EndUserTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_EndUserTable model
        order
            Order the returned LiteLLM_EndUserTable records by any field
        distinct
            Filter LiteLLM_EndUserTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_EndUserTable]
            The list of all LiteLLM_EndUserTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_EndUserTable records
        litellm_endusertables = await LiteLLM_EndUserTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_EndUserTable records ordered by the spend field
        litellm_endusertables = await LiteLLM_EndUserTable.prisma().find_many(
            take=5,
            order={
                'spend': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_EndUserTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_EndUserTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None,
        order: Optional[Union[types.LiteLLM_EndUserTableOrderByInput, List[types.LiteLLM_EndUserTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_EndUserTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_EndUserTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_EndUserTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_EndUserTable model
        order
            Order the returned LiteLLM_EndUserTable records by any field
        distinct
            Filter LiteLLM_EndUserTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_EndUserTable
            The first LiteLLM_EndUserTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_EndUserTable record ordered by the allowed_model_region field
        litellm_endusertable = await LiteLLM_EndUserTable.prisma().find_first(
            skip=1,
            order={
                'allowed_model_region': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_EndUserTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_EndUserTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None,
        order: Optional[Union[types.LiteLLM_EndUserTableOrderByInput, List[types.LiteLLM_EndUserTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_EndUserTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_EndUserTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_EndUserTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_EndUserTable model
        order
            Order the returned LiteLLM_EndUserTable records by any field
        distinct
            Filter LiteLLM_EndUserTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_EndUserTable
            The first LiteLLM_EndUserTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_EndUserTable record ordered by the default_model field
        litellm_endusertable = await LiteLLM_EndUserTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'default_model': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_EndUserTableUpdateInput,
        where: types.LiteLLM_EndUserTableWhereUniqueInput,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_EndUserTable record.

        Parameters
        ----------
        data
            LiteLLM_EndUserTable record data specifying what to update
        where
            LiteLLM_EndUserTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_EndUserTable model

        Returns
        -------
        prisma.models.LiteLLM_EndUserTable
            The updated LiteLLM_EndUserTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_endusertable = await LiteLLM_EndUserTable.prisma().update(
            where={
                'user_id': 'hbgcihef',
            },
            data={
                # data to update the LiteLLM_EndUserTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_EndUserTableWhereUniqueInput,
        data: types.LiteLLM_EndUserTableUpsertInput,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_EndUserTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_EndUserTable model

        Returns
        -------
        prisma.models.LiteLLM_EndUserTable
            The created or updated LiteLLM_EndUserTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_endusertable = await LiteLLM_EndUserTable.prisma().upsert(
            where={
                'user_id': 'ffhgghde',
            },
            data={
                'create': {
                    'user_id': 'ffhgghde',
                },
                'update': {
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_EndUserTableUpdateManyMutationInput,
        where: types.LiteLLM_EndUserTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_EndUserTable records

        Parameters
        ----------
        data
            LiteLLM_EndUserTable data to update the selected LiteLLM_EndUserTable records to
        where
            Filter to select the LiteLLM_EndUserTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_EndUserTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_EndUserTable records
        total = await LiteLLM_EndUserTable.prisma().update_many(
            data={
                'budget_id': 'ibcadcejf'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_EndUserTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_EndUserTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_EndUserTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_EndUserTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_EndUserTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_EndUserTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_EndUserTable.prisma().count()

        # results: prisma.types.LiteLLM_EndUserTableCountAggregateOutput
        results = await LiteLLM_EndUserTable.prisma().count(
            select={
                '_all': True,
                'object_permission_id': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_EndUserTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_EndUserTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_EndUserTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_EndUserTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_EndUserTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_EndUserTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_EndUserTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_EndUserTableCountAggregateOutput]:
        """Count the number of LiteLLM_EndUserTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_EndUserTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_EndUserTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_EndUserTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_EndUserTable.prisma().count()

        # results: prisma.types.LiteLLM_EndUserTableCountAggregateOutput
        results = await LiteLLM_EndUserTable.prisma().count(
            select={
                '_all': True,
                'blocked': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_EndUserTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_EndUserTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_EndUserTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_EndUserTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_EndUserTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_EndUserTable records
        total = await LiteLLM_EndUserTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_EndUserTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_EndUserTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_EndUserTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_EndUserTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_EndUserTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_EndUserTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_EndUserTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_EndUserTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_EndUserTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_EndUserTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_EndUserTableGroupByOutput']:
        """Group LiteLLM_EndUserTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_EndUserTable fields to group records by
        where
            LiteLLM_EndUserTable filter to select records
        take
            Limit the maximum number of LiteLLM_EndUserTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_EndUserTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_EndUserTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_EndUserTable records by user_id values
        # and count how many records are in each group
        results = await LiteLLM_EndUserTable.prisma().group_by(
            ['user_id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_TagTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_TagTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_TagTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_TagTable WHERE tag_name = $1',
            'bdcdfgccdg',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_TagTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_TagTable.prisma().query_first(
            'SELECT * FROM LiteLLM_TagTable WHERE description = $1',
            'edhjgdfh',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_TagTableCreateInput,
        include: Optional[types.LiteLLM_TagTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_TagTable record.

        Parameters
        ----------
        data
            LiteLLM_TagTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_TagTable model

        Returns
        -------
        prisma.models.LiteLLM_TagTable
            The created LiteLLM_TagTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_TagTable record from just the required fields
        litellm_tagtable = await LiteLLM_TagTable.prisma().create(
            data={
                # data to create a LiteLLM_TagTable record
                'tag_name': 'bdeffdadda',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_TagTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_TagTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_TagTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_TagTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_TagTable record
                    'tag_name': 'bjgfdihchf',
                },
                {
                    # data to create a LiteLLM_TagTable record
                    'tag_name': 'iaeihdeei',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_TagTableWhereUniqueInput,
        include: Optional[types.LiteLLM_TagTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_TagTable record.

        Parameters
        ----------
        where
            LiteLLM_TagTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_TagTable model

        Returns
        -------
        prisma.models.LiteLLM_TagTable
            The deleted LiteLLM_TagTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_tagtable = await LiteLLM_TagTable.prisma().delete(
            where={
                'tag_name': 'bfggejgfbd',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_TagTableWhereUniqueInput,
        include: Optional[types.LiteLLM_TagTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_TagTable record.

        Parameters
        ----------
        where
            LiteLLM_TagTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_TagTable model

        Returns
        -------
        prisma.models.LiteLLM_TagTable
            The found LiteLLM_TagTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_tagtable = await LiteLLM_TagTable.prisma().find_unique(
            where={
                'tag_name': 'ifaaaedja',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_TagTableWhereUniqueInput,
        include: Optional[types.LiteLLM_TagTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_TagTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_TagTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_TagTable model

        Returns
        -------
        prisma.models.LiteLLM_TagTable
            The found LiteLLM_TagTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_tagtable = await LiteLLM_TagTable.prisma().find_unique_or_raise(
            where={
                'tag_name': 'cbajdjjabf',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TagTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_TagTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_TagTableInclude] = None,
        order: Optional[Union[types.LiteLLM_TagTableOrderByInput, List[types.LiteLLM_TagTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_TagTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_TagTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_TagTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_TagTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_TagTable model
        order
            Order the returned LiteLLM_TagTable records by any field
        distinct
            Filter LiteLLM_TagTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_TagTable]
            The list of all LiteLLM_TagTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_TagTable records
        litellm_tagtables = await LiteLLM_TagTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_TagTable records ordered by the models field
        litellm_tagtables = await LiteLLM_TagTable.prisma().find_many(
            take=5,
            order={
                'models': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TagTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_TagTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_TagTableInclude] = None,
        order: Optional[Union[types.LiteLLM_TagTableOrderByInput, List[types.LiteLLM_TagTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_TagTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_TagTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_TagTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_TagTable model
        order
            Order the returned LiteLLM_TagTable records by any field
        distinct
            Filter LiteLLM_TagTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_TagTable
            The first LiteLLM_TagTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_TagTable record ordered by the model_info field
        litellm_tagtable = await LiteLLM_TagTable.prisma().find_first(
            skip=1,
            order={
                'model_info': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TagTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_TagTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_TagTableInclude] = None,
        order: Optional[Union[types.LiteLLM_TagTableOrderByInput, List[types.LiteLLM_TagTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_TagTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_TagTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_TagTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_TagTable model
        order
            Order the returned LiteLLM_TagTable records by any field
        distinct
            Filter LiteLLM_TagTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_TagTable
            The first LiteLLM_TagTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_TagTable record ordered by the spend field
        litellm_tagtable = await LiteLLM_TagTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'spend': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_TagTableUpdateInput,
        where: types.LiteLLM_TagTableWhereUniqueInput,
        include: Optional[types.LiteLLM_TagTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_TagTable record.

        Parameters
        ----------
        data
            LiteLLM_TagTable record data specifying what to update
        where
            LiteLLM_TagTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_TagTable model

        Returns
        -------
        prisma.models.LiteLLM_TagTable
            The updated LiteLLM_TagTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_tagtable = await LiteLLM_TagTable.prisma().update(
            where={
                'tag_name': 'bcicggedea',
            },
            data={
                # data to update the LiteLLM_TagTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_TagTableWhereUniqueInput,
        data: types.LiteLLM_TagTableUpsertInput,
        include: Optional[types.LiteLLM_TagTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_TagTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_TagTable model

        Returns
        -------
        prisma.models.LiteLLM_TagTable
            The created or updated LiteLLM_TagTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_tagtable = await LiteLLM_TagTable.prisma().upsert(
            where={
                'tag_name': 'cebcdadjh',
            },
            data={
                'create': {
                    'tag_name': 'cebcdadjh',
                },
                'update': {
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_TagTableUpdateManyMutationInput,
        where: types.LiteLLM_TagTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_TagTable records

        Parameters
        ----------
        data
            LiteLLM_TagTable data to update the selected LiteLLM_TagTable records to
        where
            Filter to select the LiteLLM_TagTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_TagTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_TagTable records
        total = await LiteLLM_TagTable.prisma().update_many(
            data={
                'budget_id': 'ehfigdgac'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TagTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_TagTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_TagTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_TagTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_TagTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_TagTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_TagTable.prisma().count()

        # results: prisma.types.LiteLLM_TagTableCountAggregateOutput
        results = await LiteLLM_TagTable.prisma().count(
            select={
                '_all': True,
                'created_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_TagTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TagTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_TagTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_TagTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_TagTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TagTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_TagTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_TagTableCountAggregateOutput]:
        """Count the number of LiteLLM_TagTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_TagTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_TagTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_TagTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_TagTable.prisma().count()

        # results: prisma.types.LiteLLM_TagTableCountAggregateOutput
        results = await LiteLLM_TagTable.prisma().count(
            select={
                '_all': True,
                'created_by': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_TagTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_TagTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_TagTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_TagTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_TagTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_TagTable records
        total = await LiteLLM_TagTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_TagTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_TagTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_TagTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_TagTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_TagTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_TagTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_TagTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_TagTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_TagTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_TagTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_TagTableGroupByOutput']:
        """Group LiteLLM_TagTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_TagTable fields to group records by
        where
            LiteLLM_TagTable filter to select records
        take
            Limit the maximum number of LiteLLM_TagTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_TagTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_TagTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_TagTable records by updated_at values
        # and count how many records are in each group
        results = await LiteLLM_TagTable.prisma().group_by(
            ['updated_at'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ConfigActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_Config]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_Config.prisma().query_raw(
            'SELECT * FROM LiteLLM_Config WHERE param_name = $1',
            'bhbgccijjf',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_Config
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_Config.prisma().query_first(
            'SELECT * FROM LiteLLM_Config WHERE param_value = $1',
            Json({'bigjhdgbjc': True}),
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ConfigCreateInput,
        include: Optional[types.LiteLLM_ConfigInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_Config record.

        Parameters
        ----------
        data
            LiteLLM_Config record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_Config model

        Returns
        -------
        prisma.models.LiteLLM_Config
            The created LiteLLM_Config record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_Config record from just the required fields
        litellm_config = await LiteLLM_Config.prisma().create(
            data={
                # data to create a LiteLLM_Config record
                'param_name': 'bfifdebhfd',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ConfigCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_Config records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_Config record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_Config.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_Config record
                    'param_name': 'cjchbjde',
                },
                {
                    # data to create a LiteLLM_Config record
                    'param_name': 'bfiibjcehj',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_ConfigInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_Config record.

        Parameters
        ----------
        where
            LiteLLM_Config filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_Config model

        Returns
        -------
        prisma.models.LiteLLM_Config
            The deleted LiteLLM_Config record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_config = await LiteLLM_Config.prisma().delete(
            where={
                'param_name': 'ijieafghg',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_ConfigInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_Config record.

        Parameters
        ----------
        where
            LiteLLM_Config filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_Config model

        Returns
        -------
        prisma.models.LiteLLM_Config
            The found LiteLLM_Config record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_config = await LiteLLM_Config.prisma().find_unique(
            where={
                'param_name': 'hhhegahcf',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_ConfigInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_Config record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_Config filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_Config model

        Returns
        -------
        prisma.models.LiteLLM_Config
            The found LiteLLM_Config record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_config = await LiteLLM_Config.prisma().find_unique_or_raise(
            where={
                'param_name': 'edhijefdi',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_ConfigWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ConfigInclude] = None,
        order: Optional[Union[types.LiteLLM_ConfigOrderByInput, List[types.LiteLLM_ConfigOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ConfigScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_Config records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_Config records returned
        skip
            Ignore the first N results
        where
            LiteLLM_Config filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_Config model
        order
            Order the returned LiteLLM_Config records by any field
        distinct
            Filter LiteLLM_Config records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_Config]
            The list of all LiteLLM_Config records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_Config records
        litellm_configs = await LiteLLM_Config.prisma().find_many(take=10)

        # find the first 5 LiteLLM_Config records ordered by the param_name field
        litellm_configs = await LiteLLM_Config.prisma().find_many(
            take=5,
            order={
                'param_name': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_ConfigWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ConfigInclude] = None,
        order: Optional[Union[types.LiteLLM_ConfigOrderByInput, List[types.LiteLLM_ConfigOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ConfigScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_Config record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_Config filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_Config model
        order
            Order the returned LiteLLM_Config records by any field
        distinct
            Filter LiteLLM_Config records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_Config
            The first LiteLLM_Config record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_Config record ordered by the param_value field
        litellm_config = await LiteLLM_Config.prisma().find_first(
            skip=1,
            order={
                'param_value': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_ConfigWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ConfigInclude] = None,
        order: Optional[Union[types.LiteLLM_ConfigOrderByInput, List[types.LiteLLM_ConfigOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ConfigScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_Config record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_Config filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_Config model
        order
            Order the returned LiteLLM_Config records by any field
        distinct
            Filter LiteLLM_Config records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_Config
            The first LiteLLM_Config record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_Config record ordered by the param_name field
        litellm_config = await LiteLLM_Config.prisma().find_first_or_raise(
            skip=1,
            order={
                'param_name': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ConfigUpdateInput,
        where: types.LiteLLM_ConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_ConfigInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_Config record.

        Parameters
        ----------
        data
            LiteLLM_Config record data specifying what to update
        where
            LiteLLM_Config filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_Config model

        Returns
        -------
        prisma.models.LiteLLM_Config
            The updated LiteLLM_Config record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_config = await LiteLLM_Config.prisma().update(
            where={
                'param_name': 'djddecjhb',
            },
            data={
                # data to update the LiteLLM_Config record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ConfigWhereUniqueInput,
        data: types.LiteLLM_ConfigUpsertInput,
        include: Optional[types.LiteLLM_ConfigInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_Config filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_Config model

        Returns
        -------
        prisma.models.LiteLLM_Config
            The created or updated LiteLLM_Config record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_config = await LiteLLM_Config.prisma().upsert(
            where={
                'param_name': 'bgdicjhie',
            },
            data={
                'create': {
                    'param_name': 'bgdicjhie',
                },
                'update': {
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ConfigUpdateManyMutationInput,
        where: types.LiteLLM_ConfigWhereInput,
    ) -> int:
        """Update multiple LiteLLM_Config records

        Parameters
        ----------
        data
            LiteLLM_Config data to update the selected LiteLLM_Config records to
        where
            Filter to select the LiteLLM_Config records to update

        Returns
        -------
        int
            The total number of LiteLLM_Config records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_Config records
        total = await LiteLLM_Config.prisma().update_many(
            data={
                'param_value': Json({'ceibfcgij': True})
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_ConfigWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_Config records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_Config fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_Config filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ConfigCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_Config.prisma().count()

        # results: prisma.types.LiteLLM_ConfigCountAggregateOutput
        results = await LiteLLM_Config.prisma().count(
            select={
                '_all': True,
                'param_name': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ConfigCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_ConfigWhereUniqueInput] = None,
    ) -> types.LiteLLM_ConfigCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ConfigCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_ConfigWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ConfigCountAggregateOutput]:
        """Count the number of LiteLLM_Config records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_Config fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_Config filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ConfigCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_Config.prisma().count()

        # results: prisma.types.LiteLLM_ConfigCountAggregateOutput
        results = await LiteLLM_Config.prisma().count(
            select={
                '_all': True,
                'param_value': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ConfigCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ConfigWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_Config records.

        Parameters
        ----------
        where
            Optional LiteLLM_Config filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_Config records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_Config records
        total = await LiteLLM_Config.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ConfigScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ConfigWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ConfigAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ConfigSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ConfigMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ConfigMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ConfigScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ConfigCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ConfigScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ConfigScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ConfigGroupByOutput']:
        """Group LiteLLM_Config records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_Config fields to group records by
        where
            LiteLLM_Config filter to select records
        take
            Limit the maximum number of LiteLLM_Config records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ConfigGroupByOutput]
            A list of dictionaries representing the LiteLLM_Config record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_Config records by param_name values
        # and count how many records are in each group
        results = await LiteLLM_Config.prisma().group_by(
            ['param_name'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_SpendLogsActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_SpendLogs]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_SpendLogs.prisma().query_raw(
            'SELECT * FROM LiteLLM_SpendLogs WHERE request_id = $1',
            'debhbfada',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_SpendLogs
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_SpendLogs.prisma().query_first(
            'SELECT * FROM LiteLLM_SpendLogs WHERE call_type = $1',
            'bgjchggecd',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_SpendLogsCreateInput,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_SpendLogs record.

        Parameters
        ----------
        data
            LiteLLM_SpendLogs record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogs model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogs
            The created LiteLLM_SpendLogs record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_SpendLogs record from just the required fields
        litellm_spendlogs = await LiteLLM_SpendLogs.prisma().create(
            data={
                # data to create a LiteLLM_SpendLogs record
                'request_id': 'igggcfjg',
                'call_type': 'bgjhijffjh',
                'startTime': datetime.datetime.utcnow(),
                'endTime': datetime.datetime.utcnow(),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_SpendLogsCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_SpendLogs records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_SpendLogs record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_SpendLogs.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_SpendLogs record
                    'request_id': 'bcigdhache',
                    'call_type': 'igefhgdhb',
                    'startTime': datetime.datetime.utcnow(),
                    'endTime': datetime.datetime.utcnow(),
                },
                {
                    # data to create a LiteLLM_SpendLogs record
                    'request_id': 'ejbiifbae',
                    'call_type': 'djcfgedjd',
                    'startTime': datetime.datetime.utcnow(),
                    'endTime': datetime.datetime.utcnow(),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_SpendLogsWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_SpendLogs record.

        Parameters
        ----------
        where
            LiteLLM_SpendLogs filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogs model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogs
            The deleted LiteLLM_SpendLogs record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_spendlogs = await LiteLLM_SpendLogs.prisma().delete(
            where={
                'request_id': 'bdbjcdegag',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_SpendLogsWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_SpendLogs record.

        Parameters
        ----------
        where
            LiteLLM_SpendLogs filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogs model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogs
            The found LiteLLM_SpendLogs record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_spendlogs = await LiteLLM_SpendLogs.prisma().find_unique(
            where={
                'request_id': 'hbchfebch',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_SpendLogsWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_SpendLogs record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_SpendLogs filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogs model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogs
            The found LiteLLM_SpendLogs record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_spendlogs = await LiteLLM_SpendLogs.prisma().find_unique_or_raise(
            where={
                'request_id': 'bcjjffegfc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogsWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None,
        order: Optional[Union[types.LiteLLM_SpendLogsOrderByInput, List[types.LiteLLM_SpendLogsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SpendLogsScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_SpendLogs records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_SpendLogs records returned
        skip
            Ignore the first N results
        where
            LiteLLM_SpendLogs filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogs model
        order
            Order the returned LiteLLM_SpendLogs records by any field
        distinct
            Filter LiteLLM_SpendLogs records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_SpendLogs]
            The list of all LiteLLM_SpendLogs records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_SpendLogs records
        litellm_spendlogs = await LiteLLM_SpendLogs.prisma().find_many(take=10)

        # find the first 5 LiteLLM_SpendLogs records ordered by the api_key field
        litellm_spendlogs = await LiteLLM_SpendLogs.prisma().find_many(
            take=5,
            order={
                'api_key': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogsWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None,
        order: Optional[Union[types.LiteLLM_SpendLogsOrderByInput, List[types.LiteLLM_SpendLogsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SpendLogsScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_SpendLogs record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_SpendLogs filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogs model
        order
            Order the returned LiteLLM_SpendLogs records by any field
        distinct
            Filter LiteLLM_SpendLogs records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_SpendLogs
            The first LiteLLM_SpendLogs record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_SpendLogs record ordered by the spend field
        litellm_spendlogs = await LiteLLM_SpendLogs.prisma().find_first(
            skip=1,
            order={
                'spend': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogsWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None,
        order: Optional[Union[types.LiteLLM_SpendLogsOrderByInput, List[types.LiteLLM_SpendLogsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SpendLogsScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_SpendLogs record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_SpendLogs filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogs model
        order
            Order the returned LiteLLM_SpendLogs records by any field
        distinct
            Filter LiteLLM_SpendLogs records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_SpendLogs
            The first LiteLLM_SpendLogs record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_SpendLogs record ordered by the total_tokens field
        litellm_spendlogs = await LiteLLM_SpendLogs.prisma().find_first_or_raise(
            skip=1,
            order={
                'total_tokens': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_SpendLogsUpdateInput,
        where: types.LiteLLM_SpendLogsWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_SpendLogs record.

        Parameters
        ----------
        data
            LiteLLM_SpendLogs record data specifying what to update
        where
            LiteLLM_SpendLogs filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogs model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogs
            The updated LiteLLM_SpendLogs record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_spendlogs = await LiteLLM_SpendLogs.prisma().update(
            where={
                'request_id': 'cahaeaicjd',
            },
            data={
                # data to update the LiteLLM_SpendLogs record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_SpendLogsWhereUniqueInput,
        data: types.LiteLLM_SpendLogsUpsertInput,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_SpendLogs filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogs model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogs
            The created or updated LiteLLM_SpendLogs record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_spendlogs = await LiteLLM_SpendLogs.prisma().upsert(
            where={
                'request_id': 'ibbjaacbi',
            },
            data={
                'create': {
                    'request_id': 'ibbjaacbi',
                    'call_type': 'djcfgedjd',
                    'startTime': datetime.datetime.utcnow(),
                    'endTime': datetime.datetime.utcnow(),
                },
                'update': {
                    'call_type': 'djcfgedjd',
                    'startTime': datetime.datetime.utcnow(),
                    'endTime': datetime.datetime.utcnow(),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_SpendLogsUpdateManyMutationInput,
        where: types.LiteLLM_SpendLogsWhereInput,
    ) -> int:
        """Update multiple LiteLLM_SpendLogs records

        Parameters
        ----------
        data
            LiteLLM_SpendLogs data to update the selected LiteLLM_SpendLogs records to
        where
            Filter to select the LiteLLM_SpendLogs records to update

        Returns
        -------
        int
            The total number of LiteLLM_SpendLogs records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_SpendLogs records
        total = await LiteLLM_SpendLogs.prisma().update_many(
            data={
                'prompt_tokens': 396021227
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogsWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogsWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_SpendLogs records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_SpendLogs fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_SpendLogs filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_SpendLogsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_SpendLogs.prisma().count()

        # results: prisma.types.LiteLLM_SpendLogsCountAggregateOutput
        results = await LiteLLM_SpendLogs.prisma().count(
            select={
                '_all': True,
                'completion_tokens': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_SpendLogsCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogsWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogsWhereUniqueInput] = None,
    ) -> types.LiteLLM_SpendLogsCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_SpendLogsCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogsWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogsWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_SpendLogsCountAggregateOutput]:
        """Count the number of LiteLLM_SpendLogs records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_SpendLogs fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_SpendLogs filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_SpendLogsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_SpendLogs.prisma().count()

        # results: prisma.types.LiteLLM_SpendLogsCountAggregateOutput
        results = await LiteLLM_SpendLogs.prisma().count(
            select={
                '_all': True,
                'startTime': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_SpendLogsCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_SpendLogsWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_SpendLogs records.

        Parameters
        ----------
        where
            Optional LiteLLM_SpendLogs filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_SpendLogs records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_SpendLogs records
        total = await LiteLLM_SpendLogs.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_SpendLogsScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_SpendLogsWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_SpendLogsAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_SpendLogsSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_SpendLogsMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_SpendLogsMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_SpendLogsScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_SpendLogsCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_SpendLogsScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_SpendLogsScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_SpendLogsGroupByOutput']:
        """Group LiteLLM_SpendLogs records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_SpendLogs fields to group records by
        where
            LiteLLM_SpendLogs filter to select records
        take
            Limit the maximum number of LiteLLM_SpendLogs records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_SpendLogsGroupByOutput]
            A list of dictionaries representing the LiteLLM_SpendLogs record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_SpendLogs records by endTime values
        # and count how many records are in each group
        results = await LiteLLM_SpendLogs.prisma().group_by(
            ['endTime'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ErrorLogsActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ErrorLogs]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ErrorLogs.prisma().query_raw(
            'SELECT * FROM LiteLLM_ErrorLogs WHERE request_id = $1',
            'geeeegace',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ErrorLogs
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ErrorLogs.prisma().query_first(
            'SELECT * FROM LiteLLM_ErrorLogs WHERE startTime = $1',
            datetime.datetime.utcnow(),
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ErrorLogsCreateInput,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ErrorLogs record.

        Parameters
        ----------
        data
            LiteLLM_ErrorLogs record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ErrorLogs model

        Returns
        -------
        prisma.models.LiteLLM_ErrorLogs
            The created LiteLLM_ErrorLogs record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ErrorLogs record from just the required fields
        litellm_errorlogs = await LiteLLM_ErrorLogs.prisma().create(
            data={
                # data to create a LiteLLM_ErrorLogs record
                'startTime': datetime.datetime.utcnow(),
                'endTime': datetime.datetime.utcnow(),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ErrorLogsCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ErrorLogs records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ErrorLogs record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ErrorLogs.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ErrorLogs record
                    'startTime': datetime.datetime.utcnow(),
                    'endTime': datetime.datetime.utcnow(),
                },
                {
                    # data to create a LiteLLM_ErrorLogs record
                    'startTime': datetime.datetime.utcnow(),
                    'endTime': datetime.datetime.utcnow(),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ErrorLogsWhereUniqueInput,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ErrorLogs record.

        Parameters
        ----------
        where
            LiteLLM_ErrorLogs filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ErrorLogs model

        Returns
        -------
        prisma.models.LiteLLM_ErrorLogs
            The deleted LiteLLM_ErrorLogs record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_errorlogs = await LiteLLM_ErrorLogs.prisma().delete(
            where={
                'request_id': 'bbgdigchd',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ErrorLogsWhereUniqueInput,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ErrorLogs record.

        Parameters
        ----------
        where
            LiteLLM_ErrorLogs filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ErrorLogs model

        Returns
        -------
        prisma.models.LiteLLM_ErrorLogs
            The found LiteLLM_ErrorLogs record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_errorlogs = await LiteLLM_ErrorLogs.prisma().find_unique(
            where={
                'request_id': 'dajcifgdi',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ErrorLogsWhereUniqueInput,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ErrorLogs record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ErrorLogs filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ErrorLogs model

        Returns
        -------
        prisma.models.LiteLLM_ErrorLogs
            The found LiteLLM_ErrorLogs record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_errorlogs = await LiteLLM_ErrorLogs.prisma().find_unique_or_raise(
            where={
                'request_id': 'ccedhdbj',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ErrorLogsWhereInput] = None,
        cursor: Optional[types.LiteLLM_ErrorLogsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None,
        order: Optional[Union[types.LiteLLM_ErrorLogsOrderByInput, List[types.LiteLLM_ErrorLogsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ErrorLogsScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ErrorLogs records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ErrorLogs records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ErrorLogs filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ErrorLogs model
        order
            Order the returned LiteLLM_ErrorLogs records by any field
        distinct
            Filter LiteLLM_ErrorLogs records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ErrorLogs]
            The list of all LiteLLM_ErrorLogs records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ErrorLogs records
        litellm_errorlogs = await LiteLLM_ErrorLogs.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ErrorLogs records ordered by the endTime field
        litellm_errorlogs = await LiteLLM_ErrorLogs.prisma().find_many(
            take=5,
            order={
                'endTime': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ErrorLogsWhereInput] = None,
        cursor: Optional[types.LiteLLM_ErrorLogsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None,
        order: Optional[Union[types.LiteLLM_ErrorLogsOrderByInput, List[types.LiteLLM_ErrorLogsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ErrorLogsScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ErrorLogs record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ErrorLogs filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ErrorLogs model
        order
            Order the returned LiteLLM_ErrorLogs records by any field
        distinct
            Filter LiteLLM_ErrorLogs records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ErrorLogs
            The first LiteLLM_ErrorLogs record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ErrorLogs record ordered by the api_base field
        litellm_errorlogs = await LiteLLM_ErrorLogs.prisma().find_first(
            skip=1,
            order={
                'api_base': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ErrorLogsWhereInput] = None,
        cursor: Optional[types.LiteLLM_ErrorLogsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None,
        order: Optional[Union[types.LiteLLM_ErrorLogsOrderByInput, List[types.LiteLLM_ErrorLogsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ErrorLogsScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ErrorLogs record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ErrorLogs filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ErrorLogs model
        order
            Order the returned LiteLLM_ErrorLogs records by any field
        distinct
            Filter LiteLLM_ErrorLogs records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ErrorLogs
            The first LiteLLM_ErrorLogs record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ErrorLogs record ordered by the model_group field
        litellm_errorlogs = await LiteLLM_ErrorLogs.prisma().find_first_or_raise(
            skip=1,
            order={
                'model_group': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ErrorLogsUpdateInput,
        where: types.LiteLLM_ErrorLogsWhereUniqueInput,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ErrorLogs record.

        Parameters
        ----------
        data
            LiteLLM_ErrorLogs record data specifying what to update
        where
            LiteLLM_ErrorLogs filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ErrorLogs model

        Returns
        -------
        prisma.models.LiteLLM_ErrorLogs
            The updated LiteLLM_ErrorLogs record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_errorlogs = await LiteLLM_ErrorLogs.prisma().update(
            where={
                'request_id': 'bjaabjjjce',
            },
            data={
                # data to update the LiteLLM_ErrorLogs record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ErrorLogsWhereUniqueInput,
        data: types.LiteLLM_ErrorLogsUpsertInput,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ErrorLogs filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ErrorLogs model

        Returns
        -------
        prisma.models.LiteLLM_ErrorLogs
            The created or updated LiteLLM_ErrorLogs record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_errorlogs = await LiteLLM_ErrorLogs.prisma().upsert(
            where={
                'request_id': 'cafhdcdcjd',
            },
            data={
                'create': {
                    'request_id': 'cafhdcdcjd',
                    'startTime': datetime.datetime.utcnow(),
                    'endTime': datetime.datetime.utcnow(),
                },
                'update': {
                    'startTime': datetime.datetime.utcnow(),
                    'endTime': datetime.datetime.utcnow(),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ErrorLogsUpdateManyMutationInput,
        where: types.LiteLLM_ErrorLogsWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ErrorLogs records

        Parameters
        ----------
        data
            LiteLLM_ErrorLogs data to update the selected LiteLLM_ErrorLogs records to
        where
            Filter to select the LiteLLM_ErrorLogs records to update

        Returns
        -------
        int
            The total number of LiteLLM_ErrorLogs records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ErrorLogs records
        total = await LiteLLM_ErrorLogs.prisma().update_many(
            data={
                'litellm_model_name': 'bdeebbhbdi'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ErrorLogsWhereInput] = None,
        cursor: Optional[types.LiteLLM_ErrorLogsWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ErrorLogs records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ErrorLogs fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ErrorLogs filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ErrorLogsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ErrorLogs.prisma().count()

        # results: prisma.types.LiteLLM_ErrorLogsCountAggregateOutput
        results = await LiteLLM_ErrorLogs.prisma().count(
            select={
                '_all': True,
                'model_id': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ErrorLogsCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ErrorLogsWhereInput] = None,
        cursor: Optional[types.LiteLLM_ErrorLogsWhereUniqueInput] = None,
    ) -> types.LiteLLM_ErrorLogsCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ErrorLogsCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ErrorLogsWhereInput] = None,
        cursor: Optional[types.LiteLLM_ErrorLogsWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ErrorLogsCountAggregateOutput]:
        """Count the number of LiteLLM_ErrorLogs records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ErrorLogs fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ErrorLogs filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ErrorLogsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ErrorLogs.prisma().count()

        # results: prisma.types.LiteLLM_ErrorLogsCountAggregateOutput
        results = await LiteLLM_ErrorLogs.prisma().count(
            select={
                '_all': True,
                'request_kwargs': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ErrorLogsCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ErrorLogsWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ErrorLogs records.

        Parameters
        ----------
        where
            Optional LiteLLM_ErrorLogs filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ErrorLogs records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ErrorLogs records
        total = await LiteLLM_ErrorLogs.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ErrorLogsScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ErrorLogsWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ErrorLogsAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ErrorLogsSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ErrorLogsMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ErrorLogsMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ErrorLogsScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ErrorLogsCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ErrorLogsScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ErrorLogsScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ErrorLogsGroupByOutput']:
        """Group LiteLLM_ErrorLogs records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ErrorLogs fields to group records by
        where
            LiteLLM_ErrorLogs filter to select records
        take
            Limit the maximum number of LiteLLM_ErrorLogs records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ErrorLogsGroupByOutput]
            A list of dictionaries representing the LiteLLM_ErrorLogs record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ErrorLogs records by exception_type values
        # and count how many records are in each group
        results = await LiteLLM_ErrorLogs.prisma().group_by(
            ['exception_type'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_UserNotificationsActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_UserNotifications]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_UserNotifications.prisma().query_raw(
            'SELECT * FROM LiteLLM_UserNotifications WHERE request_id = $1',
            'cafcbdchah',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_UserNotifications
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_UserNotifications.prisma().query_first(
            'SELECT * FROM LiteLLM_UserNotifications WHERE user_id = $1',
            'bdffbehbae',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_UserNotificationsCreateInput,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_UserNotifications record.

        Parameters
        ----------
        data
            LiteLLM_UserNotifications record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserNotifications model

        Returns
        -------
        prisma.models.LiteLLM_UserNotifications
            The created LiteLLM_UserNotifications record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_UserNotifications record from just the required fields
        litellm_usernotifications = await LiteLLM_UserNotifications.prisma().create(
            data={
                # data to create a LiteLLM_UserNotifications record
                'request_id': 'ieahjgeb',
                'user_id': 'hfeeddceg',
                'justification': 'dbecgbbid',
                'status': 'cchghigae',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_UserNotificationsCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_UserNotifications records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_UserNotifications record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_UserNotifications.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_UserNotifications record
                    'request_id': 'ecdjjjhab',
                    'user_id': 'biachfede',
                    'justification': 'fhgaibff',
                    'status': 'cadajbcbca',
                },
                {
                    # data to create a LiteLLM_UserNotifications record
                    'request_id': 'bjheigfcdd',
                    'user_id': 'bjejigcdcg',
                    'justification': 'bifiiibcah',
                    'status': 'dbjibjdaa',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_UserNotificationsWhereUniqueInput,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_UserNotifications record.

        Parameters
        ----------
        where
            LiteLLM_UserNotifications filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserNotifications model

        Returns
        -------
        prisma.models.LiteLLM_UserNotifications
            The deleted LiteLLM_UserNotifications record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_usernotifications = await LiteLLM_UserNotifications.prisma().delete(
            where={
                'request_id': 'dgijbdiaf',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_UserNotificationsWhereUniqueInput,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_UserNotifications record.

        Parameters
        ----------
        where
            LiteLLM_UserNotifications filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserNotifications model

        Returns
        -------
        prisma.models.LiteLLM_UserNotifications
            The found LiteLLM_UserNotifications record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_usernotifications = await LiteLLM_UserNotifications.prisma().find_unique(
            where={
                'request_id': 'begfaigba',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_UserNotificationsWhereUniqueInput,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_UserNotifications record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_UserNotifications filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserNotifications model

        Returns
        -------
        prisma.models.LiteLLM_UserNotifications
            The found LiteLLM_UserNotifications record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_usernotifications = await LiteLLM_UserNotifications.prisma().find_unique_or_raise(
            where={
                'request_id': 'bdjiafcgjb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UserNotificationsWhereInput] = None,
        cursor: Optional[types.LiteLLM_UserNotificationsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None,
        order: Optional[Union[types.LiteLLM_UserNotificationsOrderByInput, List[types.LiteLLM_UserNotificationsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_UserNotificationsScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_UserNotifications records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_UserNotifications records returned
        skip
            Ignore the first N results
        where
            LiteLLM_UserNotifications filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserNotifications model
        order
            Order the returned LiteLLM_UserNotifications records by any field
        distinct
            Filter LiteLLM_UserNotifications records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_UserNotifications]
            The list of all LiteLLM_UserNotifications records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_UserNotifications records
        litellm_usernotifications = await LiteLLM_UserNotifications.prisma().find_many(take=10)

        # find the first 5 LiteLLM_UserNotifications records ordered by the models field
        litellm_usernotifications = await LiteLLM_UserNotifications.prisma().find_many(
            take=5,
            order={
                'models': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UserNotificationsWhereInput] = None,
        cursor: Optional[types.LiteLLM_UserNotificationsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None,
        order: Optional[Union[types.LiteLLM_UserNotificationsOrderByInput, List[types.LiteLLM_UserNotificationsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_UserNotificationsScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_UserNotifications record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_UserNotifications filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserNotifications model
        order
            Order the returned LiteLLM_UserNotifications records by any field
        distinct
            Filter LiteLLM_UserNotifications records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_UserNotifications
            The first LiteLLM_UserNotifications record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_UserNotifications record ordered by the justification field
        litellm_usernotifications = await LiteLLM_UserNotifications.prisma().find_first(
            skip=1,
            order={
                'justification': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UserNotificationsWhereInput] = None,
        cursor: Optional[types.LiteLLM_UserNotificationsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None,
        order: Optional[Union[types.LiteLLM_UserNotificationsOrderByInput, List[types.LiteLLM_UserNotificationsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_UserNotificationsScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_UserNotifications record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_UserNotifications filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserNotifications model
        order
            Order the returned LiteLLM_UserNotifications records by any field
        distinct
            Filter LiteLLM_UserNotifications records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_UserNotifications
            The first LiteLLM_UserNotifications record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_UserNotifications record ordered by the status field
        litellm_usernotifications = await LiteLLM_UserNotifications.prisma().find_first_or_raise(
            skip=1,
            order={
                'status': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_UserNotificationsUpdateInput,
        where: types.LiteLLM_UserNotificationsWhereUniqueInput,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_UserNotifications record.

        Parameters
        ----------
        data
            LiteLLM_UserNotifications record data specifying what to update
        where
            LiteLLM_UserNotifications filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserNotifications model

        Returns
        -------
        prisma.models.LiteLLM_UserNotifications
            The updated LiteLLM_UserNotifications record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_usernotifications = await LiteLLM_UserNotifications.prisma().update(
            where={
                'request_id': 'bficecgcfg',
            },
            data={
                # data to update the LiteLLM_UserNotifications record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_UserNotificationsWhereUniqueInput,
        data: types.LiteLLM_UserNotificationsUpsertInput,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_UserNotifications filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_UserNotifications model

        Returns
        -------
        prisma.models.LiteLLM_UserNotifications
            The created or updated LiteLLM_UserNotifications record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_usernotifications = await LiteLLM_UserNotifications.prisma().upsert(
            where={
                'request_id': 'cbjjeedcj',
            },
            data={
                'create': {
                    'request_id': 'cbjjeedcj',
                    'user_id': 'bjejigcdcg',
                    'justification': 'bifiiibcah',
                    'status': 'dbjibjdaa',
                },
                'update': {
                    'user_id': 'bjejigcdcg',
                    'justification': 'bifiiibcah',
                    'status': 'dbjibjdaa',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_UserNotificationsUpdateManyMutationInput,
        where: types.LiteLLM_UserNotificationsWhereInput,
    ) -> int:
        """Update multiple LiteLLM_UserNotifications records

        Parameters
        ----------
        data
            LiteLLM_UserNotifications data to update the selected LiteLLM_UserNotifications records to
        where
            Filter to select the LiteLLM_UserNotifications records to update

        Returns
        -------
        int
            The total number of LiteLLM_UserNotifications records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_UserNotifications records
        total = await LiteLLM_UserNotifications.prisma().update_many(
            data={
                'request_id': 'dedgbbhja'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UserNotificationsWhereInput] = None,
        cursor: Optional[types.LiteLLM_UserNotificationsWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_UserNotifications records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_UserNotifications fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_UserNotifications filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_UserNotificationsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_UserNotifications.prisma().count()

        # results: prisma.types.LiteLLM_UserNotificationsCountAggregateOutput
        results = await LiteLLM_UserNotifications.prisma().count(
            select={
                '_all': True,
                'user_id': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_UserNotificationsCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UserNotificationsWhereInput] = None,
        cursor: Optional[types.LiteLLM_UserNotificationsWhereUniqueInput] = None,
    ) -> types.LiteLLM_UserNotificationsCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_UserNotificationsCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UserNotificationsWhereInput] = None,
        cursor: Optional[types.LiteLLM_UserNotificationsWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_UserNotificationsCountAggregateOutput]:
        """Count the number of LiteLLM_UserNotifications records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_UserNotifications fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_UserNotifications filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_UserNotificationsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_UserNotifications.prisma().count()

        # results: prisma.types.LiteLLM_UserNotificationsCountAggregateOutput
        results = await LiteLLM_UserNotifications.prisma().count(
            select={
                '_all': True,
                'models': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_UserNotificationsCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_UserNotificationsWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_UserNotifications records.

        Parameters
        ----------
        where
            Optional LiteLLM_UserNotifications filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_UserNotifications records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_UserNotifications records
        total = await LiteLLM_UserNotifications.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_UserNotificationsScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_UserNotificationsWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_UserNotificationsAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_UserNotificationsSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_UserNotificationsMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_UserNotificationsMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_UserNotificationsScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_UserNotificationsCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_UserNotificationsScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_UserNotificationsScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_UserNotificationsGroupByOutput']:
        """Group LiteLLM_UserNotifications records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_UserNotifications fields to group records by
        where
            LiteLLM_UserNotifications filter to select records
        take
            Limit the maximum number of LiteLLM_UserNotifications records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_UserNotificationsGroupByOutput]
            A list of dictionaries representing the LiteLLM_UserNotifications record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_UserNotifications records by justification values
        # and count how many records are in each group
        results = await LiteLLM_UserNotifications.prisma().group_by(
            ['justification'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_TeamMembershipActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_TeamMembership]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_TeamMembership.prisma().query_raw(
            'SELECT * FROM LiteLLM_TeamMembership WHERE user_id = $1',
            'cabiahchj',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_TeamMembership
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_TeamMembership.prisma().query_first(
            'SELECT * FROM LiteLLM_TeamMembership WHERE team_id = $1',
            'cgbeccfce',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_TeamMembershipCreateInput,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_TeamMembership record.

        Parameters
        ----------
        data
            LiteLLM_TeamMembership record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamMembership model

        Returns
        -------
        prisma.models.LiteLLM_TeamMembership
            The created LiteLLM_TeamMembership record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_TeamMembership record from just the required fields
        litellm_teammembership = await LiteLLM_TeamMembership.prisma().create(
            data={
                # data to create a LiteLLM_TeamMembership record
                'user_id': 'fcjcagef',
                'team_id': 'bgdhaeacic',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_TeamMembershipCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_TeamMembership records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_TeamMembership record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_TeamMembership.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_TeamMembership record
                    'user_id': 'caffafcheh',
                    'team_id': 'fjjbegge',
                },
                {
                    # data to create a LiteLLM_TeamMembership record
                    'user_id': 'bdiifhbieb',
                    'team_id': 'cdcaejhgg',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_TeamMembershipWhereUniqueInput,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_TeamMembership record.

        Parameters
        ----------
        where
            LiteLLM_TeamMembership filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamMembership model

        Returns
        -------
        prisma.models.LiteLLM_TeamMembership
            The deleted LiteLLM_TeamMembership record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_teammembership = await LiteLLM_TeamMembership.prisma().delete(
            where={
                # LiteLLM_TeamMembership where unique filter

            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_TeamMembershipWhereUniqueInput,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_TeamMembership record.

        Parameters
        ----------
        where
            LiteLLM_TeamMembership filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamMembership model

        Returns
        -------
        prisma.models.LiteLLM_TeamMembership
            The found LiteLLM_TeamMembership record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_teammembership = await LiteLLM_TeamMembership.prisma().find_unique(
            where={
                # LiteLLM_TeamMembership where unique filter

            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_TeamMembershipWhereUniqueInput,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_TeamMembership record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_TeamMembership filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamMembership model

        Returns
        -------
        prisma.models.LiteLLM_TeamMembership
            The found LiteLLM_TeamMembership record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_teammembership = await LiteLLM_TeamMembership.prisma().find_unique_or_raise(
            where={
                # LiteLLM_TeamMembership where unique filter

            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TeamMembershipWhereInput] = None,
        cursor: Optional[types.LiteLLM_TeamMembershipWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None,
        order: Optional[Union[types.LiteLLM_TeamMembershipOrderByInput, List[types.LiteLLM_TeamMembershipOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_TeamMembershipScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_TeamMembership records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_TeamMembership records returned
        skip
            Ignore the first N results
        where
            LiteLLM_TeamMembership filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamMembership model
        order
            Order the returned LiteLLM_TeamMembership records by any field
        distinct
            Filter LiteLLM_TeamMembership records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_TeamMembership]
            The list of all LiteLLM_TeamMembership records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_TeamMembership records
        litellm_teammemberships = await LiteLLM_TeamMembership.prisma().find_many(take=10)

        # find the first 5 LiteLLM_TeamMembership records ordered by the spend field
        litellm_teammemberships = await LiteLLM_TeamMembership.prisma().find_many(
            take=5,
            order={
                'spend': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TeamMembershipWhereInput] = None,
        cursor: Optional[types.LiteLLM_TeamMembershipWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None,
        order: Optional[Union[types.LiteLLM_TeamMembershipOrderByInput, List[types.LiteLLM_TeamMembershipOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_TeamMembershipScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_TeamMembership record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_TeamMembership filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamMembership model
        order
            Order the returned LiteLLM_TeamMembership records by any field
        distinct
            Filter LiteLLM_TeamMembership records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_TeamMembership
            The first LiteLLM_TeamMembership record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_TeamMembership record ordered by the budget_id field
        litellm_teammembership = await LiteLLM_TeamMembership.prisma().find_first(
            skip=1,
            order={
                'budget_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TeamMembershipWhereInput] = None,
        cursor: Optional[types.LiteLLM_TeamMembershipWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None,
        order: Optional[Union[types.LiteLLM_TeamMembershipOrderByInput, List[types.LiteLLM_TeamMembershipOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_TeamMembershipScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_TeamMembership record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_TeamMembership filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamMembership model
        order
            Order the returned LiteLLM_TeamMembership records by any field
        distinct
            Filter LiteLLM_TeamMembership records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_TeamMembership
            The first LiteLLM_TeamMembership record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_TeamMembership record ordered by the user_id field
        litellm_teammembership = await LiteLLM_TeamMembership.prisma().find_first_or_raise(
            skip=1,
            order={
                'user_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_TeamMembershipUpdateInput,
        where: types.LiteLLM_TeamMembershipWhereUniqueInput,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_TeamMembership record.

        Parameters
        ----------
        data
            LiteLLM_TeamMembership record data specifying what to update
        where
            LiteLLM_TeamMembership filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamMembership model

        Returns
        -------
        prisma.models.LiteLLM_TeamMembership
            The updated LiteLLM_TeamMembership record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_teammembership = await LiteLLM_TeamMembership.prisma().update(
            where={
                # LiteLLM_TeamMembership where unique filter

            },
            data={
                # data to update the LiteLLM_TeamMembership record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_TeamMembershipWhereUniqueInput,
        data: types.LiteLLM_TeamMembershipUpsertInput,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_TeamMembership filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_TeamMembership model

        Returns
        -------
        prisma.models.LiteLLM_TeamMembership
            The created or updated LiteLLM_TeamMembership record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_teammembership = await LiteLLM_TeamMembership.prisma().upsert(
            where={
                # LiteLLM_TeamMembership where unique filter
            },
            data={
                'create': {
                    # LiteLLM_TeamMembership data to be set if the record does not exist
                },
                'update': {
                    # LiteLLM_TeamMembership data to be set if the record does exist
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_TeamMembershipUpdateManyMutationInput,
        where: types.LiteLLM_TeamMembershipWhereInput,
    ) -> int:
        """Update multiple LiteLLM_TeamMembership records

        Parameters
        ----------
        data
            LiteLLM_TeamMembership data to update the selected LiteLLM_TeamMembership records to
        where
            Filter to select the LiteLLM_TeamMembership records to update

        Returns
        -------
        int
            The total number of LiteLLM_TeamMembership records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_TeamMembership records
        total = await LiteLLM_TeamMembership.prisma().update_many(
            data={
                'team_id': 'jbijgfbfj'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TeamMembershipWhereInput] = None,
        cursor: Optional[types.LiteLLM_TeamMembershipWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_TeamMembership records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_TeamMembership fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_TeamMembership filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_TeamMembershipCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_TeamMembership.prisma().count()

        # results: prisma.types.LiteLLM_TeamMembershipCountAggregateOutput
        results = await LiteLLM_TeamMembership.prisma().count(
            select={
                '_all': True,
                'spend': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_TeamMembershipCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TeamMembershipWhereInput] = None,
        cursor: Optional[types.LiteLLM_TeamMembershipWhereUniqueInput] = None,
    ) -> types.LiteLLM_TeamMembershipCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_TeamMembershipCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_TeamMembershipWhereInput] = None,
        cursor: Optional[types.LiteLLM_TeamMembershipWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_TeamMembershipCountAggregateOutput]:
        """Count the number of LiteLLM_TeamMembership records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_TeamMembership fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_TeamMembership filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_TeamMembershipCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_TeamMembership.prisma().count()

        # results: prisma.types.LiteLLM_TeamMembershipCountAggregateOutput
        results = await LiteLLM_TeamMembership.prisma().count(
            select={
                '_all': True,
                'budget_id': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_TeamMembershipCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_TeamMembershipWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_TeamMembership records.

        Parameters
        ----------
        where
            Optional LiteLLM_TeamMembership filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_TeamMembership records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_TeamMembership records
        total = await LiteLLM_TeamMembership.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_TeamMembershipScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_TeamMembershipWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_TeamMembershipAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_TeamMembershipSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_TeamMembershipMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_TeamMembershipMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_TeamMembershipScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_TeamMembershipCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_TeamMembershipScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_TeamMembershipScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_TeamMembershipGroupByOutput']:
        """Group LiteLLM_TeamMembership records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_TeamMembership fields to group records by
        where
            LiteLLM_TeamMembership filter to select records
        take
            Limit the maximum number of LiteLLM_TeamMembership records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_TeamMembershipGroupByOutput]
            A list of dictionaries representing the LiteLLM_TeamMembership record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_TeamMembership records by user_id values
        # and count how many records are in each group
        results = await LiteLLM_TeamMembership.prisma().group_by(
            ['user_id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_OrganizationMembershipActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_OrganizationMembership]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_OrganizationMembership.prisma().query_raw(
            'SELECT * FROM LiteLLM_OrganizationMembership WHERE user_id = $1',
            'ggfbeddia',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_OrganizationMembership
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_OrganizationMembership.prisma().query_first(
            'SELECT * FROM LiteLLM_OrganizationMembership WHERE organization_id = $1',
            'djjejdaj',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_OrganizationMembershipCreateInput,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_OrganizationMembership record.

        Parameters
        ----------
        data
            LiteLLM_OrganizationMembership record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationMembership model

        Returns
        -------
        prisma.models.LiteLLM_OrganizationMembership
            The created LiteLLM_OrganizationMembership record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_OrganizationMembership record from just the required fields
        litellm_organizationmembership = await LiteLLM_OrganizationMembership.prisma().create(
            data={
                # data to create a LiteLLM_OrganizationMembership record
                'user_id': 'bjabbfceji',
                'organization_id': 'bgchfbjibb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_OrganizationMembershipCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_OrganizationMembership records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_OrganizationMembership record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_OrganizationMembership.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_OrganizationMembership record
                    'user_id': 'bajecchdjc',
                    'organization_id': 'dfgacajif',
                },
                {
                    # data to create a LiteLLM_OrganizationMembership record
                    'user_id': 'bgdiddfadi',
                    'organization_id': 'bijbfghhhf',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_OrganizationMembershipWhereUniqueInput,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_OrganizationMembership record.

        Parameters
        ----------
        where
            LiteLLM_OrganizationMembership filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationMembership model

        Returns
        -------
        prisma.models.LiteLLM_OrganizationMembership
            The deleted LiteLLM_OrganizationMembership record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_organizationmembership = await LiteLLM_OrganizationMembership.prisma().delete(
            where={
                # LiteLLM_OrganizationMembership where unique filter

            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_OrganizationMembershipWhereUniqueInput,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_OrganizationMembership record.

        Parameters
        ----------
        where
            LiteLLM_OrganizationMembership filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationMembership model

        Returns
        -------
        prisma.models.LiteLLM_OrganizationMembership
            The found LiteLLM_OrganizationMembership record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_organizationmembership = await LiteLLM_OrganizationMembership.prisma().find_unique(
            where={
                # LiteLLM_OrganizationMembership where unique filter

            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_OrganizationMembershipWhereUniqueInput,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_OrganizationMembership record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_OrganizationMembership filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationMembership model

        Returns
        -------
        prisma.models.LiteLLM_OrganizationMembership
            The found LiteLLM_OrganizationMembership record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_organizationmembership = await LiteLLM_OrganizationMembership.prisma().find_unique_or_raise(
            where={
                # LiteLLM_OrganizationMembership where unique filter

            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_OrganizationMembershipWhereInput] = None,
        cursor: Optional[types.LiteLLM_OrganizationMembershipWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None,
        order: Optional[Union[types.LiteLLM_OrganizationMembershipOrderByInput, List[types.LiteLLM_OrganizationMembershipOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_OrganizationMembershipScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_OrganizationMembership records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_OrganizationMembership records returned
        skip
            Ignore the first N results
        where
            LiteLLM_OrganizationMembership filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationMembership model
        order
            Order the returned LiteLLM_OrganizationMembership records by any field
        distinct
            Filter LiteLLM_OrganizationMembership records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_OrganizationMembership]
            The list of all LiteLLM_OrganizationMembership records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_OrganizationMembership records
        litellm_organizationmemberships = await LiteLLM_OrganizationMembership.prisma().find_many(take=10)

        # find the first 5 LiteLLM_OrganizationMembership records ordered by the user_role field
        litellm_organizationmemberships = await LiteLLM_OrganizationMembership.prisma().find_many(
            take=5,
            order={
                'user_role': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_OrganizationMembershipWhereInput] = None,
        cursor: Optional[types.LiteLLM_OrganizationMembershipWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None,
        order: Optional[Union[types.LiteLLM_OrganizationMembershipOrderByInput, List[types.LiteLLM_OrganizationMembershipOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_OrganizationMembershipScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_OrganizationMembership record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_OrganizationMembership filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationMembership model
        order
            Order the returned LiteLLM_OrganizationMembership records by any field
        distinct
            Filter LiteLLM_OrganizationMembership records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_OrganizationMembership
            The first LiteLLM_OrganizationMembership record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_OrganizationMembership record ordered by the spend field
        litellm_organizationmembership = await LiteLLM_OrganizationMembership.prisma().find_first(
            skip=1,
            order={
                'spend': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_OrganizationMembershipWhereInput] = None,
        cursor: Optional[types.LiteLLM_OrganizationMembershipWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None,
        order: Optional[Union[types.LiteLLM_OrganizationMembershipOrderByInput, List[types.LiteLLM_OrganizationMembershipOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_OrganizationMembershipScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_OrganizationMembership record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_OrganizationMembership filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationMembership model
        order
            Order the returned LiteLLM_OrganizationMembership records by any field
        distinct
            Filter LiteLLM_OrganizationMembership records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_OrganizationMembership
            The first LiteLLM_OrganizationMembership record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_OrganizationMembership record ordered by the budget_id field
        litellm_organizationmembership = await LiteLLM_OrganizationMembership.prisma().find_first_or_raise(
            skip=1,
            order={
                'budget_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_OrganizationMembershipUpdateInput,
        where: types.LiteLLM_OrganizationMembershipWhereUniqueInput,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_OrganizationMembership record.

        Parameters
        ----------
        data
            LiteLLM_OrganizationMembership record data specifying what to update
        where
            LiteLLM_OrganizationMembership filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationMembership model

        Returns
        -------
        prisma.models.LiteLLM_OrganizationMembership
            The updated LiteLLM_OrganizationMembership record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_organizationmembership = await LiteLLM_OrganizationMembership.prisma().update(
            where={
                # LiteLLM_OrganizationMembership where unique filter

            },
            data={
                # data to update the LiteLLM_OrganizationMembership record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_OrganizationMembershipWhereUniqueInput,
        data: types.LiteLLM_OrganizationMembershipUpsertInput,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_OrganizationMembership filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_OrganizationMembership model

        Returns
        -------
        prisma.models.LiteLLM_OrganizationMembership
            The created or updated LiteLLM_OrganizationMembership record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_organizationmembership = await LiteLLM_OrganizationMembership.prisma().upsert(
            where={
                # LiteLLM_OrganizationMembership where unique filter
            },
            data={
                'create': {
                    # LiteLLM_OrganizationMembership data to be set if the record does not exist
                },
                'update': {
                    # LiteLLM_OrganizationMembership data to be set if the record does exist
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_OrganizationMembershipUpdateManyMutationInput,
        where: types.LiteLLM_OrganizationMembershipWhereInput,
    ) -> int:
        """Update multiple LiteLLM_OrganizationMembership records

        Parameters
        ----------
        data
            LiteLLM_OrganizationMembership data to update the selected LiteLLM_OrganizationMembership records to
        where
            Filter to select the LiteLLM_OrganizationMembership records to update

        Returns
        -------
        int
            The total number of LiteLLM_OrganizationMembership records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_OrganizationMembership records
        total = await LiteLLM_OrganizationMembership.prisma().update_many(
            data={
                'created_at': datetime.datetime.utcnow()
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_OrganizationMembershipWhereInput] = None,
        cursor: Optional[types.LiteLLM_OrganizationMembershipWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_OrganizationMembership records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_OrganizationMembership fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_OrganizationMembership filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_OrganizationMembershipCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_OrganizationMembership.prisma().count()

        # results: prisma.types.LiteLLM_OrganizationMembershipCountAggregateOutput
        results = await LiteLLM_OrganizationMembership.prisma().count(
            select={
                '_all': True,
                'updated_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_OrganizationMembershipCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_OrganizationMembershipWhereInput] = None,
        cursor: Optional[types.LiteLLM_OrganizationMembershipWhereUniqueInput] = None,
    ) -> types.LiteLLM_OrganizationMembershipCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_OrganizationMembershipCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_OrganizationMembershipWhereInput] = None,
        cursor: Optional[types.LiteLLM_OrganizationMembershipWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_OrganizationMembershipCountAggregateOutput]:
        """Count the number of LiteLLM_OrganizationMembership records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_OrganizationMembership fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_OrganizationMembership filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_OrganizationMembershipCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_OrganizationMembership.prisma().count()

        # results: prisma.types.LiteLLM_OrganizationMembershipCountAggregateOutput
        results = await LiteLLM_OrganizationMembership.prisma().count(
            select={
                '_all': True,
                'user_id': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_OrganizationMembershipCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_OrganizationMembershipWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_OrganizationMembership records.

        Parameters
        ----------
        where
            Optional LiteLLM_OrganizationMembership filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_OrganizationMembership records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_OrganizationMembership records
        total = await LiteLLM_OrganizationMembership.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_OrganizationMembershipScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_OrganizationMembershipWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_OrganizationMembershipAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_OrganizationMembershipSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_OrganizationMembershipMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_OrganizationMembershipMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_OrganizationMembershipScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_OrganizationMembershipCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_OrganizationMembershipScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_OrganizationMembershipScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_OrganizationMembershipGroupByOutput']:
        """Group LiteLLM_OrganizationMembership records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_OrganizationMembership fields to group records by
        where
            LiteLLM_OrganizationMembership filter to select records
        take
            Limit the maximum number of LiteLLM_OrganizationMembership records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_OrganizationMembershipGroupByOutput]
            A list of dictionaries representing the LiteLLM_OrganizationMembership record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_OrganizationMembership records by organization_id values
        # and count how many records are in each group
        results = await LiteLLM_OrganizationMembership.prisma().group_by(
            ['organization_id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_InvitationLinkActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_InvitationLink]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_InvitationLink.prisma().query_raw(
            'SELECT * FROM LiteLLM_InvitationLink WHERE id = $1',
            'bahchhihdc',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_InvitationLink
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_InvitationLink.prisma().query_first(
            'SELECT * FROM LiteLLM_InvitationLink WHERE user_id = $1',
            'bihjdcibib',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_InvitationLinkCreateInput,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_InvitationLink record.

        Parameters
        ----------
        data
            LiteLLM_InvitationLink record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_InvitationLink model

        Returns
        -------
        prisma.models.LiteLLM_InvitationLink
            The created LiteLLM_InvitationLink record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_InvitationLink record from just the required fields
        litellm_invitationlink = await LiteLLM_InvitationLink.prisma().create(
            data={
                # data to create a LiteLLM_InvitationLink record
                'user_id': 'bfhhjbbdha',
                'expires_at': datetime.datetime.utcnow(),
                'created_at': datetime.datetime.utcnow(),
                'created_by': 'faehcjfdb',
                'updated_at': datetime.datetime.utcnow(),
                'updated_by': 'bbaiefbee',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_InvitationLinkCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_InvitationLink records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_InvitationLink record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_InvitationLink.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_InvitationLink record
                    'user_id': 'bdaacgjbaf',
                    'expires_at': datetime.datetime.utcnow(),
                    'created_at': datetime.datetime.utcnow(),
                    'created_by': 'biibaighec',
                    'updated_at': datetime.datetime.utcnow(),
                    'updated_by': 'baicdfeidj',
                },
                {
                    # data to create a LiteLLM_InvitationLink record
                    'user_id': 'befgiciadg',
                    'expires_at': datetime.datetime.utcnow(),
                    'created_at': datetime.datetime.utcnow(),
                    'created_by': 'cbcehahedh',
                    'updated_at': datetime.datetime.utcnow(),
                    'updated_by': 'bcjihiaide',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_InvitationLinkWhereUniqueInput,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_InvitationLink record.

        Parameters
        ----------
        where
            LiteLLM_InvitationLink filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_InvitationLink model

        Returns
        -------
        prisma.models.LiteLLM_InvitationLink
            The deleted LiteLLM_InvitationLink record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_invitationlink = await LiteLLM_InvitationLink.prisma().delete(
            where={
                'id': 'bagfijcgfj',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_InvitationLinkWhereUniqueInput,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_InvitationLink record.

        Parameters
        ----------
        where
            LiteLLM_InvitationLink filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_InvitationLink model

        Returns
        -------
        prisma.models.LiteLLM_InvitationLink
            The found LiteLLM_InvitationLink record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_invitationlink = await LiteLLM_InvitationLink.prisma().find_unique(
            where={
                'id': 'bcggehiidc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_InvitationLinkWhereUniqueInput,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_InvitationLink record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_InvitationLink filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_InvitationLink model

        Returns
        -------
        prisma.models.LiteLLM_InvitationLink
            The found LiteLLM_InvitationLink record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_invitationlink = await LiteLLM_InvitationLink.prisma().find_unique_or_raise(
            where={
                'id': 'bjcdacgacf',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_InvitationLinkWhereInput] = None,
        cursor: Optional[types.LiteLLM_InvitationLinkWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None,
        order: Optional[Union[types.LiteLLM_InvitationLinkOrderByInput, List[types.LiteLLM_InvitationLinkOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_InvitationLinkScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_InvitationLink records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_InvitationLink records returned
        skip
            Ignore the first N results
        where
            LiteLLM_InvitationLink filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_InvitationLink model
        order
            Order the returned LiteLLM_InvitationLink records by any field
        distinct
            Filter LiteLLM_InvitationLink records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_InvitationLink]
            The list of all LiteLLM_InvitationLink records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_InvitationLink records
        litellm_invitationlinks = await LiteLLM_InvitationLink.prisma().find_many(take=10)

        # find the first 5 LiteLLM_InvitationLink records ordered by the is_accepted field
        litellm_invitationlinks = await LiteLLM_InvitationLink.prisma().find_many(
            take=5,
            order={
                'is_accepted': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_InvitationLinkWhereInput] = None,
        cursor: Optional[types.LiteLLM_InvitationLinkWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None,
        order: Optional[Union[types.LiteLLM_InvitationLinkOrderByInput, List[types.LiteLLM_InvitationLinkOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_InvitationLinkScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_InvitationLink record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_InvitationLink filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_InvitationLink model
        order
            Order the returned LiteLLM_InvitationLink records by any field
        distinct
            Filter LiteLLM_InvitationLink records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_InvitationLink
            The first LiteLLM_InvitationLink record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_InvitationLink record ordered by the accepted_at field
        litellm_invitationlink = await LiteLLM_InvitationLink.prisma().find_first(
            skip=1,
            order={
                'accepted_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_InvitationLinkWhereInput] = None,
        cursor: Optional[types.LiteLLM_InvitationLinkWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None,
        order: Optional[Union[types.LiteLLM_InvitationLinkOrderByInput, List[types.LiteLLM_InvitationLinkOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_InvitationLinkScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_InvitationLink record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_InvitationLink filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_InvitationLink model
        order
            Order the returned LiteLLM_InvitationLink records by any field
        distinct
            Filter LiteLLM_InvitationLink records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_InvitationLink
            The first LiteLLM_InvitationLink record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_InvitationLink record ordered by the expires_at field
        litellm_invitationlink = await LiteLLM_InvitationLink.prisma().find_first_or_raise(
            skip=1,
            order={
                'expires_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_InvitationLinkUpdateInput,
        where: types.LiteLLM_InvitationLinkWhereUniqueInput,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_InvitationLink record.

        Parameters
        ----------
        data
            LiteLLM_InvitationLink record data specifying what to update
        where
            LiteLLM_InvitationLink filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_InvitationLink model

        Returns
        -------
        prisma.models.LiteLLM_InvitationLink
            The updated LiteLLM_InvitationLink record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_invitationlink = await LiteLLM_InvitationLink.prisma().update(
            where={
                'id': 'jfieeahi',
            },
            data={
                # data to update the LiteLLM_InvitationLink record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_InvitationLinkWhereUniqueInput,
        data: types.LiteLLM_InvitationLinkUpsertInput,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_InvitationLink filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_InvitationLink model

        Returns
        -------
        prisma.models.LiteLLM_InvitationLink
            The created or updated LiteLLM_InvitationLink record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_invitationlink = await LiteLLM_InvitationLink.prisma().upsert(
            where={
                'id': 'bijfjbddfj',
            },
            data={
                'create': {
                    'id': 'bijfjbddfj',
                    'user_id': 'befgiciadg',
                    'expires_at': datetime.datetime.utcnow(),
                    'created_at': datetime.datetime.utcnow(),
                    'created_by': 'cbcehahedh',
                    'updated_at': datetime.datetime.utcnow(),
                    'updated_by': 'bcjihiaide',
                },
                'update': {
                    'user_id': 'befgiciadg',
                    'expires_at': datetime.datetime.utcnow(),
                    'created_at': datetime.datetime.utcnow(),
                    'created_by': 'cbcehahedh',
                    'updated_at': datetime.datetime.utcnow(),
                    'updated_by': 'bcjihiaide',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_InvitationLinkUpdateManyMutationInput,
        where: types.LiteLLM_InvitationLinkWhereInput,
    ) -> int:
        """Update multiple LiteLLM_InvitationLink records

        Parameters
        ----------
        data
            LiteLLM_InvitationLink data to update the selected LiteLLM_InvitationLink records to
        where
            Filter to select the LiteLLM_InvitationLink records to update

        Returns
        -------
        int
            The total number of LiteLLM_InvitationLink records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_InvitationLink records
        total = await LiteLLM_InvitationLink.prisma().update_many(
            data={
                'created_at': datetime.datetime.utcnow()
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_InvitationLinkWhereInput] = None,
        cursor: Optional[types.LiteLLM_InvitationLinkWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_InvitationLink records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_InvitationLink fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_InvitationLink filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_InvitationLinkCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_InvitationLink.prisma().count()

        # results: prisma.types.LiteLLM_InvitationLinkCountAggregateOutput
        results = await LiteLLM_InvitationLink.prisma().count(
            select={
                '_all': True,
                'created_by': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_InvitationLinkCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_InvitationLinkWhereInput] = None,
        cursor: Optional[types.LiteLLM_InvitationLinkWhereUniqueInput] = None,
    ) -> types.LiteLLM_InvitationLinkCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_InvitationLinkCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_InvitationLinkWhereInput] = None,
        cursor: Optional[types.LiteLLM_InvitationLinkWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_InvitationLinkCountAggregateOutput]:
        """Count the number of LiteLLM_InvitationLink records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_InvitationLink fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_InvitationLink filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_InvitationLinkCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_InvitationLink.prisma().count()

        # results: prisma.types.LiteLLM_InvitationLinkCountAggregateOutput
        results = await LiteLLM_InvitationLink.prisma().count(
            select={
                '_all': True,
                'updated_at': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_InvitationLinkCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_InvitationLinkWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_InvitationLink records.

        Parameters
        ----------
        where
            Optional LiteLLM_InvitationLink filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_InvitationLink records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_InvitationLink records
        total = await LiteLLM_InvitationLink.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_InvitationLinkScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_InvitationLinkWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_InvitationLinkAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_InvitationLinkSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_InvitationLinkMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_InvitationLinkMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_InvitationLinkScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_InvitationLinkCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_InvitationLinkScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_InvitationLinkScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_InvitationLinkGroupByOutput']:
        """Group LiteLLM_InvitationLink records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_InvitationLink fields to group records by
        where
            LiteLLM_InvitationLink filter to select records
        take
            Limit the maximum number of LiteLLM_InvitationLink records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_InvitationLinkGroupByOutput]
            A list of dictionaries representing the LiteLLM_InvitationLink record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_InvitationLink records by updated_by values
        # and count how many records are in each group
        results = await LiteLLM_InvitationLink.prisma().group_by(
            ['updated_by'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_AuditLogActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_AuditLog]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_AuditLog.prisma().query_raw(
            'SELECT * FROM LiteLLM_AuditLog WHERE id = $1',
            'cdcdjdcee',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_AuditLog
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_AuditLog.prisma().query_first(
            'SELECT * FROM LiteLLM_AuditLog WHERE updated_at = $1',
            datetime.datetime.utcnow(),
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_AuditLogCreateInput,
        include: Optional[types.LiteLLM_AuditLogInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_AuditLog record.

        Parameters
        ----------
        data
            LiteLLM_AuditLog record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_AuditLog model

        Returns
        -------
        prisma.models.LiteLLM_AuditLog
            The created LiteLLM_AuditLog record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_AuditLog record from just the required fields
        litellm_auditlog = await LiteLLM_AuditLog.prisma().create(
            data={
                # data to create a LiteLLM_AuditLog record
                'action': 'bbbgjdbgcb',
                'table_name': 'bcedacgecg',
                'object_id': 'cbdffjeh',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_AuditLogCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_AuditLog records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_AuditLog record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_AuditLog.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_AuditLog record
                    'action': 'idbcdhbci',
                    'table_name': 'bacegehahd',
                    'object_id': 'ebedeihec',
                },
                {
                    # data to create a LiteLLM_AuditLog record
                    'action': 'bajagjdfbb',
                    'table_name': 'bggedbjggi',
                    'object_id': 'hgbafifcf',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_AuditLogWhereUniqueInput,
        include: Optional[types.LiteLLM_AuditLogInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_AuditLog record.

        Parameters
        ----------
        where
            LiteLLM_AuditLog filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_AuditLog model

        Returns
        -------
        prisma.models.LiteLLM_AuditLog
            The deleted LiteLLM_AuditLog record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_auditlog = await LiteLLM_AuditLog.prisma().delete(
            where={
                'id': 'bejiecfecg',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_AuditLogWhereUniqueInput,
        include: Optional[types.LiteLLM_AuditLogInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_AuditLog record.

        Parameters
        ----------
        where
            LiteLLM_AuditLog filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_AuditLog model

        Returns
        -------
        prisma.models.LiteLLM_AuditLog
            The found LiteLLM_AuditLog record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_auditlog = await LiteLLM_AuditLog.prisma().find_unique(
            where={
                'id': 'bjgacaeagh',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_AuditLogWhereUniqueInput,
        include: Optional[types.LiteLLM_AuditLogInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_AuditLog record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_AuditLog filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_AuditLog model

        Returns
        -------
        prisma.models.LiteLLM_AuditLog
            The found LiteLLM_AuditLog record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_auditlog = await LiteLLM_AuditLog.prisma().find_unique_or_raise(
            where={
                'id': 'beeaihbefg',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AuditLogWhereInput] = None,
        cursor: Optional[types.LiteLLM_AuditLogWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_AuditLogInclude] = None,
        order: Optional[Union[types.LiteLLM_AuditLogOrderByInput, List[types.LiteLLM_AuditLogOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_AuditLogScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_AuditLog records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_AuditLog records returned
        skip
            Ignore the first N results
        where
            LiteLLM_AuditLog filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_AuditLog model
        order
            Order the returned LiteLLM_AuditLog records by any field
        distinct
            Filter LiteLLM_AuditLog records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_AuditLog]
            The list of all LiteLLM_AuditLog records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_AuditLog records
        litellm_auditlogs = await LiteLLM_AuditLog.prisma().find_many(take=10)

        # find the first 5 LiteLLM_AuditLog records ordered by the changed_by field
        litellm_auditlogs = await LiteLLM_AuditLog.prisma().find_many(
            take=5,
            order={
                'changed_by': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AuditLogWhereInput] = None,
        cursor: Optional[types.LiteLLM_AuditLogWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_AuditLogInclude] = None,
        order: Optional[Union[types.LiteLLM_AuditLogOrderByInput, List[types.LiteLLM_AuditLogOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_AuditLogScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_AuditLog record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_AuditLog filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_AuditLog model
        order
            Order the returned LiteLLM_AuditLog records by any field
        distinct
            Filter LiteLLM_AuditLog records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_AuditLog
            The first LiteLLM_AuditLog record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_AuditLog record ordered by the changed_by_api_key field
        litellm_auditlog = await LiteLLM_AuditLog.prisma().find_first(
            skip=1,
            order={
                'changed_by_api_key': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AuditLogWhereInput] = None,
        cursor: Optional[types.LiteLLM_AuditLogWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_AuditLogInclude] = None,
        order: Optional[Union[types.LiteLLM_AuditLogOrderByInput, List[types.LiteLLM_AuditLogOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_AuditLogScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_AuditLog record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_AuditLog filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_AuditLog model
        order
            Order the returned LiteLLM_AuditLog records by any field
        distinct
            Filter LiteLLM_AuditLog records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_AuditLog
            The first LiteLLM_AuditLog record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_AuditLog record ordered by the action field
        litellm_auditlog = await LiteLLM_AuditLog.prisma().find_first_or_raise(
            skip=1,
            order={
                'action': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_AuditLogUpdateInput,
        where: types.LiteLLM_AuditLogWhereUniqueInput,
        include: Optional[types.LiteLLM_AuditLogInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_AuditLog record.

        Parameters
        ----------
        data
            LiteLLM_AuditLog record data specifying what to update
        where
            LiteLLM_AuditLog filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_AuditLog model

        Returns
        -------
        prisma.models.LiteLLM_AuditLog
            The updated LiteLLM_AuditLog record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_auditlog = await LiteLLM_AuditLog.prisma().update(
            where={
                'id': 'bfbfgeddfd',
            },
            data={
                # data to update the LiteLLM_AuditLog record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_AuditLogWhereUniqueInput,
        data: types.LiteLLM_AuditLogUpsertInput,
        include: Optional[types.LiteLLM_AuditLogInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_AuditLog filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_AuditLog model

        Returns
        -------
        prisma.models.LiteLLM_AuditLog
            The created or updated LiteLLM_AuditLog record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_auditlog = await LiteLLM_AuditLog.prisma().upsert(
            where={
                'id': 'jbgheibja',
            },
            data={
                'create': {
                    'id': 'jbgheibja',
                    'action': 'bajagjdfbb',
                    'table_name': 'bggedbjggi',
                    'object_id': 'hgbafifcf',
                },
                'update': {
                    'action': 'bajagjdfbb',
                    'table_name': 'bggedbjggi',
                    'object_id': 'hgbafifcf',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_AuditLogUpdateManyMutationInput,
        where: types.LiteLLM_AuditLogWhereInput,
    ) -> int:
        """Update multiple LiteLLM_AuditLog records

        Parameters
        ----------
        data
            LiteLLM_AuditLog data to update the selected LiteLLM_AuditLog records to
        where
            Filter to select the LiteLLM_AuditLog records to update

        Returns
        -------
        int
            The total number of LiteLLM_AuditLog records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_AuditLog records
        total = await LiteLLM_AuditLog.prisma().update_many(
            data={
                'table_name': 'eejajbid'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AuditLogWhereInput] = None,
        cursor: Optional[types.LiteLLM_AuditLogWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_AuditLog records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_AuditLog fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_AuditLog filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_AuditLogCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_AuditLog.prisma().count()

        # results: prisma.types.LiteLLM_AuditLogCountAggregateOutput
        results = await LiteLLM_AuditLog.prisma().count(
            select={
                '_all': True,
                'object_id': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_AuditLogCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AuditLogWhereInput] = None,
        cursor: Optional[types.LiteLLM_AuditLogWhereUniqueInput] = None,
    ) -> types.LiteLLM_AuditLogCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_AuditLogCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AuditLogWhereInput] = None,
        cursor: Optional[types.LiteLLM_AuditLogWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_AuditLogCountAggregateOutput]:
        """Count the number of LiteLLM_AuditLog records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_AuditLog fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_AuditLog filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_AuditLogCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_AuditLog.prisma().count()

        # results: prisma.types.LiteLLM_AuditLogCountAggregateOutput
        results = await LiteLLM_AuditLog.prisma().count(
            select={
                '_all': True,
                'before_value': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_AuditLogCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_AuditLogWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_AuditLog records.

        Parameters
        ----------
        where
            Optional LiteLLM_AuditLog filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_AuditLog records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_AuditLog records
        total = await LiteLLM_AuditLog.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_AuditLogScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_AuditLogWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_AuditLogAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_AuditLogSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_AuditLogMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_AuditLogMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_AuditLogScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_AuditLogCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_AuditLogScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_AuditLogScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_AuditLogGroupByOutput']:
        """Group LiteLLM_AuditLog records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_AuditLog fields to group records by
        where
            LiteLLM_AuditLog filter to select records
        take
            Limit the maximum number of LiteLLM_AuditLog records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_AuditLogGroupByOutput]
            A list of dictionaries representing the LiteLLM_AuditLog record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_AuditLog records by updated_values values
        # and count how many records are in each group
        results = await LiteLLM_AuditLog.prisma().group_by(
            ['updated_values'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_DailyUserSpendActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_DailyUserSpend]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_DailyUserSpend.prisma().query_raw(
            'SELECT * FROM LiteLLM_DailyUserSpend WHERE id = $1',
            'efhdcdaie',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_DailyUserSpend
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_DailyUserSpend.prisma().query_first(
            'SELECT * FROM LiteLLM_DailyUserSpend WHERE user_id = $1',
            'cadejecgbd',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_DailyUserSpendCreateInput,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_DailyUserSpend record.

        Parameters
        ----------
        data
            LiteLLM_DailyUserSpend record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyUserSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyUserSpend
            The created LiteLLM_DailyUserSpend record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_DailyUserSpend record from just the required fields
        litellm_dailyuserspend = await LiteLLM_DailyUserSpend.prisma().create(
            data={
                # data to create a LiteLLM_DailyUserSpend record
                'date': 'bahjhjjhcc',
                'api_key': 'ebhbhbdff',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_DailyUserSpendCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_DailyUserSpend records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_DailyUserSpend record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_DailyUserSpend.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_DailyUserSpend record
                    'date': 'bdiefcdfhg',
                    'api_key': 'cheifeghd',
                },
                {
                    # data to create a LiteLLM_DailyUserSpend record
                    'date': 'fgijheefe',
                    'api_key': 'hcbgbhfch',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_DailyUserSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_DailyUserSpend record.

        Parameters
        ----------
        where
            LiteLLM_DailyUserSpend filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyUserSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyUserSpend
            The deleted LiteLLM_DailyUserSpend record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyuserspend = await LiteLLM_DailyUserSpend.prisma().delete(
            where={
                'id': 'bfbbbgbfhc',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_DailyUserSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_DailyUserSpend record.

        Parameters
        ----------
        where
            LiteLLM_DailyUserSpend filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyUserSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyUserSpend
            The found LiteLLM_DailyUserSpend record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyuserspend = await LiteLLM_DailyUserSpend.prisma().find_unique(
            where={
                'id': 'ibijjdeb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_DailyUserSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_DailyUserSpend record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_DailyUserSpend filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyUserSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyUserSpend
            The found LiteLLM_DailyUserSpend record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyuserspend = await LiteLLM_DailyUserSpend.prisma().find_unique_or_raise(
            where={
                'id': 'caehiccddi',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyUserSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyUserSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyUserSpendOrderByInput, List[types.LiteLLM_DailyUserSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyUserSpendScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_DailyUserSpend records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_DailyUserSpend records returned
        skip
            Ignore the first N results
        where
            LiteLLM_DailyUserSpend filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyUserSpend model
        order
            Order the returned LiteLLM_DailyUserSpend records by any field
        distinct
            Filter LiteLLM_DailyUserSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_DailyUserSpend]
            The list of all LiteLLM_DailyUserSpend records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_DailyUserSpend records
        litellm_dailyuserspends = await LiteLLM_DailyUserSpend.prisma().find_many(take=10)

        # find the first 5 LiteLLM_DailyUserSpend records ordered by the date field
        litellm_dailyuserspends = await LiteLLM_DailyUserSpend.prisma().find_many(
            take=5,
            order={
                'date': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyUserSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyUserSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyUserSpendOrderByInput, List[types.LiteLLM_DailyUserSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyUserSpendScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_DailyUserSpend record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyUserSpend filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyUserSpend model
        order
            Order the returned LiteLLM_DailyUserSpend records by any field
        distinct
            Filter LiteLLM_DailyUserSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyUserSpend
            The first LiteLLM_DailyUserSpend record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyUserSpend record ordered by the api_key field
        litellm_dailyuserspend = await LiteLLM_DailyUserSpend.prisma().find_first(
            skip=1,
            order={
                'api_key': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyUserSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyUserSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyUserSpendOrderByInput, List[types.LiteLLM_DailyUserSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyUserSpendScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_DailyUserSpend record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyUserSpend filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyUserSpend model
        order
            Order the returned LiteLLM_DailyUserSpend records by any field
        distinct
            Filter LiteLLM_DailyUserSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyUserSpend
            The first LiteLLM_DailyUserSpend record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyUserSpend record ordered by the model field
        litellm_dailyuserspend = await LiteLLM_DailyUserSpend.prisma().find_first_or_raise(
            skip=1,
            order={
                'model': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_DailyUserSpendUpdateInput,
        where: types.LiteLLM_DailyUserSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_DailyUserSpend record.

        Parameters
        ----------
        data
            LiteLLM_DailyUserSpend record data specifying what to update
        where
            LiteLLM_DailyUserSpend filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyUserSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyUserSpend
            The updated LiteLLM_DailyUserSpend record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_dailyuserspend = await LiteLLM_DailyUserSpend.prisma().update(
            where={
                'id': 'bgcahjbafj',
            },
            data={
                # data to update the LiteLLM_DailyUserSpend record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_DailyUserSpendWhereUniqueInput,
        data: types.LiteLLM_DailyUserSpendUpsertInput,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_DailyUserSpend filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyUserSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyUserSpend
            The created or updated LiteLLM_DailyUserSpend record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyuserspend = await LiteLLM_DailyUserSpend.prisma().upsert(
            where={
                'id': 'bihhgeihca',
            },
            data={
                'create': {
                    'id': 'bihhgeihca',
                    'date': 'fgijheefe',
                    'api_key': 'hcbgbhfch',
                },
                'update': {
                    'date': 'fgijheefe',
                    'api_key': 'hcbgbhfch',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_DailyUserSpendUpdateManyMutationInput,
        where: types.LiteLLM_DailyUserSpendWhereInput,
    ) -> int:
        """Update multiple LiteLLM_DailyUserSpend records

        Parameters
        ----------
        data
            LiteLLM_DailyUserSpend data to update the selected LiteLLM_DailyUserSpend records to
        where
            Filter to select the LiteLLM_DailyUserSpend records to update

        Returns
        -------
        int
            The total number of LiteLLM_DailyUserSpend records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_DailyUserSpend records
        total = await LiteLLM_DailyUserSpend.prisma().update_many(
            data={
                'model_group': 'bdgbfahbef'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyUserSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyUserSpendWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_DailyUserSpend records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyUserSpend fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyUserSpend filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyUserSpendCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyUserSpend.prisma().count()

        # results: prisma.types.LiteLLM_DailyUserSpendCountAggregateOutput
        results = await LiteLLM_DailyUserSpend.prisma().count(
            select={
                '_all': True,
                'custom_llm_provider': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_DailyUserSpendCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyUserSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyUserSpendWhereUniqueInput] = None,
    ) -> types.LiteLLM_DailyUserSpendCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_DailyUserSpendCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyUserSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyUserSpendWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_DailyUserSpendCountAggregateOutput]:
        """Count the number of LiteLLM_DailyUserSpend records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyUserSpend fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyUserSpend filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyUserSpendCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyUserSpend.prisma().count()

        # results: prisma.types.LiteLLM_DailyUserSpendCountAggregateOutput
        results = await LiteLLM_DailyUserSpend.prisma().count(
            select={
                '_all': True,
                'mcp_namespaced_tool_name': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_DailyUserSpendCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_DailyUserSpendWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_DailyUserSpend records.

        Parameters
        ----------
        where
            Optional LiteLLM_DailyUserSpend filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_DailyUserSpend records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_DailyUserSpend records
        total = await LiteLLM_DailyUserSpend.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_DailyUserSpendScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_DailyUserSpendWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_DailyUserSpendAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_DailyUserSpendSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_DailyUserSpendMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_DailyUserSpendMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_DailyUserSpendScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_DailyUserSpendCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_DailyUserSpendScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_DailyUserSpendScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_DailyUserSpendGroupByOutput']:
        """Group LiteLLM_DailyUserSpend records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_DailyUserSpend fields to group records by
        where
            LiteLLM_DailyUserSpend filter to select records
        take
            Limit the maximum number of LiteLLM_DailyUserSpend records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_DailyUserSpendGroupByOutput]
            A list of dictionaries representing the LiteLLM_DailyUserSpend record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_DailyUserSpend records by endpoint values
        # and count how many records are in each group
        results = await LiteLLM_DailyUserSpend.prisma().group_by(
            ['endpoint'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_DailyOrganizationSpendActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_DailyOrganizationSpend]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_DailyOrganizationSpend.prisma().query_raw(
            'SELECT * FROM LiteLLM_DailyOrganizationSpend WHERE id = $1',
            'fccjhidic',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_DailyOrganizationSpend
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_DailyOrganizationSpend.prisma().query_first(
            'SELECT * FROM LiteLLM_DailyOrganizationSpend WHERE organization_id = $1',
            'bdgfdgdaff',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_DailyOrganizationSpendCreateInput,
        include: Optional[types.LiteLLM_DailyOrganizationSpendInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_DailyOrganizationSpend record.

        Parameters
        ----------
        data
            LiteLLM_DailyOrganizationSpend record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyOrganizationSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyOrganizationSpend
            The created LiteLLM_DailyOrganizationSpend record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_DailyOrganizationSpend record from just the required fields
        litellm_dailyorganizationspend = await LiteLLM_DailyOrganizationSpend.prisma().create(
            data={
                # data to create a LiteLLM_DailyOrganizationSpend record
                'date': 'bicgeaiaga',
                'api_key': 'fajhhafab',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_DailyOrganizationSpendCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_DailyOrganizationSpend records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_DailyOrganizationSpend record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_DailyOrganizationSpend.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_DailyOrganizationSpend record
                    'date': 'bfeiccieec',
                    'api_key': 'hciegiihf',
                },
                {
                    # data to create a LiteLLM_DailyOrganizationSpend record
                    'date': 'bahifjfga',
                    'api_key': 'baebfehjaf',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_DailyOrganizationSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyOrganizationSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_DailyOrganizationSpend record.

        Parameters
        ----------
        where
            LiteLLM_DailyOrganizationSpend filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyOrganizationSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyOrganizationSpend
            The deleted LiteLLM_DailyOrganizationSpend record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyorganizationspend = await LiteLLM_DailyOrganizationSpend.prisma().delete(
            where={
                'id': 'bjchdacjfa',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_DailyOrganizationSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyOrganizationSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_DailyOrganizationSpend record.

        Parameters
        ----------
        where
            LiteLLM_DailyOrganizationSpend filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyOrganizationSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyOrganizationSpend
            The found LiteLLM_DailyOrganizationSpend record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyorganizationspend = await LiteLLM_DailyOrganizationSpend.prisma().find_unique(
            where={
                'id': 'fcadcaihb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_DailyOrganizationSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyOrganizationSpendInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_DailyOrganizationSpend record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_DailyOrganizationSpend filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyOrganizationSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyOrganizationSpend
            The found LiteLLM_DailyOrganizationSpend record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyorganizationspend = await LiteLLM_DailyOrganizationSpend.prisma().find_unique_or_raise(
            where={
                'id': 'bbdcibggga',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyOrganizationSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyOrganizationSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyOrganizationSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyOrganizationSpendOrderByInput, List[types.LiteLLM_DailyOrganizationSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyOrganizationSpendScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_DailyOrganizationSpend records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_DailyOrganizationSpend records returned
        skip
            Ignore the first N results
        where
            LiteLLM_DailyOrganizationSpend filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyOrganizationSpend model
        order
            Order the returned LiteLLM_DailyOrganizationSpend records by any field
        distinct
            Filter LiteLLM_DailyOrganizationSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_DailyOrganizationSpend]
            The list of all LiteLLM_DailyOrganizationSpend records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_DailyOrganizationSpend records
        litellm_dailyorganizationspends = await LiteLLM_DailyOrganizationSpend.prisma().find_many(take=10)

        # find the first 5 LiteLLM_DailyOrganizationSpend records ordered by the date field
        litellm_dailyorganizationspends = await LiteLLM_DailyOrganizationSpend.prisma().find_many(
            take=5,
            order={
                'date': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyOrganizationSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyOrganizationSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyOrganizationSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyOrganizationSpendOrderByInput, List[types.LiteLLM_DailyOrganizationSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyOrganizationSpendScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_DailyOrganizationSpend record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyOrganizationSpend filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyOrganizationSpend model
        order
            Order the returned LiteLLM_DailyOrganizationSpend records by any field
        distinct
            Filter LiteLLM_DailyOrganizationSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyOrganizationSpend
            The first LiteLLM_DailyOrganizationSpend record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyOrganizationSpend record ordered by the api_key field
        litellm_dailyorganizationspend = await LiteLLM_DailyOrganizationSpend.prisma().find_first(
            skip=1,
            order={
                'api_key': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyOrganizationSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyOrganizationSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyOrganizationSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyOrganizationSpendOrderByInput, List[types.LiteLLM_DailyOrganizationSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyOrganizationSpendScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_DailyOrganizationSpend record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyOrganizationSpend filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyOrganizationSpend model
        order
            Order the returned LiteLLM_DailyOrganizationSpend records by any field
        distinct
            Filter LiteLLM_DailyOrganizationSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyOrganizationSpend
            The first LiteLLM_DailyOrganizationSpend record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyOrganizationSpend record ordered by the model field
        litellm_dailyorganizationspend = await LiteLLM_DailyOrganizationSpend.prisma().find_first_or_raise(
            skip=1,
            order={
                'model': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_DailyOrganizationSpendUpdateInput,
        where: types.LiteLLM_DailyOrganizationSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyOrganizationSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_DailyOrganizationSpend record.

        Parameters
        ----------
        data
            LiteLLM_DailyOrganizationSpend record data specifying what to update
        where
            LiteLLM_DailyOrganizationSpend filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyOrganizationSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyOrganizationSpend
            The updated LiteLLM_DailyOrganizationSpend record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_dailyorganizationspend = await LiteLLM_DailyOrganizationSpend.prisma().update(
            where={
                'id': 'bagbibfheb',
            },
            data={
                # data to update the LiteLLM_DailyOrganizationSpend record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_DailyOrganizationSpendWhereUniqueInput,
        data: types.LiteLLM_DailyOrganizationSpendUpsertInput,
        include: Optional[types.LiteLLM_DailyOrganizationSpendInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_DailyOrganizationSpend filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyOrganizationSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyOrganizationSpend
            The created or updated LiteLLM_DailyOrganizationSpend record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyorganizationspend = await LiteLLM_DailyOrganizationSpend.prisma().upsert(
            where={
                'id': 'bidgcabjag',
            },
            data={
                'create': {
                    'id': 'bidgcabjag',
                    'date': 'bahifjfga',
                    'api_key': 'baebfehjaf',
                },
                'update': {
                    'date': 'bahifjfga',
                    'api_key': 'baebfehjaf',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_DailyOrganizationSpendUpdateManyMutationInput,
        where: types.LiteLLM_DailyOrganizationSpendWhereInput,
    ) -> int:
        """Update multiple LiteLLM_DailyOrganizationSpend records

        Parameters
        ----------
        data
            LiteLLM_DailyOrganizationSpend data to update the selected LiteLLM_DailyOrganizationSpend records to
        where
            Filter to select the LiteLLM_DailyOrganizationSpend records to update

        Returns
        -------
        int
            The total number of LiteLLM_DailyOrganizationSpend records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_DailyOrganizationSpend records
        total = await LiteLLM_DailyOrganizationSpend.prisma().update_many(
            data={
                'model_group': 'hechjdjih'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyOrganizationSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyOrganizationSpendWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_DailyOrganizationSpend records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyOrganizationSpend fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyOrganizationSpend filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyOrganizationSpendCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyOrganizationSpend.prisma().count()

        # results: prisma.types.LiteLLM_DailyOrganizationSpendCountAggregateOutput
        results = await LiteLLM_DailyOrganizationSpend.prisma().count(
            select={
                '_all': True,
                'custom_llm_provider': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_DailyOrganizationSpendCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyOrganizationSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyOrganizationSpendWhereUniqueInput] = None,
    ) -> types.LiteLLM_DailyOrganizationSpendCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_DailyOrganizationSpendCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyOrganizationSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyOrganizationSpendWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_DailyOrganizationSpendCountAggregateOutput]:
        """Count the number of LiteLLM_DailyOrganizationSpend records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyOrganizationSpend fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyOrganizationSpend filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyOrganizationSpendCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyOrganizationSpend.prisma().count()

        # results: prisma.types.LiteLLM_DailyOrganizationSpendCountAggregateOutput
        results = await LiteLLM_DailyOrganizationSpend.prisma().count(
            select={
                '_all': True,
                'mcp_namespaced_tool_name': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_DailyOrganizationSpendCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_DailyOrganizationSpendWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_DailyOrganizationSpend records.

        Parameters
        ----------
        where
            Optional LiteLLM_DailyOrganizationSpend filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_DailyOrganizationSpend records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_DailyOrganizationSpend records
        total = await LiteLLM_DailyOrganizationSpend.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_DailyOrganizationSpendScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_DailyOrganizationSpendWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_DailyOrganizationSpendAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_DailyOrganizationSpendSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_DailyOrganizationSpendMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_DailyOrganizationSpendMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_DailyOrganizationSpendScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_DailyOrganizationSpendCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_DailyOrganizationSpendScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_DailyOrganizationSpendScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_DailyOrganizationSpendGroupByOutput']:
        """Group LiteLLM_DailyOrganizationSpend records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_DailyOrganizationSpend fields to group records by
        where
            LiteLLM_DailyOrganizationSpend filter to select records
        take
            Limit the maximum number of LiteLLM_DailyOrganizationSpend records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_DailyOrganizationSpendGroupByOutput]
            A list of dictionaries representing the LiteLLM_DailyOrganizationSpend record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_DailyOrganizationSpend records by endpoint values
        # and count how many records are in each group
        results = await LiteLLM_DailyOrganizationSpend.prisma().group_by(
            ['endpoint'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_DailyEndUserSpendActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_DailyEndUserSpend]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_DailyEndUserSpend.prisma().query_raw(
            'SELECT * FROM LiteLLM_DailyEndUserSpend WHERE id = $1',
            'cgfjefhci',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_DailyEndUserSpend
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_DailyEndUserSpend.prisma().query_first(
            'SELECT * FROM LiteLLM_DailyEndUserSpend WHERE end_user_id = $1',
            'egcidbiab',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_DailyEndUserSpendCreateInput,
        include: Optional[types.LiteLLM_DailyEndUserSpendInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_DailyEndUserSpend record.

        Parameters
        ----------
        data
            LiteLLM_DailyEndUserSpend record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyEndUserSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyEndUserSpend
            The created LiteLLM_DailyEndUserSpend record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_DailyEndUserSpend record from just the required fields
        litellm_dailyenduserspend = await LiteLLM_DailyEndUserSpend.prisma().create(
            data={
                # data to create a LiteLLM_DailyEndUserSpend record
                'date': 'cehjjfgeg',
                'api_key': 'hiaaaeeeh',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_DailyEndUserSpendCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_DailyEndUserSpend records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_DailyEndUserSpend record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_DailyEndUserSpend.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_DailyEndUserSpend record
                    'date': 'ediajdeie',
                    'api_key': 'jdgefgafd',
                },
                {
                    # data to create a LiteLLM_DailyEndUserSpend record
                    'date': 'bhhihbfeac',
                    'api_key': 'bajegedfhj',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_DailyEndUserSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyEndUserSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_DailyEndUserSpend record.

        Parameters
        ----------
        where
            LiteLLM_DailyEndUserSpend filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyEndUserSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyEndUserSpend
            The deleted LiteLLM_DailyEndUserSpend record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyenduserspend = await LiteLLM_DailyEndUserSpend.prisma().delete(
            where={
                'id': 'bhfjihjfhg',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_DailyEndUserSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyEndUserSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_DailyEndUserSpend record.

        Parameters
        ----------
        where
            LiteLLM_DailyEndUserSpend filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyEndUserSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyEndUserSpend
            The found LiteLLM_DailyEndUserSpend record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyenduserspend = await LiteLLM_DailyEndUserSpend.prisma().find_unique(
            where={
                'id': 'iicaadeeb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_DailyEndUserSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyEndUserSpendInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_DailyEndUserSpend record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_DailyEndUserSpend filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyEndUserSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyEndUserSpend
            The found LiteLLM_DailyEndUserSpend record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyenduserspend = await LiteLLM_DailyEndUserSpend.prisma().find_unique_or_raise(
            where={
                'id': 'bigjggdhac',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyEndUserSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyEndUserSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyEndUserSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyEndUserSpendOrderByInput, List[types.LiteLLM_DailyEndUserSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyEndUserSpendScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_DailyEndUserSpend records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_DailyEndUserSpend records returned
        skip
            Ignore the first N results
        where
            LiteLLM_DailyEndUserSpend filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyEndUserSpend model
        order
            Order the returned LiteLLM_DailyEndUserSpend records by any field
        distinct
            Filter LiteLLM_DailyEndUserSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_DailyEndUserSpend]
            The list of all LiteLLM_DailyEndUserSpend records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_DailyEndUserSpend records
        litellm_dailyenduserspends = await LiteLLM_DailyEndUserSpend.prisma().find_many(take=10)

        # find the first 5 LiteLLM_DailyEndUserSpend records ordered by the date field
        litellm_dailyenduserspends = await LiteLLM_DailyEndUserSpend.prisma().find_many(
            take=5,
            order={
                'date': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyEndUserSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyEndUserSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyEndUserSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyEndUserSpendOrderByInput, List[types.LiteLLM_DailyEndUserSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyEndUserSpendScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_DailyEndUserSpend record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyEndUserSpend filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyEndUserSpend model
        order
            Order the returned LiteLLM_DailyEndUserSpend records by any field
        distinct
            Filter LiteLLM_DailyEndUserSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyEndUserSpend
            The first LiteLLM_DailyEndUserSpend record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyEndUserSpend record ordered by the api_key field
        litellm_dailyenduserspend = await LiteLLM_DailyEndUserSpend.prisma().find_first(
            skip=1,
            order={
                'api_key': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyEndUserSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyEndUserSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyEndUserSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyEndUserSpendOrderByInput, List[types.LiteLLM_DailyEndUserSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyEndUserSpendScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_DailyEndUserSpend record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyEndUserSpend filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyEndUserSpend model
        order
            Order the returned LiteLLM_DailyEndUserSpend records by any field
        distinct
            Filter LiteLLM_DailyEndUserSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyEndUserSpend
            The first LiteLLM_DailyEndUserSpend record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyEndUserSpend record ordered by the model field
        litellm_dailyenduserspend = await LiteLLM_DailyEndUserSpend.prisma().find_first_or_raise(
            skip=1,
            order={
                'model': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_DailyEndUserSpendUpdateInput,
        where: types.LiteLLM_DailyEndUserSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyEndUserSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_DailyEndUserSpend record.

        Parameters
        ----------
        data
            LiteLLM_DailyEndUserSpend record data specifying what to update
        where
            LiteLLM_DailyEndUserSpend filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyEndUserSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyEndUserSpend
            The updated LiteLLM_DailyEndUserSpend record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_dailyenduserspend = await LiteLLM_DailyEndUserSpend.prisma().update(
            where={
                'id': 'bfdbbbjhad',
            },
            data={
                # data to update the LiteLLM_DailyEndUserSpend record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_DailyEndUserSpendWhereUniqueInput,
        data: types.LiteLLM_DailyEndUserSpendUpsertInput,
        include: Optional[types.LiteLLM_DailyEndUserSpendInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_DailyEndUserSpend filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyEndUserSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyEndUserSpend
            The created or updated LiteLLM_DailyEndUserSpend record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyenduserspend = await LiteLLM_DailyEndUserSpend.prisma().upsert(
            where={
                'id': 'bdibjhdici',
            },
            data={
                'create': {
                    'id': 'bdibjhdici',
                    'date': 'bhhihbfeac',
                    'api_key': 'bajegedfhj',
                },
                'update': {
                    'date': 'bhhihbfeac',
                    'api_key': 'bajegedfhj',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_DailyEndUserSpendUpdateManyMutationInput,
        where: types.LiteLLM_DailyEndUserSpendWhereInput,
    ) -> int:
        """Update multiple LiteLLM_DailyEndUserSpend records

        Parameters
        ----------
        data
            LiteLLM_DailyEndUserSpend data to update the selected LiteLLM_DailyEndUserSpend records to
        where
            Filter to select the LiteLLM_DailyEndUserSpend records to update

        Returns
        -------
        int
            The total number of LiteLLM_DailyEndUserSpend records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_DailyEndUserSpend records
        total = await LiteLLM_DailyEndUserSpend.prisma().update_many(
            data={
                'model_group': 'bceigehcbd'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyEndUserSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyEndUserSpendWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_DailyEndUserSpend records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyEndUserSpend fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyEndUserSpend filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyEndUserSpendCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyEndUserSpend.prisma().count()

        # results: prisma.types.LiteLLM_DailyEndUserSpendCountAggregateOutput
        results = await LiteLLM_DailyEndUserSpend.prisma().count(
            select={
                '_all': True,
                'custom_llm_provider': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_DailyEndUserSpendCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyEndUserSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyEndUserSpendWhereUniqueInput] = None,
    ) -> types.LiteLLM_DailyEndUserSpendCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_DailyEndUserSpendCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyEndUserSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyEndUserSpendWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_DailyEndUserSpendCountAggregateOutput]:
        """Count the number of LiteLLM_DailyEndUserSpend records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyEndUserSpend fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyEndUserSpend filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyEndUserSpendCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyEndUserSpend.prisma().count()

        # results: prisma.types.LiteLLM_DailyEndUserSpendCountAggregateOutput
        results = await LiteLLM_DailyEndUserSpend.prisma().count(
            select={
                '_all': True,
                'mcp_namespaced_tool_name': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_DailyEndUserSpendCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_DailyEndUserSpendWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_DailyEndUserSpend records.

        Parameters
        ----------
        where
            Optional LiteLLM_DailyEndUserSpend filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_DailyEndUserSpend records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_DailyEndUserSpend records
        total = await LiteLLM_DailyEndUserSpend.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_DailyEndUserSpendScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_DailyEndUserSpendWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_DailyEndUserSpendAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_DailyEndUserSpendSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_DailyEndUserSpendMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_DailyEndUserSpendMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_DailyEndUserSpendScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_DailyEndUserSpendCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_DailyEndUserSpendScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_DailyEndUserSpendScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_DailyEndUserSpendGroupByOutput']:
        """Group LiteLLM_DailyEndUserSpend records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_DailyEndUserSpend fields to group records by
        where
            LiteLLM_DailyEndUserSpend filter to select records
        take
            Limit the maximum number of LiteLLM_DailyEndUserSpend records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_DailyEndUserSpendGroupByOutput]
            A list of dictionaries representing the LiteLLM_DailyEndUserSpend record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_DailyEndUserSpend records by endpoint values
        # and count how many records are in each group
        results = await LiteLLM_DailyEndUserSpend.prisma().group_by(
            ['endpoint'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_DailyAgentSpendActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_DailyAgentSpend]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_DailyAgentSpend.prisma().query_raw(
            'SELECT * FROM LiteLLM_DailyAgentSpend WHERE id = $1',
            'caehahihfe',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_DailyAgentSpend
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_DailyAgentSpend.prisma().query_first(
            'SELECT * FROM LiteLLM_DailyAgentSpend WHERE agent_id = $1',
            'jjacdhech',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_DailyAgentSpendCreateInput,
        include: Optional[types.LiteLLM_DailyAgentSpendInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_DailyAgentSpend record.

        Parameters
        ----------
        data
            LiteLLM_DailyAgentSpend record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyAgentSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyAgentSpend
            The created LiteLLM_DailyAgentSpend record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_DailyAgentSpend record from just the required fields
        litellm_dailyagentspend = await LiteLLM_DailyAgentSpend.prisma().create(
            data={
                # data to create a LiteLLM_DailyAgentSpend record
                'date': 'bbbjadabjc',
                'api_key': 'hhaechedd',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_DailyAgentSpendCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_DailyAgentSpend records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_DailyAgentSpend record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_DailyAgentSpend.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_DailyAgentSpend record
                    'date': 'gjjgegdic',
                    'api_key': 'bijbiccd',
                },
                {
                    # data to create a LiteLLM_DailyAgentSpend record
                    'date': 'cbaagdieci',
                    'api_key': 'jchifaegj',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_DailyAgentSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyAgentSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_DailyAgentSpend record.

        Parameters
        ----------
        where
            LiteLLM_DailyAgentSpend filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyAgentSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyAgentSpend
            The deleted LiteLLM_DailyAgentSpend record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyagentspend = await LiteLLM_DailyAgentSpend.prisma().delete(
            where={
                'id': 'dhhdhfebi',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_DailyAgentSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyAgentSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_DailyAgentSpend record.

        Parameters
        ----------
        where
            LiteLLM_DailyAgentSpend filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyAgentSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyAgentSpend
            The found LiteLLM_DailyAgentSpend record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyagentspend = await LiteLLM_DailyAgentSpend.prisma().find_unique(
            where={
                'id': 'decchddih',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_DailyAgentSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyAgentSpendInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_DailyAgentSpend record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_DailyAgentSpend filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyAgentSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyAgentSpend
            The found LiteLLM_DailyAgentSpend record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyagentspend = await LiteLLM_DailyAgentSpend.prisma().find_unique_or_raise(
            where={
                'id': 'bbegbdehci',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyAgentSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyAgentSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyAgentSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyAgentSpendOrderByInput, List[types.LiteLLM_DailyAgentSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyAgentSpendScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_DailyAgentSpend records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_DailyAgentSpend records returned
        skip
            Ignore the first N results
        where
            LiteLLM_DailyAgentSpend filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyAgentSpend model
        order
            Order the returned LiteLLM_DailyAgentSpend records by any field
        distinct
            Filter LiteLLM_DailyAgentSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_DailyAgentSpend]
            The list of all LiteLLM_DailyAgentSpend records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_DailyAgentSpend records
        litellm_dailyagentspends = await LiteLLM_DailyAgentSpend.prisma().find_many(take=10)

        # find the first 5 LiteLLM_DailyAgentSpend records ordered by the date field
        litellm_dailyagentspends = await LiteLLM_DailyAgentSpend.prisma().find_many(
            take=5,
            order={
                'date': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyAgentSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyAgentSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyAgentSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyAgentSpendOrderByInput, List[types.LiteLLM_DailyAgentSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyAgentSpendScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_DailyAgentSpend record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyAgentSpend filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyAgentSpend model
        order
            Order the returned LiteLLM_DailyAgentSpend records by any field
        distinct
            Filter LiteLLM_DailyAgentSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyAgentSpend
            The first LiteLLM_DailyAgentSpend record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyAgentSpend record ordered by the api_key field
        litellm_dailyagentspend = await LiteLLM_DailyAgentSpend.prisma().find_first(
            skip=1,
            order={
                'api_key': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyAgentSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyAgentSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyAgentSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyAgentSpendOrderByInput, List[types.LiteLLM_DailyAgentSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyAgentSpendScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_DailyAgentSpend record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyAgentSpend filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyAgentSpend model
        order
            Order the returned LiteLLM_DailyAgentSpend records by any field
        distinct
            Filter LiteLLM_DailyAgentSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyAgentSpend
            The first LiteLLM_DailyAgentSpend record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyAgentSpend record ordered by the model field
        litellm_dailyagentspend = await LiteLLM_DailyAgentSpend.prisma().find_first_or_raise(
            skip=1,
            order={
                'model': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_DailyAgentSpendUpdateInput,
        where: types.LiteLLM_DailyAgentSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyAgentSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_DailyAgentSpend record.

        Parameters
        ----------
        data
            LiteLLM_DailyAgentSpend record data specifying what to update
        where
            LiteLLM_DailyAgentSpend filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyAgentSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyAgentSpend
            The updated LiteLLM_DailyAgentSpend record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_dailyagentspend = await LiteLLM_DailyAgentSpend.prisma().update(
            where={
                'id': 'bcebgbhhgb',
            },
            data={
                # data to update the LiteLLM_DailyAgentSpend record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_DailyAgentSpendWhereUniqueInput,
        data: types.LiteLLM_DailyAgentSpendUpsertInput,
        include: Optional[types.LiteLLM_DailyAgentSpendInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_DailyAgentSpend filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyAgentSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyAgentSpend
            The created or updated LiteLLM_DailyAgentSpend record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyagentspend = await LiteLLM_DailyAgentSpend.prisma().upsert(
            where={
                'id': 'ghegfaceg',
            },
            data={
                'create': {
                    'id': 'ghegfaceg',
                    'date': 'cbaagdieci',
                    'api_key': 'jchifaegj',
                },
                'update': {
                    'date': 'cbaagdieci',
                    'api_key': 'jchifaegj',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_DailyAgentSpendUpdateManyMutationInput,
        where: types.LiteLLM_DailyAgentSpendWhereInput,
    ) -> int:
        """Update multiple LiteLLM_DailyAgentSpend records

        Parameters
        ----------
        data
            LiteLLM_DailyAgentSpend data to update the selected LiteLLM_DailyAgentSpend records to
        where
            Filter to select the LiteLLM_DailyAgentSpend records to update

        Returns
        -------
        int
            The total number of LiteLLM_DailyAgentSpend records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_DailyAgentSpend records
        total = await LiteLLM_DailyAgentSpend.prisma().update_many(
            data={
                'model_group': 'hdeaejgah'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyAgentSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyAgentSpendWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_DailyAgentSpend records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyAgentSpend fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyAgentSpend filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyAgentSpendCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyAgentSpend.prisma().count()

        # results: prisma.types.LiteLLM_DailyAgentSpendCountAggregateOutput
        results = await LiteLLM_DailyAgentSpend.prisma().count(
            select={
                '_all': True,
                'custom_llm_provider': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_DailyAgentSpendCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyAgentSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyAgentSpendWhereUniqueInput] = None,
    ) -> types.LiteLLM_DailyAgentSpendCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_DailyAgentSpendCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyAgentSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyAgentSpendWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_DailyAgentSpendCountAggregateOutput]:
        """Count the number of LiteLLM_DailyAgentSpend records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyAgentSpend fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyAgentSpend filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyAgentSpendCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyAgentSpend.prisma().count()

        # results: prisma.types.LiteLLM_DailyAgentSpendCountAggregateOutput
        results = await LiteLLM_DailyAgentSpend.prisma().count(
            select={
                '_all': True,
                'mcp_namespaced_tool_name': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_DailyAgentSpendCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_DailyAgentSpendWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_DailyAgentSpend records.

        Parameters
        ----------
        where
            Optional LiteLLM_DailyAgentSpend filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_DailyAgentSpend records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_DailyAgentSpend records
        total = await LiteLLM_DailyAgentSpend.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_DailyAgentSpendScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_DailyAgentSpendWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_DailyAgentSpendAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_DailyAgentSpendSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_DailyAgentSpendMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_DailyAgentSpendMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_DailyAgentSpendScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_DailyAgentSpendCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_DailyAgentSpendScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_DailyAgentSpendScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_DailyAgentSpendGroupByOutput']:
        """Group LiteLLM_DailyAgentSpend records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_DailyAgentSpend fields to group records by
        where
            LiteLLM_DailyAgentSpend filter to select records
        take
            Limit the maximum number of LiteLLM_DailyAgentSpend records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_DailyAgentSpendGroupByOutput]
            A list of dictionaries representing the LiteLLM_DailyAgentSpend record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_DailyAgentSpend records by endpoint values
        # and count how many records are in each group
        results = await LiteLLM_DailyAgentSpend.prisma().group_by(
            ['endpoint'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_DailyTeamSpendActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_DailyTeamSpend]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_DailyTeamSpend.prisma().query_raw(
            'SELECT * FROM LiteLLM_DailyTeamSpend WHERE id = $1',
            'ddiiihaci',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_DailyTeamSpend
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_DailyTeamSpend.prisma().query_first(
            'SELECT * FROM LiteLLM_DailyTeamSpend WHERE team_id = $1',
            'jdhfacdgf',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_DailyTeamSpendCreateInput,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_DailyTeamSpend record.

        Parameters
        ----------
        data
            LiteLLM_DailyTeamSpend record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTeamSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyTeamSpend
            The created LiteLLM_DailyTeamSpend record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_DailyTeamSpend record from just the required fields
        litellm_dailyteamspend = await LiteLLM_DailyTeamSpend.prisma().create(
            data={
                # data to create a LiteLLM_DailyTeamSpend record
                'date': 'fcbbahcbi',
                'api_key': 'edcgchech',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_DailyTeamSpendCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_DailyTeamSpend records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_DailyTeamSpend record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_DailyTeamSpend.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_DailyTeamSpend record
                    'date': 'bfehccdcge',
                    'api_key': 'ehcibdegf',
                },
                {
                    # data to create a LiteLLM_DailyTeamSpend record
                    'date': 'ebhjifbbi',
                    'api_key': 'jaigficdj',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_DailyTeamSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_DailyTeamSpend record.

        Parameters
        ----------
        where
            LiteLLM_DailyTeamSpend filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTeamSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyTeamSpend
            The deleted LiteLLM_DailyTeamSpend record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyteamspend = await LiteLLM_DailyTeamSpend.prisma().delete(
            where={
                'id': 'bggcfifgbc',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_DailyTeamSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_DailyTeamSpend record.

        Parameters
        ----------
        where
            LiteLLM_DailyTeamSpend filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTeamSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyTeamSpend
            The found LiteLLM_DailyTeamSpend record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyteamspend = await LiteLLM_DailyTeamSpend.prisma().find_unique(
            where={
                'id': 'bhidfjibgf',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_DailyTeamSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_DailyTeamSpend record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_DailyTeamSpend filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTeamSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyTeamSpend
            The found LiteLLM_DailyTeamSpend record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyteamspend = await LiteLLM_DailyTeamSpend.prisma().find_unique_or_raise(
            where={
                'id': 'fcgdaijha',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyTeamSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyTeamSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyTeamSpendOrderByInput, List[types.LiteLLM_DailyTeamSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyTeamSpendScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_DailyTeamSpend records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_DailyTeamSpend records returned
        skip
            Ignore the first N results
        where
            LiteLLM_DailyTeamSpend filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTeamSpend model
        order
            Order the returned LiteLLM_DailyTeamSpend records by any field
        distinct
            Filter LiteLLM_DailyTeamSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_DailyTeamSpend]
            The list of all LiteLLM_DailyTeamSpend records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_DailyTeamSpend records
        litellm_dailyteamspends = await LiteLLM_DailyTeamSpend.prisma().find_many(take=10)

        # find the first 5 LiteLLM_DailyTeamSpend records ordered by the date field
        litellm_dailyteamspends = await LiteLLM_DailyTeamSpend.prisma().find_many(
            take=5,
            order={
                'date': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyTeamSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyTeamSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyTeamSpendOrderByInput, List[types.LiteLLM_DailyTeamSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyTeamSpendScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_DailyTeamSpend record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyTeamSpend filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTeamSpend model
        order
            Order the returned LiteLLM_DailyTeamSpend records by any field
        distinct
            Filter LiteLLM_DailyTeamSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyTeamSpend
            The first LiteLLM_DailyTeamSpend record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyTeamSpend record ordered by the api_key field
        litellm_dailyteamspend = await LiteLLM_DailyTeamSpend.prisma().find_first(
            skip=1,
            order={
                'api_key': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyTeamSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyTeamSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyTeamSpendOrderByInput, List[types.LiteLLM_DailyTeamSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyTeamSpendScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_DailyTeamSpend record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyTeamSpend filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTeamSpend model
        order
            Order the returned LiteLLM_DailyTeamSpend records by any field
        distinct
            Filter LiteLLM_DailyTeamSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyTeamSpend
            The first LiteLLM_DailyTeamSpend record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyTeamSpend record ordered by the model field
        litellm_dailyteamspend = await LiteLLM_DailyTeamSpend.prisma().find_first_or_raise(
            skip=1,
            order={
                'model': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_DailyTeamSpendUpdateInput,
        where: types.LiteLLM_DailyTeamSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_DailyTeamSpend record.

        Parameters
        ----------
        data
            LiteLLM_DailyTeamSpend record data specifying what to update
        where
            LiteLLM_DailyTeamSpend filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTeamSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyTeamSpend
            The updated LiteLLM_DailyTeamSpend record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_dailyteamspend = await LiteLLM_DailyTeamSpend.prisma().update(
            where={
                'id': 'bbgfajah',
            },
            data={
                # data to update the LiteLLM_DailyTeamSpend record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_DailyTeamSpendWhereUniqueInput,
        data: types.LiteLLM_DailyTeamSpendUpsertInput,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_DailyTeamSpend filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTeamSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyTeamSpend
            The created or updated LiteLLM_DailyTeamSpend record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyteamspend = await LiteLLM_DailyTeamSpend.prisma().upsert(
            where={
                'id': 'bbaecgicia',
            },
            data={
                'create': {
                    'id': 'bbaecgicia',
                    'date': 'ebhjifbbi',
                    'api_key': 'jaigficdj',
                },
                'update': {
                    'date': 'ebhjifbbi',
                    'api_key': 'jaigficdj',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_DailyTeamSpendUpdateManyMutationInput,
        where: types.LiteLLM_DailyTeamSpendWhereInput,
    ) -> int:
        """Update multiple LiteLLM_DailyTeamSpend records

        Parameters
        ----------
        data
            LiteLLM_DailyTeamSpend data to update the selected LiteLLM_DailyTeamSpend records to
        where
            Filter to select the LiteLLM_DailyTeamSpend records to update

        Returns
        -------
        int
            The total number of LiteLLM_DailyTeamSpend records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_DailyTeamSpend records
        total = await LiteLLM_DailyTeamSpend.prisma().update_many(
            data={
                'model_group': 'hedacahfd'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyTeamSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyTeamSpendWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_DailyTeamSpend records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyTeamSpend fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyTeamSpend filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyTeamSpendCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyTeamSpend.prisma().count()

        # results: prisma.types.LiteLLM_DailyTeamSpendCountAggregateOutput
        results = await LiteLLM_DailyTeamSpend.prisma().count(
            select={
                '_all': True,
                'custom_llm_provider': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_DailyTeamSpendCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyTeamSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyTeamSpendWhereUniqueInput] = None,
    ) -> types.LiteLLM_DailyTeamSpendCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_DailyTeamSpendCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyTeamSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyTeamSpendWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_DailyTeamSpendCountAggregateOutput]:
        """Count the number of LiteLLM_DailyTeamSpend records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyTeamSpend fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyTeamSpend filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyTeamSpendCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyTeamSpend.prisma().count()

        # results: prisma.types.LiteLLM_DailyTeamSpendCountAggregateOutput
        results = await LiteLLM_DailyTeamSpend.prisma().count(
            select={
                '_all': True,
                'mcp_namespaced_tool_name': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_DailyTeamSpendCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_DailyTeamSpendWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_DailyTeamSpend records.

        Parameters
        ----------
        where
            Optional LiteLLM_DailyTeamSpend filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_DailyTeamSpend records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_DailyTeamSpend records
        total = await LiteLLM_DailyTeamSpend.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_DailyTeamSpendScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_DailyTeamSpendWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_DailyTeamSpendAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_DailyTeamSpendSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_DailyTeamSpendMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_DailyTeamSpendMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_DailyTeamSpendScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_DailyTeamSpendCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_DailyTeamSpendScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_DailyTeamSpendScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_DailyTeamSpendGroupByOutput']:
        """Group LiteLLM_DailyTeamSpend records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_DailyTeamSpend fields to group records by
        where
            LiteLLM_DailyTeamSpend filter to select records
        take
            Limit the maximum number of LiteLLM_DailyTeamSpend records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_DailyTeamSpendGroupByOutput]
            A list of dictionaries representing the LiteLLM_DailyTeamSpend record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_DailyTeamSpend records by endpoint values
        # and count how many records are in each group
        results = await LiteLLM_DailyTeamSpend.prisma().group_by(
            ['endpoint'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_DailyTagSpendActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_DailyTagSpend]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_DailyTagSpend.prisma().query_raw(
            'SELECT * FROM LiteLLM_DailyTagSpend WHERE id = $1',
            'bhgjecjac',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_DailyTagSpend
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_DailyTagSpend.prisma().query_first(
            'SELECT * FROM LiteLLM_DailyTagSpend WHERE request_id = $1',
            'bfbdieidhf',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_DailyTagSpendCreateInput,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_DailyTagSpend record.

        Parameters
        ----------
        data
            LiteLLM_DailyTagSpend record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTagSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyTagSpend
            The created LiteLLM_DailyTagSpend record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_DailyTagSpend record from just the required fields
        litellm_dailytagspend = await LiteLLM_DailyTagSpend.prisma().create(
            data={
                # data to create a LiteLLM_DailyTagSpend record
                'date': 'ffjbdcfia',
                'api_key': 'hfeidjicb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_DailyTagSpendCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_DailyTagSpend records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_DailyTagSpend record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_DailyTagSpend.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_DailyTagSpend record
                    'date': 'bbfbdccdag',
                    'api_key': 'biggefaged',
                },
                {
                    # data to create a LiteLLM_DailyTagSpend record
                    'date': 'gfdbeaejg',
                    'api_key': 'bhacdebcb',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_DailyTagSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_DailyTagSpend record.

        Parameters
        ----------
        where
            LiteLLM_DailyTagSpend filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTagSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyTagSpend
            The deleted LiteLLM_DailyTagSpend record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailytagspend = await LiteLLM_DailyTagSpend.prisma().delete(
            where={
                'id': 'jhffeibhe',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_DailyTagSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_DailyTagSpend record.

        Parameters
        ----------
        where
            LiteLLM_DailyTagSpend filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTagSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyTagSpend
            The found LiteLLM_DailyTagSpend record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailytagspend = await LiteLLM_DailyTagSpend.prisma().find_unique(
            where={
                'id': 'iaiieefjb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_DailyTagSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_DailyTagSpend record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_DailyTagSpend filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTagSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyTagSpend
            The found LiteLLM_DailyTagSpend record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailytagspend = await LiteLLM_DailyTagSpend.prisma().find_unique_or_raise(
            where={
                'id': 'jjhjdgjfg',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyTagSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyTagSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyTagSpendOrderByInput, List[types.LiteLLM_DailyTagSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyTagSpendScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_DailyTagSpend records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_DailyTagSpend records returned
        skip
            Ignore the first N results
        where
            LiteLLM_DailyTagSpend filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTagSpend model
        order
            Order the returned LiteLLM_DailyTagSpend records by any field
        distinct
            Filter LiteLLM_DailyTagSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_DailyTagSpend]
            The list of all LiteLLM_DailyTagSpend records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_DailyTagSpend records
        litellm_dailytagspends = await LiteLLM_DailyTagSpend.prisma().find_many(take=10)

        # find the first 5 LiteLLM_DailyTagSpend records ordered by the tag field
        litellm_dailytagspends = await LiteLLM_DailyTagSpend.prisma().find_many(
            take=5,
            order={
                'tag': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyTagSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyTagSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyTagSpendOrderByInput, List[types.LiteLLM_DailyTagSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyTagSpendScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_DailyTagSpend record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyTagSpend filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTagSpend model
        order
            Order the returned LiteLLM_DailyTagSpend records by any field
        distinct
            Filter LiteLLM_DailyTagSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyTagSpend
            The first LiteLLM_DailyTagSpend record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyTagSpend record ordered by the date field
        litellm_dailytagspend = await LiteLLM_DailyTagSpend.prisma().find_first(
            skip=1,
            order={
                'date': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyTagSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyTagSpendWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyTagSpendOrderByInput, List[types.LiteLLM_DailyTagSpendOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyTagSpendScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_DailyTagSpend record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyTagSpend filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTagSpend model
        order
            Order the returned LiteLLM_DailyTagSpend records by any field
        distinct
            Filter LiteLLM_DailyTagSpend records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyTagSpend
            The first LiteLLM_DailyTagSpend record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyTagSpend record ordered by the api_key field
        litellm_dailytagspend = await LiteLLM_DailyTagSpend.prisma().find_first_or_raise(
            skip=1,
            order={
                'api_key': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_DailyTagSpendUpdateInput,
        where: types.LiteLLM_DailyTagSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_DailyTagSpend record.

        Parameters
        ----------
        data
            LiteLLM_DailyTagSpend record data specifying what to update
        where
            LiteLLM_DailyTagSpend filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTagSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyTagSpend
            The updated LiteLLM_DailyTagSpend record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_dailytagspend = await LiteLLM_DailyTagSpend.prisma().update(
            where={
                'id': 'bhhjcfadhd',
            },
            data={
                # data to update the LiteLLM_DailyTagSpend record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_DailyTagSpendWhereUniqueInput,
        data: types.LiteLLM_DailyTagSpendUpsertInput,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_DailyTagSpend filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyTagSpend model

        Returns
        -------
        prisma.models.LiteLLM_DailyTagSpend
            The created or updated LiteLLM_DailyTagSpend record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailytagspend = await LiteLLM_DailyTagSpend.prisma().upsert(
            where={
                'id': 'fbejadda',
            },
            data={
                'create': {
                    'id': 'fbejadda',
                    'date': 'gfdbeaejg',
                    'api_key': 'bhacdebcb',
                },
                'update': {
                    'date': 'gfdbeaejg',
                    'api_key': 'bhacdebcb',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_DailyTagSpendUpdateManyMutationInput,
        where: types.LiteLLM_DailyTagSpendWhereInput,
    ) -> int:
        """Update multiple LiteLLM_DailyTagSpend records

        Parameters
        ----------
        data
            LiteLLM_DailyTagSpend data to update the selected LiteLLM_DailyTagSpend records to
        where
            Filter to select the LiteLLM_DailyTagSpend records to update

        Returns
        -------
        int
            The total number of LiteLLM_DailyTagSpend records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_DailyTagSpend records
        total = await LiteLLM_DailyTagSpend.prisma().update_many(
            data={
                'model': 'bjeaigeddb'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyTagSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyTagSpendWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_DailyTagSpend records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyTagSpend fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyTagSpend filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyTagSpendCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyTagSpend.prisma().count()

        # results: prisma.types.LiteLLM_DailyTagSpendCountAggregateOutput
        results = await LiteLLM_DailyTagSpend.prisma().count(
            select={
                '_all': True,
                'model_group': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_DailyTagSpendCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyTagSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyTagSpendWhereUniqueInput] = None,
    ) -> types.LiteLLM_DailyTagSpendCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_DailyTagSpendCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyTagSpendWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyTagSpendWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_DailyTagSpendCountAggregateOutput]:
        """Count the number of LiteLLM_DailyTagSpend records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyTagSpend fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyTagSpend filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyTagSpendCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyTagSpend.prisma().count()

        # results: prisma.types.LiteLLM_DailyTagSpendCountAggregateOutput
        results = await LiteLLM_DailyTagSpend.prisma().count(
            select={
                '_all': True,
                'custom_llm_provider': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_DailyTagSpendCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_DailyTagSpendWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_DailyTagSpend records.

        Parameters
        ----------
        where
            Optional LiteLLM_DailyTagSpend filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_DailyTagSpend records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_DailyTagSpend records
        total = await LiteLLM_DailyTagSpend.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_DailyTagSpendScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_DailyTagSpendWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_DailyTagSpendAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_DailyTagSpendSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_DailyTagSpendMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_DailyTagSpendMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_DailyTagSpendScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_DailyTagSpendCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_DailyTagSpendScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_DailyTagSpendScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_DailyTagSpendGroupByOutput']:
        """Group LiteLLM_DailyTagSpend records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_DailyTagSpend fields to group records by
        where
            LiteLLM_DailyTagSpend filter to select records
        take
            Limit the maximum number of LiteLLM_DailyTagSpend records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_DailyTagSpendGroupByOutput]
            A list of dictionaries representing the LiteLLM_DailyTagSpend record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_DailyTagSpend records by mcp_namespaced_tool_name values
        # and count how many records are in each group
        results = await LiteLLM_DailyTagSpend.prisma().group_by(
            ['mcp_namespaced_tool_name'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_CronJobActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_CronJob]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_CronJob.prisma().query_raw(
            'SELECT * FROM LiteLLM_CronJob WHERE cronjob_id = $1',
            'eceecabdg',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_CronJob
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_CronJob.prisma().query_first(
            'SELECT * FROM LiteLLM_CronJob WHERE pod_id = $1',
            'bdgaajbcab',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_CronJobCreateInput,
        include: Optional[types.LiteLLM_CronJobInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_CronJob record.

        Parameters
        ----------
        data
            LiteLLM_CronJob record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_CronJob model

        Returns
        -------
        prisma.models.LiteLLM_CronJob
            The created LiteLLM_CronJob record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_CronJob record from just the required fields
        litellm_cronjob = await LiteLLM_CronJob.prisma().create(
            data={
                # data to create a LiteLLM_CronJob record
                'pod_id': 'chhgehieg',
                'ttl': datetime.datetime.utcnow(),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_CronJobCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_CronJob records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_CronJob record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_CronJob.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_CronJob record
                    'pod_id': 'faggbiggd',
                    'ttl': datetime.datetime.utcnow(),
                },
                {
                    # data to create a LiteLLM_CronJob record
                    'pod_id': 'bciijiajei',
                    'ttl': datetime.datetime.utcnow(),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_CronJobWhereUniqueInput,
        include: Optional[types.LiteLLM_CronJobInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_CronJob record.

        Parameters
        ----------
        where
            LiteLLM_CronJob filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_CronJob model

        Returns
        -------
        prisma.models.LiteLLM_CronJob
            The deleted LiteLLM_CronJob record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_cronjob = await LiteLLM_CronJob.prisma().delete(
            where={
                'cronjob_id': 'bdjaadchgf',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_CronJobWhereUniqueInput,
        include: Optional[types.LiteLLM_CronJobInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_CronJob record.

        Parameters
        ----------
        where
            LiteLLM_CronJob filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_CronJob model

        Returns
        -------
        prisma.models.LiteLLM_CronJob
            The found LiteLLM_CronJob record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_cronjob = await LiteLLM_CronJob.prisma().find_unique(
            where={
                'cronjob_id': 'biadfeebhi',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_CronJobWhereUniqueInput,
        include: Optional[types.LiteLLM_CronJobInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_CronJob record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_CronJob filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_CronJob model

        Returns
        -------
        prisma.models.LiteLLM_CronJob
            The found LiteLLM_CronJob record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_cronjob = await LiteLLM_CronJob.prisma().find_unique_or_raise(
            where={
                'cronjob_id': 'biajdcaged',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CronJobWhereInput] = None,
        cursor: Optional[types.LiteLLM_CronJobWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_CronJobInclude] = None,
        order: Optional[Union[types.LiteLLM_CronJobOrderByInput, List[types.LiteLLM_CronJobOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_CronJobScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_CronJob records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_CronJob records returned
        skip
            Ignore the first N results
        where
            LiteLLM_CronJob filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_CronJob model
        order
            Order the returned LiteLLM_CronJob records by any field
        distinct
            Filter LiteLLM_CronJob records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_CronJob]
            The list of all LiteLLM_CronJob records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_CronJob records
        litellm_cronjobs = await LiteLLM_CronJob.prisma().find_many(take=10)

        # find the first 5 LiteLLM_CronJob records ordered by the status field
        litellm_cronjobs = await LiteLLM_CronJob.prisma().find_many(
            take=5,
            order={
                'status': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CronJobWhereInput] = None,
        cursor: Optional[types.LiteLLM_CronJobWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_CronJobInclude] = None,
        order: Optional[Union[types.LiteLLM_CronJobOrderByInput, List[types.LiteLLM_CronJobOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_CronJobScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_CronJob record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_CronJob filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_CronJob model
        order
            Order the returned LiteLLM_CronJob records by any field
        distinct
            Filter LiteLLM_CronJob records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_CronJob
            The first LiteLLM_CronJob record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_CronJob record ordered by the last_updated field
        litellm_cronjob = await LiteLLM_CronJob.prisma().find_first(
            skip=1,
            order={
                'last_updated': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CronJobWhereInput] = None,
        cursor: Optional[types.LiteLLM_CronJobWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_CronJobInclude] = None,
        order: Optional[Union[types.LiteLLM_CronJobOrderByInput, List[types.LiteLLM_CronJobOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_CronJobScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_CronJob record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_CronJob filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_CronJob model
        order
            Order the returned LiteLLM_CronJob records by any field
        distinct
            Filter LiteLLM_CronJob records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_CronJob
            The first LiteLLM_CronJob record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_CronJob record ordered by the ttl field
        litellm_cronjob = await LiteLLM_CronJob.prisma().find_first_or_raise(
            skip=1,
            order={
                'ttl': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_CronJobUpdateInput,
        where: types.LiteLLM_CronJobWhereUniqueInput,
        include: Optional[types.LiteLLM_CronJobInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_CronJob record.

        Parameters
        ----------
        data
            LiteLLM_CronJob record data specifying what to update
        where
            LiteLLM_CronJob filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_CronJob model

        Returns
        -------
        prisma.models.LiteLLM_CronJob
            The updated LiteLLM_CronJob record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_cronjob = await LiteLLM_CronJob.prisma().update(
            where={
                'cronjob_id': 'ddgjjicai',
            },
            data={
                # data to update the LiteLLM_CronJob record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_CronJobWhereUniqueInput,
        data: types.LiteLLM_CronJobUpsertInput,
        include: Optional[types.LiteLLM_CronJobInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_CronJob filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_CronJob model

        Returns
        -------
        prisma.models.LiteLLM_CronJob
            The created or updated LiteLLM_CronJob record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_cronjob = await LiteLLM_CronJob.prisma().upsert(
            where={
                'cronjob_id': 'efihdjdcb',
            },
            data={
                'create': {
                    'cronjob_id': 'efihdjdcb',
                    'pod_id': 'bciijiajei',
                    'ttl': datetime.datetime.utcnow(),
                },
                'update': {
                    'pod_id': 'bciijiajei',
                    'ttl': datetime.datetime.utcnow(),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_CronJobUpdateManyMutationInput,
        where: types.LiteLLM_CronJobWhereInput,
    ) -> int:
        """Update multiple LiteLLM_CronJob records

        Parameters
        ----------
        data
            LiteLLM_CronJob data to update the selected LiteLLM_CronJob records to
        where
            Filter to select the LiteLLM_CronJob records to update

        Returns
        -------
        int
            The total number of LiteLLM_CronJob records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_CronJob records
        total = await LiteLLM_CronJob.prisma().update_many(
            data={
                'cronjob_id': 'bdeacajaig'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CronJobWhereInput] = None,
        cursor: Optional[types.LiteLLM_CronJobWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_CronJob records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_CronJob fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_CronJob filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_CronJobCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_CronJob.prisma().count()

        # results: prisma.types.LiteLLM_CronJobCountAggregateOutput
        results = await LiteLLM_CronJob.prisma().count(
            select={
                '_all': True,
                'pod_id': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_CronJobCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CronJobWhereInput] = None,
        cursor: Optional[types.LiteLLM_CronJobWhereUniqueInput] = None,
    ) -> types.LiteLLM_CronJobCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_CronJobCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CronJobWhereInput] = None,
        cursor: Optional[types.LiteLLM_CronJobWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_CronJobCountAggregateOutput]:
        """Count the number of LiteLLM_CronJob records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_CronJob fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_CronJob filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_CronJobCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_CronJob.prisma().count()

        # results: prisma.types.LiteLLM_CronJobCountAggregateOutput
        results = await LiteLLM_CronJob.prisma().count(
            select={
                '_all': True,
                'status': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_CronJobCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_CronJobWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_CronJob records.

        Parameters
        ----------
        where
            Optional LiteLLM_CronJob filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_CronJob records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_CronJob records
        total = await LiteLLM_CronJob.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_CronJobScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_CronJobWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_CronJobAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_CronJobSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_CronJobMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_CronJobMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_CronJobScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_CronJobCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_CronJobScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_CronJobScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_CronJobGroupByOutput']:
        """Group LiteLLM_CronJob records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_CronJob fields to group records by
        where
            LiteLLM_CronJob filter to select records
        take
            Limit the maximum number of LiteLLM_CronJob records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_CronJobGroupByOutput]
            A list of dictionaries representing the LiteLLM_CronJob record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_CronJob records by last_updated values
        # and count how many records are in each group
        results = await LiteLLM_CronJob.prisma().group_by(
            ['last_updated'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ManagedFileTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ManagedFileTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ManagedFileTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_ManagedFileTable WHERE id = $1',
            'jddggchfb',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ManagedFileTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ManagedFileTable.prisma().query_first(
            'SELECT * FROM LiteLLM_ManagedFileTable WHERE unified_file_id = $1',
            'bccbfcfdfg',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ManagedFileTableCreateInput,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ManagedFileTable record.

        Parameters
        ----------
        data
            LiteLLM_ManagedFileTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedFileTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedFileTable
            The created LiteLLM_ManagedFileTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ManagedFileTable record from just the required fields
        litellm_managedfiletable = await LiteLLM_ManagedFileTable.prisma().create(
            data={
                # data to create a LiteLLM_ManagedFileTable record
                'unified_file_id': 'bjchjgjib',
                'model_mappings': Json({'ibiaaifcc': True}),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ManagedFileTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ManagedFileTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ManagedFileTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ManagedFileTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ManagedFileTable record
                    'unified_file_id': 'bffejbbadf',
                    'model_mappings': Json({'bajgjiebfc': True}),
                },
                {
                    # data to create a LiteLLM_ManagedFileTable record
                    'unified_file_id': 'bhahahadif',
                    'model_mappings': Json({'bijhaihbcg': True}),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ManagedFileTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ManagedFileTable record.

        Parameters
        ----------
        where
            LiteLLM_ManagedFileTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedFileTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedFileTable
            The deleted LiteLLM_ManagedFileTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedfiletable = await LiteLLM_ManagedFileTable.prisma().delete(
            where={
                'id': 'cbgcjeecd',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ManagedFileTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ManagedFileTable record.

        Parameters
        ----------
        where
            LiteLLM_ManagedFileTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedFileTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedFileTable
            The found LiteLLM_ManagedFileTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedfiletable = await LiteLLM_ManagedFileTable.prisma().find_unique(
            where={
                'id': 'bebibighfg',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ManagedFileTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ManagedFileTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ManagedFileTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedFileTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedFileTable
            The found LiteLLM_ManagedFileTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedfiletable = await LiteLLM_ManagedFileTable.prisma().find_unique_or_raise(
            where={
                'id': 'bbhjeejidh',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedFileTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedFileTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedFileTableOrderByInput, List[types.LiteLLM_ManagedFileTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedFileTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ManagedFileTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ManagedFileTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ManagedFileTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedFileTable model
        order
            Order the returned LiteLLM_ManagedFileTable records by any field
        distinct
            Filter LiteLLM_ManagedFileTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ManagedFileTable]
            The list of all LiteLLM_ManagedFileTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ManagedFileTable records
        litellm_managedfiletables = await LiteLLM_ManagedFileTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ManagedFileTable records ordered by the file_object field
        litellm_managedfiletables = await LiteLLM_ManagedFileTable.prisma().find_many(
            take=5,
            order={
                'file_object': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedFileTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedFileTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedFileTableOrderByInput, List[types.LiteLLM_ManagedFileTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedFileTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ManagedFileTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedFileTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedFileTable model
        order
            Order the returned LiteLLM_ManagedFileTable records by any field
        distinct
            Filter LiteLLM_ManagedFileTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ManagedFileTable
            The first LiteLLM_ManagedFileTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ManagedFileTable record ordered by the model_mappings field
        litellm_managedfiletable = await LiteLLM_ManagedFileTable.prisma().find_first(
            skip=1,
            order={
                'model_mappings': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedFileTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedFileTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedFileTableOrderByInput, List[types.LiteLLM_ManagedFileTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedFileTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ManagedFileTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedFileTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedFileTable model
        order
            Order the returned LiteLLM_ManagedFileTable records by any field
        distinct
            Filter LiteLLM_ManagedFileTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ManagedFileTable
            The first LiteLLM_ManagedFileTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ManagedFileTable record ordered by the flat_model_file_ids field
        litellm_managedfiletable = await LiteLLM_ManagedFileTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'flat_model_file_ids': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ManagedFileTableUpdateInput,
        where: types.LiteLLM_ManagedFileTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ManagedFileTable record.

        Parameters
        ----------
        data
            LiteLLM_ManagedFileTable record data specifying what to update
        where
            LiteLLM_ManagedFileTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedFileTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedFileTable
            The updated LiteLLM_ManagedFileTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_managedfiletable = await LiteLLM_ManagedFileTable.prisma().update(
            where={
                'id': 'bfgebdfefi',
            },
            data={
                # data to update the LiteLLM_ManagedFileTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ManagedFileTableWhereUniqueInput,
        data: types.LiteLLM_ManagedFileTableUpsertInput,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ManagedFileTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedFileTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedFileTable
            The created or updated LiteLLM_ManagedFileTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedfiletable = await LiteLLM_ManagedFileTable.prisma().upsert(
            where={
                'id': 'jgijgagjb',
            },
            data={
                'create': {
                    'id': 'jgijgagjb',
                    'unified_file_id': 'bhahahadif',
                    'model_mappings': Json({'bijhaihbcg': True}),
                },
                'update': {
                    'unified_file_id': 'bhahahadif',
                    'model_mappings': Json({'bijhaihbcg': True}),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ManagedFileTableUpdateManyMutationInput,
        where: types.LiteLLM_ManagedFileTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ManagedFileTable records

        Parameters
        ----------
        data
            LiteLLM_ManagedFileTable data to update the selected LiteLLM_ManagedFileTable records to
        where
            Filter to select the LiteLLM_ManagedFileTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_ManagedFileTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ManagedFileTable records
        total = await LiteLLM_ManagedFileTable.prisma().update_many(
            data={
                'storage_backend': 'biagjfcfga'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedFileTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedFileTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ManagedFileTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ManagedFileTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedFileTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ManagedFileTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ManagedFileTable.prisma().count()

        # results: prisma.types.LiteLLM_ManagedFileTableCountAggregateOutput
        results = await LiteLLM_ManagedFileTable.prisma().count(
            select={
                '_all': True,
                'storage_url': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ManagedFileTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedFileTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedFileTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_ManagedFileTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ManagedFileTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedFileTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedFileTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ManagedFileTableCountAggregateOutput]:
        """Count the number of LiteLLM_ManagedFileTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ManagedFileTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedFileTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ManagedFileTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ManagedFileTable.prisma().count()

        # results: prisma.types.LiteLLM_ManagedFileTableCountAggregateOutput
        results = await LiteLLM_ManagedFileTable.prisma().count(
            select={
                '_all': True,
                'created_at': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ManagedFileTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ManagedFileTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ManagedFileTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_ManagedFileTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ManagedFileTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ManagedFileTable records
        total = await LiteLLM_ManagedFileTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ManagedFileTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ManagedFileTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ManagedFileTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ManagedFileTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ManagedFileTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ManagedFileTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ManagedFileTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ManagedFileTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ManagedFileTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ManagedFileTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ManagedFileTableGroupByOutput']:
        """Group LiteLLM_ManagedFileTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ManagedFileTable fields to group records by
        where
            LiteLLM_ManagedFileTable filter to select records
        take
            Limit the maximum number of LiteLLM_ManagedFileTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ManagedFileTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_ManagedFileTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ManagedFileTable records by created_by values
        # and count how many records are in each group
        results = await LiteLLM_ManagedFileTable.prisma().group_by(
            ['created_by'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ManagedObjectTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ManagedObjectTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ManagedObjectTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_ManagedObjectTable WHERE id = $1',
            'bggbhejccf',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ManagedObjectTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ManagedObjectTable.prisma().query_first(
            'SELECT * FROM LiteLLM_ManagedObjectTable WHERE unified_object_id = $1',
            'ichjgigcc',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ManagedObjectTableCreateInput,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ManagedObjectTable record.

        Parameters
        ----------
        data
            LiteLLM_ManagedObjectTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedObjectTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedObjectTable
            The created LiteLLM_ManagedObjectTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ManagedObjectTable record from just the required fields
        litellm_managedobjecttable = await LiteLLM_ManagedObjectTable.prisma().create(
            data={
                # data to create a LiteLLM_ManagedObjectTable record
                'unified_object_id': 'bhiiegaibf',
                'model_object_id': 'bdegidheae',
                'file_object': Json({'bddbbjidhd': True}),
                'file_purpose': 'jefedjaji',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ManagedObjectTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ManagedObjectTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ManagedObjectTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ManagedObjectTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ManagedObjectTable record
                    'unified_object_id': 'eicbgeabb',
                    'model_object_id': 'fchjhjjbc',
                    'file_object': Json({'bagfajdjcb': True}),
                    'file_purpose': 'bddhgfeaig',
                },
                {
                    # data to create a LiteLLM_ManagedObjectTable record
                    'unified_object_id': 'bfgchaiff',
                    'model_object_id': 'cifcjfbfg',
                    'file_object': Json({'bdcjigjhd': True}),
                    'file_purpose': 'bfefdahgac',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ManagedObjectTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ManagedObjectTable record.

        Parameters
        ----------
        where
            LiteLLM_ManagedObjectTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedObjectTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedObjectTable
            The deleted LiteLLM_ManagedObjectTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedobjecttable = await LiteLLM_ManagedObjectTable.prisma().delete(
            where={
                'id': 'bichcieged',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ManagedObjectTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ManagedObjectTable record.

        Parameters
        ----------
        where
            LiteLLM_ManagedObjectTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedObjectTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedObjectTable
            The found LiteLLM_ManagedObjectTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedobjecttable = await LiteLLM_ManagedObjectTable.prisma().find_unique(
            where={
                'id': 'caijedigce',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ManagedObjectTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ManagedObjectTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ManagedObjectTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedObjectTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedObjectTable
            The found LiteLLM_ManagedObjectTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedobjecttable = await LiteLLM_ManagedObjectTable.prisma().find_unique_or_raise(
            where={
                'id': 'bebebdfbcj',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedObjectTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedObjectTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedObjectTableOrderByInput, List[types.LiteLLM_ManagedObjectTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedObjectTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ManagedObjectTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ManagedObjectTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ManagedObjectTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedObjectTable model
        order
            Order the returned LiteLLM_ManagedObjectTable records by any field
        distinct
            Filter LiteLLM_ManagedObjectTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ManagedObjectTable]
            The list of all LiteLLM_ManagedObjectTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ManagedObjectTable records
        litellm_managedobjecttables = await LiteLLM_ManagedObjectTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ManagedObjectTable records ordered by the model_object_id field
        litellm_managedobjecttables = await LiteLLM_ManagedObjectTable.prisma().find_many(
            take=5,
            order={
                'model_object_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedObjectTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedObjectTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedObjectTableOrderByInput, List[types.LiteLLM_ManagedObjectTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedObjectTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ManagedObjectTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedObjectTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedObjectTable model
        order
            Order the returned LiteLLM_ManagedObjectTable records by any field
        distinct
            Filter LiteLLM_ManagedObjectTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ManagedObjectTable
            The first LiteLLM_ManagedObjectTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ManagedObjectTable record ordered by the file_object field
        litellm_managedobjecttable = await LiteLLM_ManagedObjectTable.prisma().find_first(
            skip=1,
            order={
                'file_object': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedObjectTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedObjectTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedObjectTableOrderByInput, List[types.LiteLLM_ManagedObjectTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedObjectTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ManagedObjectTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedObjectTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedObjectTable model
        order
            Order the returned LiteLLM_ManagedObjectTable records by any field
        distinct
            Filter LiteLLM_ManagedObjectTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ManagedObjectTable
            The first LiteLLM_ManagedObjectTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ManagedObjectTable record ordered by the file_purpose field
        litellm_managedobjecttable = await LiteLLM_ManagedObjectTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'file_purpose': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ManagedObjectTableUpdateInput,
        where: types.LiteLLM_ManagedObjectTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ManagedObjectTable record.

        Parameters
        ----------
        data
            LiteLLM_ManagedObjectTable record data specifying what to update
        where
            LiteLLM_ManagedObjectTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedObjectTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedObjectTable
            The updated LiteLLM_ManagedObjectTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_managedobjecttable = await LiteLLM_ManagedObjectTable.prisma().update(
            where={
                'id': 'caffheehji',
            },
            data={
                # data to update the LiteLLM_ManagedObjectTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ManagedObjectTableWhereUniqueInput,
        data: types.LiteLLM_ManagedObjectTableUpsertInput,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ManagedObjectTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedObjectTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedObjectTable
            The created or updated LiteLLM_ManagedObjectTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedobjecttable = await LiteLLM_ManagedObjectTable.prisma().upsert(
            where={
                'id': 'hfdidadjj',
            },
            data={
                'create': {
                    'id': 'hfdidadjj',
                    'unified_object_id': 'bfgchaiff',
                    'model_object_id': 'cifcjfbfg',
                    'file_object': Json({'bdcjigjhd': True}),
                    'file_purpose': 'bfefdahgac',
                },
                'update': {
                    'unified_object_id': 'bfgchaiff',
                    'model_object_id': 'cifcjfbfg',
                    'file_object': Json({'bdcjigjhd': True}),
                    'file_purpose': 'bfefdahgac',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ManagedObjectTableUpdateManyMutationInput,
        where: types.LiteLLM_ManagedObjectTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ManagedObjectTable records

        Parameters
        ----------
        data
            LiteLLM_ManagedObjectTable data to update the selected LiteLLM_ManagedObjectTable records to
        where
            Filter to select the LiteLLM_ManagedObjectTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_ManagedObjectTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ManagedObjectTable records
        total = await LiteLLM_ManagedObjectTable.prisma().update_many(
            data={
                'status': 'bcdiiadeae'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedObjectTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedObjectTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ManagedObjectTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ManagedObjectTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedObjectTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ManagedObjectTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ManagedObjectTable.prisma().count()

        # results: prisma.types.LiteLLM_ManagedObjectTableCountAggregateOutput
        results = await LiteLLM_ManagedObjectTable.prisma().count(
            select={
                '_all': True,
                'batch_processed': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ManagedObjectTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedObjectTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedObjectTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_ManagedObjectTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ManagedObjectTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedObjectTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedObjectTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ManagedObjectTableCountAggregateOutput]:
        """Count the number of LiteLLM_ManagedObjectTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ManagedObjectTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedObjectTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ManagedObjectTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ManagedObjectTable.prisma().count()

        # results: prisma.types.LiteLLM_ManagedObjectTableCountAggregateOutput
        results = await LiteLLM_ManagedObjectTable.prisma().count(
            select={
                '_all': True,
                'created_at': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ManagedObjectTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ManagedObjectTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ManagedObjectTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_ManagedObjectTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ManagedObjectTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ManagedObjectTable records
        total = await LiteLLM_ManagedObjectTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ManagedObjectTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ManagedObjectTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ManagedObjectTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ManagedObjectTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ManagedObjectTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ManagedObjectTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ManagedObjectTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ManagedObjectTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ManagedObjectTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ManagedObjectTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ManagedObjectTableGroupByOutput']:
        """Group LiteLLM_ManagedObjectTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ManagedObjectTable fields to group records by
        where
            LiteLLM_ManagedObjectTable filter to select records
        take
            Limit the maximum number of LiteLLM_ManagedObjectTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ManagedObjectTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_ManagedObjectTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ManagedObjectTable records by created_by values
        # and count how many records are in each group
        results = await LiteLLM_ManagedObjectTable.prisma().group_by(
            ['created_by'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ManagedVectorStoreTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ManagedVectorStoreTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ManagedVectorStoreTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_ManagedVectorStoreTable WHERE id = $1',
            'bdhhaeiaif',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ManagedVectorStoreTable.prisma().query_first(
            'SELECT * FROM LiteLLM_ManagedVectorStoreTable WHERE unified_resource_id = $1',
            'caffgabefa',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ManagedVectorStoreTableCreateInput,
        include: Optional[types.LiteLLM_ManagedVectorStoreTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ManagedVectorStoreTable record.

        Parameters
        ----------
        data
            LiteLLM_ManagedVectorStoreTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreTable
            The created LiteLLM_ManagedVectorStoreTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ManagedVectorStoreTable record from just the required fields
        litellm_managedvectorstoretable = await LiteLLM_ManagedVectorStoreTable.prisma().create(
            data={
                # data to create a LiteLLM_ManagedVectorStoreTable record
                'unified_resource_id': 'bjjajgjbbf',
                'model_mappings': Json({'jdecjdgii': True}),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ManagedVectorStoreTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ManagedVectorStoreTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ManagedVectorStoreTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ManagedVectorStoreTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ManagedVectorStoreTable record
                    'unified_resource_id': 'bcgbcdjjfd',
                    'model_mappings': Json({'bicgfdhjhe': True}),
                },
                {
                    # data to create a LiteLLM_ManagedVectorStoreTable record
                    'unified_resource_id': 'ihfjdgceh',
                    'model_mappings': Json({'gdaedbiee': True}),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ManagedVectorStoreTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoreTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ManagedVectorStoreTable record.

        Parameters
        ----------
        where
            LiteLLM_ManagedVectorStoreTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreTable
            The deleted LiteLLM_ManagedVectorStoreTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedvectorstoretable = await LiteLLM_ManagedVectorStoreTable.prisma().delete(
            where={
                'id': 'bibdbbffjh',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ManagedVectorStoreTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoreTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ManagedVectorStoreTable record.

        Parameters
        ----------
        where
            LiteLLM_ManagedVectorStoreTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreTable
            The found LiteLLM_ManagedVectorStoreTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedvectorstoretable = await LiteLLM_ManagedVectorStoreTable.prisma().find_unique(
            where={
                'id': 'bdjfefjjha',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ManagedVectorStoreTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoreTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ManagedVectorStoreTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ManagedVectorStoreTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreTable
            The found LiteLLM_ManagedVectorStoreTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedvectorstoretable = await LiteLLM_ManagedVectorStoreTable.prisma().find_unique_or_raise(
            where={
                'id': 'bjcjfbafeh',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoreTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoreTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedVectorStoreTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedVectorStoreTableOrderByInput, List[types.LiteLLM_ManagedVectorStoreTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedVectorStoreTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ManagedVectorStoreTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ManagedVectorStoreTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ManagedVectorStoreTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreTable model
        order
            Order the returned LiteLLM_ManagedVectorStoreTable records by any field
        distinct
            Filter LiteLLM_ManagedVectorStoreTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ManagedVectorStoreTable]
            The list of all LiteLLM_ManagedVectorStoreTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ManagedVectorStoreTable records
        litellm_managedvectorstoretables = await LiteLLM_ManagedVectorStoreTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ManagedVectorStoreTable records ordered by the resource_object field
        litellm_managedvectorstoretables = await LiteLLM_ManagedVectorStoreTable.prisma().find_many(
            take=5,
            order={
                'resource_object': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoreTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoreTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedVectorStoreTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedVectorStoreTableOrderByInput, List[types.LiteLLM_ManagedVectorStoreTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedVectorStoreTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ManagedVectorStoreTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedVectorStoreTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreTable model
        order
            Order the returned LiteLLM_ManagedVectorStoreTable records by any field
        distinct
            Filter LiteLLM_ManagedVectorStoreTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreTable
            The first LiteLLM_ManagedVectorStoreTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ManagedVectorStoreTable record ordered by the model_mappings field
        litellm_managedvectorstoretable = await LiteLLM_ManagedVectorStoreTable.prisma().find_first(
            skip=1,
            order={
                'model_mappings': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoreTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoreTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedVectorStoreTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedVectorStoreTableOrderByInput, List[types.LiteLLM_ManagedVectorStoreTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedVectorStoreTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ManagedVectorStoreTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedVectorStoreTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreTable model
        order
            Order the returned LiteLLM_ManagedVectorStoreTable records by any field
        distinct
            Filter LiteLLM_ManagedVectorStoreTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreTable
            The first LiteLLM_ManagedVectorStoreTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ManagedVectorStoreTable record ordered by the flat_model_resource_ids field
        litellm_managedvectorstoretable = await LiteLLM_ManagedVectorStoreTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'flat_model_resource_ids': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ManagedVectorStoreTableUpdateInput,
        where: types.LiteLLM_ManagedVectorStoreTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoreTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ManagedVectorStoreTable record.

        Parameters
        ----------
        data
            LiteLLM_ManagedVectorStoreTable record data specifying what to update
        where
            LiteLLM_ManagedVectorStoreTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreTable
            The updated LiteLLM_ManagedVectorStoreTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_managedvectorstoretable = await LiteLLM_ManagedVectorStoreTable.prisma().update(
            where={
                'id': 'bchgjchgjg',
            },
            data={
                # data to update the LiteLLM_ManagedVectorStoreTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ManagedVectorStoreTableWhereUniqueInput,
        data: types.LiteLLM_ManagedVectorStoreTableUpsertInput,
        include: Optional[types.LiteLLM_ManagedVectorStoreTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ManagedVectorStoreTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreTable
            The created or updated LiteLLM_ManagedVectorStoreTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedvectorstoretable = await LiteLLM_ManagedVectorStoreTable.prisma().upsert(
            where={
                'id': 'idgcdejfd',
            },
            data={
                'create': {
                    'id': 'idgcdejfd',
                    'unified_resource_id': 'ihfjdgceh',
                    'model_mappings': Json({'gdaedbiee': True}),
                },
                'update': {
                    'unified_resource_id': 'ihfjdgceh',
                    'model_mappings': Json({'gdaedbiee': True}),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ManagedVectorStoreTableUpdateManyMutationInput,
        where: types.LiteLLM_ManagedVectorStoreTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ManagedVectorStoreTable records

        Parameters
        ----------
        data
            LiteLLM_ManagedVectorStoreTable data to update the selected LiteLLM_ManagedVectorStoreTable records to
        where
            Filter to select the LiteLLM_ManagedVectorStoreTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_ManagedVectorStoreTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ManagedVectorStoreTable records
        total = await LiteLLM_ManagedVectorStoreTable.prisma().update_many(
            data={
                'storage_backend': 'baajcgbaag'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoreTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoreTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ManagedVectorStoreTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ManagedVectorStoreTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedVectorStoreTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ManagedVectorStoreTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ManagedVectorStoreTable.prisma().count()

        # results: prisma.types.LiteLLM_ManagedVectorStoreTableCountAggregateOutput
        results = await LiteLLM_ManagedVectorStoreTable.prisma().count(
            select={
                '_all': True,
                'storage_url': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ManagedVectorStoreTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoreTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoreTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_ManagedVectorStoreTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ManagedVectorStoreTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoreTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoreTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ManagedVectorStoreTableCountAggregateOutput]:
        """Count the number of LiteLLM_ManagedVectorStoreTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ManagedVectorStoreTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedVectorStoreTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ManagedVectorStoreTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ManagedVectorStoreTable.prisma().count()

        # results: prisma.types.LiteLLM_ManagedVectorStoreTableCountAggregateOutput
        results = await LiteLLM_ManagedVectorStoreTable.prisma().count(
            select={
                '_all': True,
                'created_at': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ManagedVectorStoreTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ManagedVectorStoreTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ManagedVectorStoreTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_ManagedVectorStoreTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ManagedVectorStoreTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ManagedVectorStoreTable records
        total = await LiteLLM_ManagedVectorStoreTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ManagedVectorStoreTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ManagedVectorStoreTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ManagedVectorStoreTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ManagedVectorStoreTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ManagedVectorStoreTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ManagedVectorStoreTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ManagedVectorStoreTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ManagedVectorStoreTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ManagedVectorStoreTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ManagedVectorStoreTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ManagedVectorStoreTableGroupByOutput']:
        """Group LiteLLM_ManagedVectorStoreTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ManagedVectorStoreTable fields to group records by
        where
            LiteLLM_ManagedVectorStoreTable filter to select records
        take
            Limit the maximum number of LiteLLM_ManagedVectorStoreTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ManagedVectorStoreTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_ManagedVectorStoreTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ManagedVectorStoreTable records by created_by values
        # and count how many records are in each group
        results = await LiteLLM_ManagedVectorStoreTable.prisma().group_by(
            ['created_by'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ManagedVectorStoresTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ManagedVectorStoresTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ManagedVectorStoresTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_ManagedVectorStoresTable WHERE vector_store_id = $1',
            'eahbafhhf',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoresTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ManagedVectorStoresTable.prisma().query_first(
            'SELECT * FROM LiteLLM_ManagedVectorStoresTable WHERE custom_llm_provider = $1',
            'chbgcaajc',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ManagedVectorStoresTableCreateInput,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ManagedVectorStoresTable record.

        Parameters
        ----------
        data
            LiteLLM_ManagedVectorStoresTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoresTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoresTable
            The created LiteLLM_ManagedVectorStoresTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ManagedVectorStoresTable record from just the required fields
        litellm_managedvectorstorestable = await LiteLLM_ManagedVectorStoresTable.prisma().create(
            data={
                # data to create a LiteLLM_ManagedVectorStoresTable record
                'vector_store_id': 'baafadjcdh',
                'custom_llm_provider': 'beihjdafig',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ManagedVectorStoresTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ManagedVectorStoresTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ManagedVectorStoresTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ManagedVectorStoresTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ManagedVectorStoresTable record
                    'vector_store_id': 'cbdbchfabj',
                    'custom_llm_provider': 'bffjafacbg',
                },
                {
                    # data to create a LiteLLM_ManagedVectorStoresTable record
                    'vector_store_id': 'cbafbcgeab',
                    'custom_llm_provider': 'bedgbciecc',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ManagedVectorStoresTable record.

        Parameters
        ----------
        where
            LiteLLM_ManagedVectorStoresTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoresTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoresTable
            The deleted LiteLLM_ManagedVectorStoresTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedvectorstorestable = await LiteLLM_ManagedVectorStoresTable.prisma().delete(
            where={
                'vector_store_id': 'bfeehfcihb',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ManagedVectorStoresTable record.

        Parameters
        ----------
        where
            LiteLLM_ManagedVectorStoresTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoresTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoresTable
            The found LiteLLM_ManagedVectorStoresTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedvectorstorestable = await LiteLLM_ManagedVectorStoresTable.prisma().find_unique(
            where={
                'vector_store_id': 'ibagheidg',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ManagedVectorStoresTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ManagedVectorStoresTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoresTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoresTable
            The found LiteLLM_ManagedVectorStoresTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedvectorstorestable = await LiteLLM_ManagedVectorStoresTable.prisma().find_unique_or_raise(
            where={
                'vector_store_id': 'bibfefchh',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoresTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedVectorStoresTableOrderByInput, List[types.LiteLLM_ManagedVectorStoresTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedVectorStoresTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ManagedVectorStoresTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ManagedVectorStoresTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ManagedVectorStoresTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoresTable model
        order
            Order the returned LiteLLM_ManagedVectorStoresTable records by any field
        distinct
            Filter LiteLLM_ManagedVectorStoresTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ManagedVectorStoresTable]
            The list of all LiteLLM_ManagedVectorStoresTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ManagedVectorStoresTable records
        litellm_managedvectorstorestables = await LiteLLM_ManagedVectorStoresTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ManagedVectorStoresTable records ordered by the vector_store_name field
        litellm_managedvectorstorestables = await LiteLLM_ManagedVectorStoresTable.prisma().find_many(
            take=5,
            order={
                'vector_store_name': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoresTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedVectorStoresTableOrderByInput, List[types.LiteLLM_ManagedVectorStoresTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedVectorStoresTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ManagedVectorStoresTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedVectorStoresTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoresTable model
        order
            Order the returned LiteLLM_ManagedVectorStoresTable records by any field
        distinct
            Filter LiteLLM_ManagedVectorStoresTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoresTable
            The first LiteLLM_ManagedVectorStoresTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ManagedVectorStoresTable record ordered by the vector_store_description field
        litellm_managedvectorstorestable = await LiteLLM_ManagedVectorStoresTable.prisma().find_first(
            skip=1,
            order={
                'vector_store_description': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoresTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedVectorStoresTableOrderByInput, List[types.LiteLLM_ManagedVectorStoresTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedVectorStoresTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ManagedVectorStoresTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedVectorStoresTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoresTable model
        order
            Order the returned LiteLLM_ManagedVectorStoresTable records by any field
        distinct
            Filter LiteLLM_ManagedVectorStoresTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoresTable
            The first LiteLLM_ManagedVectorStoresTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ManagedVectorStoresTable record ordered by the vector_store_metadata field
        litellm_managedvectorstorestable = await LiteLLM_ManagedVectorStoresTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'vector_store_metadata': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ManagedVectorStoresTableUpdateInput,
        where: types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ManagedVectorStoresTable record.

        Parameters
        ----------
        data
            LiteLLM_ManagedVectorStoresTable record data specifying what to update
        where
            LiteLLM_ManagedVectorStoresTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoresTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoresTable
            The updated LiteLLM_ManagedVectorStoresTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_managedvectorstorestable = await LiteLLM_ManagedVectorStoresTable.prisma().update(
            where={
                'vector_store_id': 'baeeigbje',
            },
            data={
                # data to update the LiteLLM_ManagedVectorStoresTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput,
        data: types.LiteLLM_ManagedVectorStoresTableUpsertInput,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ManagedVectorStoresTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoresTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoresTable
            The created or updated LiteLLM_ManagedVectorStoresTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedvectorstorestable = await LiteLLM_ManagedVectorStoresTable.prisma().upsert(
            where={
                'vector_store_id': 'fibhgbdb',
            },
            data={
                'create': {
                    'vector_store_id': 'fibhgbdb',
                    'custom_llm_provider': 'bedgbciecc',
                },
                'update': {
                    'custom_llm_provider': 'bedgbciecc',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ManagedVectorStoresTableUpdateManyMutationInput,
        where: types.LiteLLM_ManagedVectorStoresTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ManagedVectorStoresTable records

        Parameters
        ----------
        data
            LiteLLM_ManagedVectorStoresTable data to update the selected LiteLLM_ManagedVectorStoresTable records to
        where
            Filter to select the LiteLLM_ManagedVectorStoresTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_ManagedVectorStoresTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ManagedVectorStoresTable records
        total = await LiteLLM_ManagedVectorStoresTable.prisma().update_many(
            data={
                'created_at': datetime.datetime.utcnow()
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoresTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ManagedVectorStoresTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ManagedVectorStoresTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedVectorStoresTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ManagedVectorStoresTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ManagedVectorStoresTable.prisma().count()

        # results: prisma.types.LiteLLM_ManagedVectorStoresTableCountAggregateOutput
        results = await LiteLLM_ManagedVectorStoresTable.prisma().count(
            select={
                '_all': True,
                'updated_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ManagedVectorStoresTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoresTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_ManagedVectorStoresTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ManagedVectorStoresTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoresTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ManagedVectorStoresTableCountAggregateOutput]:
        """Count the number of LiteLLM_ManagedVectorStoresTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ManagedVectorStoresTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedVectorStoresTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ManagedVectorStoresTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ManagedVectorStoresTable.prisma().count()

        # results: prisma.types.LiteLLM_ManagedVectorStoresTableCountAggregateOutput
        results = await LiteLLM_ManagedVectorStoresTable.prisma().count(
            select={
                '_all': True,
                'litellm_credential_name': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ManagedVectorStoresTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ManagedVectorStoresTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ManagedVectorStoresTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_ManagedVectorStoresTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ManagedVectorStoresTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ManagedVectorStoresTable records
        total = await LiteLLM_ManagedVectorStoresTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ManagedVectorStoresTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ManagedVectorStoresTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ManagedVectorStoresTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ManagedVectorStoresTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ManagedVectorStoresTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ManagedVectorStoresTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ManagedVectorStoresTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ManagedVectorStoresTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ManagedVectorStoresTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ManagedVectorStoresTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ManagedVectorStoresTableGroupByOutput']:
        """Group LiteLLM_ManagedVectorStoresTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ManagedVectorStoresTable fields to group records by
        where
            LiteLLM_ManagedVectorStoresTable filter to select records
        take
            Limit the maximum number of LiteLLM_ManagedVectorStoresTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ManagedVectorStoresTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_ManagedVectorStoresTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ManagedVectorStoresTable records by litellm_params values
        # and count how many records are in each group
        results = await LiteLLM_ManagedVectorStoresTable.prisma().group_by(
            ['litellm_params'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_GuardrailsTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_GuardrailsTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_GuardrailsTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_GuardrailsTable WHERE guardrail_id = $1',
            'bbifhfaabg',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_GuardrailsTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_GuardrailsTable.prisma().query_first(
            'SELECT * FROM LiteLLM_GuardrailsTable WHERE guardrail_name = $1',
            'cbbhjdebdh',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_GuardrailsTableCreateInput,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_GuardrailsTable record.

        Parameters
        ----------
        data
            LiteLLM_GuardrailsTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_GuardrailsTable model

        Returns
        -------
        prisma.models.LiteLLM_GuardrailsTable
            The created LiteLLM_GuardrailsTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_GuardrailsTable record from just the required fields
        litellm_guardrailstable = await LiteLLM_GuardrailsTable.prisma().create(
            data={
                # data to create a LiteLLM_GuardrailsTable record
                'guardrail_name': 'hddcfecha',
                'litellm_params': Json({'bibbehhehb': True}),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_GuardrailsTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_GuardrailsTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_GuardrailsTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_GuardrailsTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_GuardrailsTable record
                    'guardrail_name': 'cibfeagfc',
                    'litellm_params': Json({'ibifgbhib': True}),
                },
                {
                    # data to create a LiteLLM_GuardrailsTable record
                    'guardrail_name': 'bgjehbiaja',
                    'litellm_params': Json({'cadgbfjjf': True}),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_GuardrailsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_GuardrailsTable record.

        Parameters
        ----------
        where
            LiteLLM_GuardrailsTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_GuardrailsTable model

        Returns
        -------
        prisma.models.LiteLLM_GuardrailsTable
            The deleted LiteLLM_GuardrailsTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_guardrailstable = await LiteLLM_GuardrailsTable.prisma().delete(
            where={
                'guardrail_id': 'bgceeachbc',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_GuardrailsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_GuardrailsTable record.

        Parameters
        ----------
        where
            LiteLLM_GuardrailsTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_GuardrailsTable model

        Returns
        -------
        prisma.models.LiteLLM_GuardrailsTable
            The found LiteLLM_GuardrailsTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_guardrailstable = await LiteLLM_GuardrailsTable.prisma().find_unique(
            where={
                'guardrail_id': 'bbcaehffaf',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_GuardrailsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_GuardrailsTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_GuardrailsTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_GuardrailsTable model

        Returns
        -------
        prisma.models.LiteLLM_GuardrailsTable
            The found LiteLLM_GuardrailsTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_guardrailstable = await LiteLLM_GuardrailsTable.prisma().find_unique_or_raise(
            where={
                'guardrail_id': 'ddbhhchfi',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_GuardrailsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_GuardrailsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_GuardrailsTableOrderByInput, List[types.LiteLLM_GuardrailsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_GuardrailsTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_GuardrailsTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_GuardrailsTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_GuardrailsTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_GuardrailsTable model
        order
            Order the returned LiteLLM_GuardrailsTable records by any field
        distinct
            Filter LiteLLM_GuardrailsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_GuardrailsTable]
            The list of all LiteLLM_GuardrailsTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_GuardrailsTable records
        litellm_guardrailstables = await LiteLLM_GuardrailsTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_GuardrailsTable records ordered by the litellm_params field
        litellm_guardrailstables = await LiteLLM_GuardrailsTable.prisma().find_many(
            take=5,
            order={
                'litellm_params': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_GuardrailsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_GuardrailsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_GuardrailsTableOrderByInput, List[types.LiteLLM_GuardrailsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_GuardrailsTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_GuardrailsTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_GuardrailsTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_GuardrailsTable model
        order
            Order the returned LiteLLM_GuardrailsTable records by any field
        distinct
            Filter LiteLLM_GuardrailsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_GuardrailsTable
            The first LiteLLM_GuardrailsTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_GuardrailsTable record ordered by the guardrail_info field
        litellm_guardrailstable = await LiteLLM_GuardrailsTable.prisma().find_first(
            skip=1,
            order={
                'guardrail_info': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_GuardrailsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_GuardrailsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_GuardrailsTableOrderByInput, List[types.LiteLLM_GuardrailsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_GuardrailsTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_GuardrailsTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_GuardrailsTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_GuardrailsTable model
        order
            Order the returned LiteLLM_GuardrailsTable records by any field
        distinct
            Filter LiteLLM_GuardrailsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_GuardrailsTable
            The first LiteLLM_GuardrailsTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_GuardrailsTable record ordered by the team_id field
        litellm_guardrailstable = await LiteLLM_GuardrailsTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'team_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_GuardrailsTableUpdateInput,
        where: types.LiteLLM_GuardrailsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_GuardrailsTable record.

        Parameters
        ----------
        data
            LiteLLM_GuardrailsTable record data specifying what to update
        where
            LiteLLM_GuardrailsTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_GuardrailsTable model

        Returns
        -------
        prisma.models.LiteLLM_GuardrailsTable
            The updated LiteLLM_GuardrailsTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_guardrailstable = await LiteLLM_GuardrailsTable.prisma().update(
            where={
                'guardrail_id': 'bidbdafbhf',
            },
            data={
                # data to update the LiteLLM_GuardrailsTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_GuardrailsTableWhereUniqueInput,
        data: types.LiteLLM_GuardrailsTableUpsertInput,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_GuardrailsTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_GuardrailsTable model

        Returns
        -------
        prisma.models.LiteLLM_GuardrailsTable
            The created or updated LiteLLM_GuardrailsTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_guardrailstable = await LiteLLM_GuardrailsTable.prisma().upsert(
            where={
                'guardrail_id': 'caehibbhia',
            },
            data={
                'create': {
                    'guardrail_id': 'caehibbhia',
                    'guardrail_name': 'bgjehbiaja',
                    'litellm_params': Json({'cadgbfjjf': True}),
                },
                'update': {
                    'guardrail_name': 'bgjehbiaja',
                    'litellm_params': Json({'cadgbfjjf': True}),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_GuardrailsTableUpdateManyMutationInput,
        where: types.LiteLLM_GuardrailsTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_GuardrailsTable records

        Parameters
        ----------
        data
            LiteLLM_GuardrailsTable data to update the selected LiteLLM_GuardrailsTable records to
        where
            Filter to select the LiteLLM_GuardrailsTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_GuardrailsTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_GuardrailsTable records
        total = await LiteLLM_GuardrailsTable.prisma().update_many(
            data={
                'created_at': datetime.datetime.utcnow()
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_GuardrailsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_GuardrailsTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_GuardrailsTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_GuardrailsTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_GuardrailsTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_GuardrailsTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_GuardrailsTable.prisma().count()

        # results: prisma.types.LiteLLM_GuardrailsTableCountAggregateOutput
        results = await LiteLLM_GuardrailsTable.prisma().count(
            select={
                '_all': True,
                'updated_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_GuardrailsTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_GuardrailsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_GuardrailsTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_GuardrailsTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_GuardrailsTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_GuardrailsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_GuardrailsTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_GuardrailsTableCountAggregateOutput]:
        """Count the number of LiteLLM_GuardrailsTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_GuardrailsTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_GuardrailsTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_GuardrailsTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_GuardrailsTable.prisma().count()

        # results: prisma.types.LiteLLM_GuardrailsTableCountAggregateOutput
        results = await LiteLLM_GuardrailsTable.prisma().count(
            select={
                '_all': True,
                'status': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_GuardrailsTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_GuardrailsTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_GuardrailsTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_GuardrailsTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_GuardrailsTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_GuardrailsTable records
        total = await LiteLLM_GuardrailsTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_GuardrailsTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_GuardrailsTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_GuardrailsTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_GuardrailsTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_GuardrailsTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_GuardrailsTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_GuardrailsTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_GuardrailsTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_GuardrailsTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_GuardrailsTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_GuardrailsTableGroupByOutput']:
        """Group LiteLLM_GuardrailsTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_GuardrailsTable fields to group records by
        where
            LiteLLM_GuardrailsTable filter to select records
        take
            Limit the maximum number of LiteLLM_GuardrailsTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_GuardrailsTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_GuardrailsTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_GuardrailsTable records by submitted_at values
        # and count how many records are in each group
        results = await LiteLLM_GuardrailsTable.prisma().group_by(
            ['submitted_at'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_DailyGuardrailMetricsActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_DailyGuardrailMetrics]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_DailyGuardrailMetrics.prisma().query_raw(
            'SELECT * FROM LiteLLM_DailyGuardrailMetrics WHERE guardrail_id = $1',
            'iafgcehej',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_DailyGuardrailMetrics
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_DailyGuardrailMetrics.prisma().query_first(
            'SELECT * FROM LiteLLM_DailyGuardrailMetrics WHERE date = $1',
            'bbaeaehiec',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_DailyGuardrailMetricsCreateInput,
        include: Optional[types.LiteLLM_DailyGuardrailMetricsInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_DailyGuardrailMetrics record.

        Parameters
        ----------
        data
            LiteLLM_DailyGuardrailMetrics record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyGuardrailMetrics model

        Returns
        -------
        prisma.models.LiteLLM_DailyGuardrailMetrics
            The created LiteLLM_DailyGuardrailMetrics record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_DailyGuardrailMetrics record from just the required fields
        litellm_dailyguardrailmetrics = await LiteLLM_DailyGuardrailMetrics.prisma().create(
            data={
                # data to create a LiteLLM_DailyGuardrailMetrics record
                'guardrail_id': 'cfjghaged',
                'date': 'biggeddiea',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_DailyGuardrailMetricsCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_DailyGuardrailMetrics records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_DailyGuardrailMetrics record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_DailyGuardrailMetrics.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_DailyGuardrailMetrics record
                    'guardrail_id': 'biahhhjceb',
                    'date': 'bdjjdgddhe',
                },
                {
                    # data to create a LiteLLM_DailyGuardrailMetrics record
                    'guardrail_id': 'cbaaahdbgh',
                    'date': 'cahhcbdhii',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_DailyGuardrailMetricsWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyGuardrailMetricsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_DailyGuardrailMetrics record.

        Parameters
        ----------
        where
            LiteLLM_DailyGuardrailMetrics filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyGuardrailMetrics model

        Returns
        -------
        prisma.models.LiteLLM_DailyGuardrailMetrics
            The deleted LiteLLM_DailyGuardrailMetrics record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyguardrailmetrics = await LiteLLM_DailyGuardrailMetrics.prisma().delete(
            where={
                # LiteLLM_DailyGuardrailMetrics where unique filter

            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_DailyGuardrailMetricsWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyGuardrailMetricsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_DailyGuardrailMetrics record.

        Parameters
        ----------
        where
            LiteLLM_DailyGuardrailMetrics filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyGuardrailMetrics model

        Returns
        -------
        prisma.models.LiteLLM_DailyGuardrailMetrics
            The found LiteLLM_DailyGuardrailMetrics record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyguardrailmetrics = await LiteLLM_DailyGuardrailMetrics.prisma().find_unique(
            where={
                # LiteLLM_DailyGuardrailMetrics where unique filter

            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_DailyGuardrailMetricsWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyGuardrailMetricsInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_DailyGuardrailMetrics record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_DailyGuardrailMetrics filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyGuardrailMetrics model

        Returns
        -------
        prisma.models.LiteLLM_DailyGuardrailMetrics
            The found LiteLLM_DailyGuardrailMetrics record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyguardrailmetrics = await LiteLLM_DailyGuardrailMetrics.prisma().find_unique_or_raise(
            where={
                # LiteLLM_DailyGuardrailMetrics where unique filter

            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyGuardrailMetricsWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyGuardrailMetricsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyGuardrailMetricsInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyGuardrailMetricsOrderByInput, List[types.LiteLLM_DailyGuardrailMetricsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyGuardrailMetricsScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_DailyGuardrailMetrics records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_DailyGuardrailMetrics records returned
        skip
            Ignore the first N results
        where
            LiteLLM_DailyGuardrailMetrics filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyGuardrailMetrics model
        order
            Order the returned LiteLLM_DailyGuardrailMetrics records by any field
        distinct
            Filter LiteLLM_DailyGuardrailMetrics records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_DailyGuardrailMetrics]
            The list of all LiteLLM_DailyGuardrailMetrics records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_DailyGuardrailMetrics records
        litellm_dailyguardrailmetrics = await LiteLLM_DailyGuardrailMetrics.prisma().find_many(take=10)

        # find the first 5 LiteLLM_DailyGuardrailMetrics records ordered by the requests_evaluated field
        litellm_dailyguardrailmetrics = await LiteLLM_DailyGuardrailMetrics.prisma().find_many(
            take=5,
            order={
                'requests_evaluated': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyGuardrailMetricsWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyGuardrailMetricsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyGuardrailMetricsInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyGuardrailMetricsOrderByInput, List[types.LiteLLM_DailyGuardrailMetricsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyGuardrailMetricsScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_DailyGuardrailMetrics record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyGuardrailMetrics filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyGuardrailMetrics model
        order
            Order the returned LiteLLM_DailyGuardrailMetrics records by any field
        distinct
            Filter LiteLLM_DailyGuardrailMetrics records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyGuardrailMetrics
            The first LiteLLM_DailyGuardrailMetrics record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyGuardrailMetrics record ordered by the passed_count field
        litellm_dailyguardrailmetrics = await LiteLLM_DailyGuardrailMetrics.prisma().find_first(
            skip=1,
            order={
                'passed_count': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyGuardrailMetricsWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyGuardrailMetricsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyGuardrailMetricsInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyGuardrailMetricsOrderByInput, List[types.LiteLLM_DailyGuardrailMetricsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyGuardrailMetricsScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_DailyGuardrailMetrics record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyGuardrailMetrics filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyGuardrailMetrics model
        order
            Order the returned LiteLLM_DailyGuardrailMetrics records by any field
        distinct
            Filter LiteLLM_DailyGuardrailMetrics records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyGuardrailMetrics
            The first LiteLLM_DailyGuardrailMetrics record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyGuardrailMetrics record ordered by the blocked_count field
        litellm_dailyguardrailmetrics = await LiteLLM_DailyGuardrailMetrics.prisma().find_first_or_raise(
            skip=1,
            order={
                'blocked_count': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_DailyGuardrailMetricsUpdateInput,
        where: types.LiteLLM_DailyGuardrailMetricsWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyGuardrailMetricsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_DailyGuardrailMetrics record.

        Parameters
        ----------
        data
            LiteLLM_DailyGuardrailMetrics record data specifying what to update
        where
            LiteLLM_DailyGuardrailMetrics filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyGuardrailMetrics model

        Returns
        -------
        prisma.models.LiteLLM_DailyGuardrailMetrics
            The updated LiteLLM_DailyGuardrailMetrics record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_dailyguardrailmetrics = await LiteLLM_DailyGuardrailMetrics.prisma().update(
            where={
                # LiteLLM_DailyGuardrailMetrics where unique filter

            },
            data={
                # data to update the LiteLLM_DailyGuardrailMetrics record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_DailyGuardrailMetricsWhereUniqueInput,
        data: types.LiteLLM_DailyGuardrailMetricsUpsertInput,
        include: Optional[types.LiteLLM_DailyGuardrailMetricsInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_DailyGuardrailMetrics filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyGuardrailMetrics model

        Returns
        -------
        prisma.models.LiteLLM_DailyGuardrailMetrics
            The created or updated LiteLLM_DailyGuardrailMetrics record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailyguardrailmetrics = await LiteLLM_DailyGuardrailMetrics.prisma().upsert(
            where={
                # LiteLLM_DailyGuardrailMetrics where unique filter
            },
            data={
                'create': {
                    # LiteLLM_DailyGuardrailMetrics data to be set if the record does not exist
                },
                'update': {
                    # LiteLLM_DailyGuardrailMetrics data to be set if the record does exist
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_DailyGuardrailMetricsUpdateManyMutationInput,
        where: types.LiteLLM_DailyGuardrailMetricsWhereInput,
    ) -> int:
        """Update multiple LiteLLM_DailyGuardrailMetrics records

        Parameters
        ----------
        data
            LiteLLM_DailyGuardrailMetrics data to update the selected LiteLLM_DailyGuardrailMetrics records to
        where
            Filter to select the LiteLLM_DailyGuardrailMetrics records to update

        Returns
        -------
        int
            The total number of LiteLLM_DailyGuardrailMetrics records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_DailyGuardrailMetrics records
        total = await LiteLLM_DailyGuardrailMetrics.prisma().update_many(
            data={
                'flagged_count': 12975204540
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyGuardrailMetricsWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyGuardrailMetricsWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_DailyGuardrailMetrics records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyGuardrailMetrics fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyGuardrailMetrics filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyGuardrailMetricsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyGuardrailMetrics.prisma().count()

        # results: prisma.types.LiteLLM_DailyGuardrailMetricsCountAggregateOutput
        results = await LiteLLM_DailyGuardrailMetrics.prisma().count(
            select={
                '_all': True,
                'avg_score': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_DailyGuardrailMetricsCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyGuardrailMetricsWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyGuardrailMetricsWhereUniqueInput] = None,
    ) -> types.LiteLLM_DailyGuardrailMetricsCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_DailyGuardrailMetricsCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyGuardrailMetricsWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyGuardrailMetricsWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_DailyGuardrailMetricsCountAggregateOutput]:
        """Count the number of LiteLLM_DailyGuardrailMetrics records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyGuardrailMetrics fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyGuardrailMetrics filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyGuardrailMetricsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyGuardrailMetrics.prisma().count()

        # results: prisma.types.LiteLLM_DailyGuardrailMetricsCountAggregateOutput
        results = await LiteLLM_DailyGuardrailMetrics.prisma().count(
            select={
                '_all': True,
                'avg_latency_ms': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_DailyGuardrailMetricsCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_DailyGuardrailMetricsWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_DailyGuardrailMetrics records.

        Parameters
        ----------
        where
            Optional LiteLLM_DailyGuardrailMetrics filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_DailyGuardrailMetrics records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_DailyGuardrailMetrics records
        total = await LiteLLM_DailyGuardrailMetrics.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_DailyGuardrailMetricsScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_DailyGuardrailMetricsWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_DailyGuardrailMetricsAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_DailyGuardrailMetricsSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_DailyGuardrailMetricsMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_DailyGuardrailMetricsMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_DailyGuardrailMetricsScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_DailyGuardrailMetricsCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_DailyGuardrailMetricsScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_DailyGuardrailMetricsScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_DailyGuardrailMetricsGroupByOutput']:
        """Group LiteLLM_DailyGuardrailMetrics records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_DailyGuardrailMetrics fields to group records by
        where
            LiteLLM_DailyGuardrailMetrics filter to select records
        take
            Limit the maximum number of LiteLLM_DailyGuardrailMetrics records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_DailyGuardrailMetricsGroupByOutput]
            A list of dictionaries representing the LiteLLM_DailyGuardrailMetrics record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_DailyGuardrailMetrics records by created_at values
        # and count how many records are in each group
        results = await LiteLLM_DailyGuardrailMetrics.prisma().group_by(
            ['created_at'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_DailyPolicyMetricsActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_DailyPolicyMetrics]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_DailyPolicyMetrics.prisma().query_raw(
            'SELECT * FROM LiteLLM_DailyPolicyMetrics WHERE policy_id = $1',
            'dajaaacfa',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_DailyPolicyMetrics
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_DailyPolicyMetrics.prisma().query_first(
            'SELECT * FROM LiteLLM_DailyPolicyMetrics WHERE date = $1',
            'gdibgabah',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_DailyPolicyMetricsCreateInput,
        include: Optional[types.LiteLLM_DailyPolicyMetricsInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_DailyPolicyMetrics record.

        Parameters
        ----------
        data
            LiteLLM_DailyPolicyMetrics record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyPolicyMetrics model

        Returns
        -------
        prisma.models.LiteLLM_DailyPolicyMetrics
            The created LiteLLM_DailyPolicyMetrics record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_DailyPolicyMetrics record from just the required fields
        litellm_dailypolicymetrics = await LiteLLM_DailyPolicyMetrics.prisma().create(
            data={
                # data to create a LiteLLM_DailyPolicyMetrics record
                'policy_id': 'bbdgidjcea',
                'date': 'bigggbcjgb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_DailyPolicyMetricsCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_DailyPolicyMetrics records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_DailyPolicyMetrics record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_DailyPolicyMetrics.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_DailyPolicyMetrics record
                    'policy_id': 'bfhhaicdhe',
                    'date': 'bgdeigedch',
                },
                {
                    # data to create a LiteLLM_DailyPolicyMetrics record
                    'policy_id': 'gedhbbhdc',
                    'date': 'bcgcffdgcj',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_DailyPolicyMetricsWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyPolicyMetricsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_DailyPolicyMetrics record.

        Parameters
        ----------
        where
            LiteLLM_DailyPolicyMetrics filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyPolicyMetrics model

        Returns
        -------
        prisma.models.LiteLLM_DailyPolicyMetrics
            The deleted LiteLLM_DailyPolicyMetrics record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailypolicymetrics = await LiteLLM_DailyPolicyMetrics.prisma().delete(
            where={
                # LiteLLM_DailyPolicyMetrics where unique filter

            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_DailyPolicyMetricsWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyPolicyMetricsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_DailyPolicyMetrics record.

        Parameters
        ----------
        where
            LiteLLM_DailyPolicyMetrics filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyPolicyMetrics model

        Returns
        -------
        prisma.models.LiteLLM_DailyPolicyMetrics
            The found LiteLLM_DailyPolicyMetrics record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailypolicymetrics = await LiteLLM_DailyPolicyMetrics.prisma().find_unique(
            where={
                # LiteLLM_DailyPolicyMetrics where unique filter

            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_DailyPolicyMetricsWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyPolicyMetricsInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_DailyPolicyMetrics record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_DailyPolicyMetrics filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyPolicyMetrics model

        Returns
        -------
        prisma.models.LiteLLM_DailyPolicyMetrics
            The found LiteLLM_DailyPolicyMetrics record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailypolicymetrics = await LiteLLM_DailyPolicyMetrics.prisma().find_unique_or_raise(
            where={
                # LiteLLM_DailyPolicyMetrics where unique filter

            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyPolicyMetricsWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyPolicyMetricsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyPolicyMetricsInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyPolicyMetricsOrderByInput, List[types.LiteLLM_DailyPolicyMetricsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyPolicyMetricsScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_DailyPolicyMetrics records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_DailyPolicyMetrics records returned
        skip
            Ignore the first N results
        where
            LiteLLM_DailyPolicyMetrics filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyPolicyMetrics model
        order
            Order the returned LiteLLM_DailyPolicyMetrics records by any field
        distinct
            Filter LiteLLM_DailyPolicyMetrics records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_DailyPolicyMetrics]
            The list of all LiteLLM_DailyPolicyMetrics records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_DailyPolicyMetrics records
        litellm_dailypolicymetrics = await LiteLLM_DailyPolicyMetrics.prisma().find_many(take=10)

        # find the first 5 LiteLLM_DailyPolicyMetrics records ordered by the requests_evaluated field
        litellm_dailypolicymetrics = await LiteLLM_DailyPolicyMetrics.prisma().find_many(
            take=5,
            order={
                'requests_evaluated': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyPolicyMetricsWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyPolicyMetricsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyPolicyMetricsInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyPolicyMetricsOrderByInput, List[types.LiteLLM_DailyPolicyMetricsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyPolicyMetricsScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_DailyPolicyMetrics record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyPolicyMetrics filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyPolicyMetrics model
        order
            Order the returned LiteLLM_DailyPolicyMetrics records by any field
        distinct
            Filter LiteLLM_DailyPolicyMetrics records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyPolicyMetrics
            The first LiteLLM_DailyPolicyMetrics record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyPolicyMetrics record ordered by the passed_count field
        litellm_dailypolicymetrics = await LiteLLM_DailyPolicyMetrics.prisma().find_first(
            skip=1,
            order={
                'passed_count': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyPolicyMetricsWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyPolicyMetricsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_DailyPolicyMetricsInclude] = None,
        order: Optional[Union[types.LiteLLM_DailyPolicyMetricsOrderByInput, List[types.LiteLLM_DailyPolicyMetricsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_DailyPolicyMetricsScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_DailyPolicyMetrics record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_DailyPolicyMetrics filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyPolicyMetrics model
        order
            Order the returned LiteLLM_DailyPolicyMetrics records by any field
        distinct
            Filter LiteLLM_DailyPolicyMetrics records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_DailyPolicyMetrics
            The first LiteLLM_DailyPolicyMetrics record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_DailyPolicyMetrics record ordered by the blocked_count field
        litellm_dailypolicymetrics = await LiteLLM_DailyPolicyMetrics.prisma().find_first_or_raise(
            skip=1,
            order={
                'blocked_count': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_DailyPolicyMetricsUpdateInput,
        where: types.LiteLLM_DailyPolicyMetricsWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyPolicyMetricsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_DailyPolicyMetrics record.

        Parameters
        ----------
        data
            LiteLLM_DailyPolicyMetrics record data specifying what to update
        where
            LiteLLM_DailyPolicyMetrics filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyPolicyMetrics model

        Returns
        -------
        prisma.models.LiteLLM_DailyPolicyMetrics
            The updated LiteLLM_DailyPolicyMetrics record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_dailypolicymetrics = await LiteLLM_DailyPolicyMetrics.prisma().update(
            where={
                # LiteLLM_DailyPolicyMetrics where unique filter

            },
            data={
                # data to update the LiteLLM_DailyPolicyMetrics record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_DailyPolicyMetricsWhereUniqueInput,
        data: types.LiteLLM_DailyPolicyMetricsUpsertInput,
        include: Optional[types.LiteLLM_DailyPolicyMetricsInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_DailyPolicyMetrics filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_DailyPolicyMetrics model

        Returns
        -------
        prisma.models.LiteLLM_DailyPolicyMetrics
            The created or updated LiteLLM_DailyPolicyMetrics record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_dailypolicymetrics = await LiteLLM_DailyPolicyMetrics.prisma().upsert(
            where={
                # LiteLLM_DailyPolicyMetrics where unique filter
            },
            data={
                'create': {
                    # LiteLLM_DailyPolicyMetrics data to be set if the record does not exist
                },
                'update': {
                    # LiteLLM_DailyPolicyMetrics data to be set if the record does exist
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_DailyPolicyMetricsUpdateManyMutationInput,
        where: types.LiteLLM_DailyPolicyMetricsWhereInput,
    ) -> int:
        """Update multiple LiteLLM_DailyPolicyMetrics records

        Parameters
        ----------
        data
            LiteLLM_DailyPolicyMetrics data to update the selected LiteLLM_DailyPolicyMetrics records to
        where
            Filter to select the LiteLLM_DailyPolicyMetrics records to update

        Returns
        -------
        int
            The total number of LiteLLM_DailyPolicyMetrics records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_DailyPolicyMetrics records
        total = await LiteLLM_DailyPolicyMetrics.prisma().update_many(
            data={
                'flagged_count': 2255746776
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyPolicyMetricsWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyPolicyMetricsWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_DailyPolicyMetrics records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyPolicyMetrics fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyPolicyMetrics filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyPolicyMetricsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyPolicyMetrics.prisma().count()

        # results: prisma.types.LiteLLM_DailyPolicyMetricsCountAggregateOutput
        results = await LiteLLM_DailyPolicyMetrics.prisma().count(
            select={
                '_all': True,
                'avg_score': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_DailyPolicyMetricsCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyPolicyMetricsWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyPolicyMetricsWhereUniqueInput] = None,
    ) -> types.LiteLLM_DailyPolicyMetricsCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_DailyPolicyMetricsCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_DailyPolicyMetricsWhereInput] = None,
        cursor: Optional[types.LiteLLM_DailyPolicyMetricsWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_DailyPolicyMetricsCountAggregateOutput]:
        """Count the number of LiteLLM_DailyPolicyMetrics records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_DailyPolicyMetrics fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_DailyPolicyMetrics filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_DailyPolicyMetricsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_DailyPolicyMetrics.prisma().count()

        # results: prisma.types.LiteLLM_DailyPolicyMetricsCountAggregateOutput
        results = await LiteLLM_DailyPolicyMetrics.prisma().count(
            select={
                '_all': True,
                'avg_latency_ms': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_DailyPolicyMetricsCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_DailyPolicyMetricsWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_DailyPolicyMetrics records.

        Parameters
        ----------
        where
            Optional LiteLLM_DailyPolicyMetrics filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_DailyPolicyMetrics records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_DailyPolicyMetrics records
        total = await LiteLLM_DailyPolicyMetrics.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_DailyPolicyMetricsScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_DailyPolicyMetricsWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_DailyPolicyMetricsAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_DailyPolicyMetricsSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_DailyPolicyMetricsMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_DailyPolicyMetricsMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_DailyPolicyMetricsScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_DailyPolicyMetricsCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_DailyPolicyMetricsScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_DailyPolicyMetricsScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_DailyPolicyMetricsGroupByOutput']:
        """Group LiteLLM_DailyPolicyMetrics records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_DailyPolicyMetrics fields to group records by
        where
            LiteLLM_DailyPolicyMetrics filter to select records
        take
            Limit the maximum number of LiteLLM_DailyPolicyMetrics records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_DailyPolicyMetricsGroupByOutput]
            A list of dictionaries representing the LiteLLM_DailyPolicyMetrics record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_DailyPolicyMetrics records by created_at values
        # and count how many records are in each group
        results = await LiteLLM_DailyPolicyMetrics.prisma().group_by(
            ['created_at'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_SpendLogGuardrailIndexActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_SpendLogGuardrailIndex]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_SpendLogGuardrailIndex.prisma().query_raw(
            'SELECT * FROM LiteLLM_SpendLogGuardrailIndex WHERE request_id = $1',
            'ididibbff',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_SpendLogGuardrailIndex
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_SpendLogGuardrailIndex.prisma().query_first(
            'SELECT * FROM LiteLLM_SpendLogGuardrailIndex WHERE guardrail_id = $1',
            'cgbfcibga',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_SpendLogGuardrailIndexCreateInput,
        include: Optional[types.LiteLLM_SpendLogGuardrailIndexInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_SpendLogGuardrailIndex record.

        Parameters
        ----------
        data
            LiteLLM_SpendLogGuardrailIndex record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogGuardrailIndex model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogGuardrailIndex
            The created LiteLLM_SpendLogGuardrailIndex record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_SpendLogGuardrailIndex record from just the required fields
        litellm_spendlogguardrailindex = await LiteLLM_SpendLogGuardrailIndex.prisma().create(
            data={
                # data to create a LiteLLM_SpendLogGuardrailIndex record
                'request_id': 'bcibjgahcj',
                'guardrail_id': 'bbbbedfcda',
                'start_time': datetime.datetime.utcnow(),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_SpendLogGuardrailIndexCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_SpendLogGuardrailIndex records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_SpendLogGuardrailIndex record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_SpendLogGuardrailIndex.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_SpendLogGuardrailIndex record
                    'request_id': 'gejjhdbid',
                    'guardrail_id': 'bjfaacchjg',
                    'start_time': datetime.datetime.utcnow(),
                },
                {
                    # data to create a LiteLLM_SpendLogGuardrailIndex record
                    'request_id': 'beeigdcchh',
                    'guardrail_id': 'bgihcicggg',
                    'start_time': datetime.datetime.utcnow(),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_SpendLogGuardrailIndexWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogGuardrailIndexInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_SpendLogGuardrailIndex record.

        Parameters
        ----------
        where
            LiteLLM_SpendLogGuardrailIndex filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogGuardrailIndex model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogGuardrailIndex
            The deleted LiteLLM_SpendLogGuardrailIndex record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_spendlogguardrailindex = await LiteLLM_SpendLogGuardrailIndex.prisma().delete(
            where={
                # LiteLLM_SpendLogGuardrailIndex where unique filter

            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_SpendLogGuardrailIndexWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogGuardrailIndexInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_SpendLogGuardrailIndex record.

        Parameters
        ----------
        where
            LiteLLM_SpendLogGuardrailIndex filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogGuardrailIndex model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogGuardrailIndex
            The found LiteLLM_SpendLogGuardrailIndex record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_spendlogguardrailindex = await LiteLLM_SpendLogGuardrailIndex.prisma().find_unique(
            where={
                # LiteLLM_SpendLogGuardrailIndex where unique filter

            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_SpendLogGuardrailIndexWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogGuardrailIndexInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_SpendLogGuardrailIndex record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_SpendLogGuardrailIndex filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogGuardrailIndex model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogGuardrailIndex
            The found LiteLLM_SpendLogGuardrailIndex record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_spendlogguardrailindex = await LiteLLM_SpendLogGuardrailIndex.prisma().find_unique_or_raise(
            where={
                # LiteLLM_SpendLogGuardrailIndex where unique filter

            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SpendLogGuardrailIndexInclude] = None,
        order: Optional[Union[types.LiteLLM_SpendLogGuardrailIndexOrderByInput, List[types.LiteLLM_SpendLogGuardrailIndexOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SpendLogGuardrailIndexScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_SpendLogGuardrailIndex records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_SpendLogGuardrailIndex records returned
        skip
            Ignore the first N results
        where
            LiteLLM_SpendLogGuardrailIndex filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogGuardrailIndex model
        order
            Order the returned LiteLLM_SpendLogGuardrailIndex records by any field
        distinct
            Filter LiteLLM_SpendLogGuardrailIndex records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_SpendLogGuardrailIndex]
            The list of all LiteLLM_SpendLogGuardrailIndex records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_SpendLogGuardrailIndex records
        litellm_spendlogguardrailindexs = await LiteLLM_SpendLogGuardrailIndex.prisma().find_many(take=10)

        # find the first 5 LiteLLM_SpendLogGuardrailIndex records ordered by the policy_id field
        litellm_spendlogguardrailindexs = await LiteLLM_SpendLogGuardrailIndex.prisma().find_many(
            take=5,
            order={
                'policy_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SpendLogGuardrailIndexInclude] = None,
        order: Optional[Union[types.LiteLLM_SpendLogGuardrailIndexOrderByInput, List[types.LiteLLM_SpendLogGuardrailIndexOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SpendLogGuardrailIndexScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_SpendLogGuardrailIndex record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_SpendLogGuardrailIndex filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogGuardrailIndex model
        order
            Order the returned LiteLLM_SpendLogGuardrailIndex records by any field
        distinct
            Filter LiteLLM_SpendLogGuardrailIndex records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_SpendLogGuardrailIndex
            The first LiteLLM_SpendLogGuardrailIndex record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_SpendLogGuardrailIndex record ordered by the start_time field
        litellm_spendlogguardrailindex = await LiteLLM_SpendLogGuardrailIndex.prisma().find_first(
            skip=1,
            order={
                'start_time': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SpendLogGuardrailIndexInclude] = None,
        order: Optional[Union[types.LiteLLM_SpendLogGuardrailIndexOrderByInput, List[types.LiteLLM_SpendLogGuardrailIndexOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SpendLogGuardrailIndexScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_SpendLogGuardrailIndex record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_SpendLogGuardrailIndex filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogGuardrailIndex model
        order
            Order the returned LiteLLM_SpendLogGuardrailIndex records by any field
        distinct
            Filter LiteLLM_SpendLogGuardrailIndex records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_SpendLogGuardrailIndex
            The first LiteLLM_SpendLogGuardrailIndex record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_SpendLogGuardrailIndex record ordered by the request_id field
        litellm_spendlogguardrailindex = await LiteLLM_SpendLogGuardrailIndex.prisma().find_first_or_raise(
            skip=1,
            order={
                'request_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_SpendLogGuardrailIndexUpdateInput,
        where: types.LiteLLM_SpendLogGuardrailIndexWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogGuardrailIndexInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_SpendLogGuardrailIndex record.

        Parameters
        ----------
        data
            LiteLLM_SpendLogGuardrailIndex record data specifying what to update
        where
            LiteLLM_SpendLogGuardrailIndex filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogGuardrailIndex model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogGuardrailIndex
            The updated LiteLLM_SpendLogGuardrailIndex record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_spendlogguardrailindex = await LiteLLM_SpendLogGuardrailIndex.prisma().update(
            where={
                # LiteLLM_SpendLogGuardrailIndex where unique filter

            },
            data={
                # data to update the LiteLLM_SpendLogGuardrailIndex record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_SpendLogGuardrailIndexWhereUniqueInput,
        data: types.LiteLLM_SpendLogGuardrailIndexUpsertInput,
        include: Optional[types.LiteLLM_SpendLogGuardrailIndexInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_SpendLogGuardrailIndex filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogGuardrailIndex model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogGuardrailIndex
            The created or updated LiteLLM_SpendLogGuardrailIndex record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_spendlogguardrailindex = await LiteLLM_SpendLogGuardrailIndex.prisma().upsert(
            where={
                # LiteLLM_SpendLogGuardrailIndex where unique filter
            },
            data={
                'create': {
                    # LiteLLM_SpendLogGuardrailIndex data to be set if the record does not exist
                },
                'update': {
                    # LiteLLM_SpendLogGuardrailIndex data to be set if the record does exist
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_SpendLogGuardrailIndexUpdateManyMutationInput,
        where: types.LiteLLM_SpendLogGuardrailIndexWhereInput,
    ) -> int:
        """Update multiple LiteLLM_SpendLogGuardrailIndex records

        Parameters
        ----------
        data
            LiteLLM_SpendLogGuardrailIndex data to update the selected LiteLLM_SpendLogGuardrailIndex records to
        where
            Filter to select the LiteLLM_SpendLogGuardrailIndex records to update

        Returns
        -------
        int
            The total number of LiteLLM_SpendLogGuardrailIndex records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_SpendLogGuardrailIndex records
        total = await LiteLLM_SpendLogGuardrailIndex.prisma().update_many(
            data={
                'guardrail_id': 'bjiiifffbf'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_SpendLogGuardrailIndex records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_SpendLogGuardrailIndex fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_SpendLogGuardrailIndex filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_SpendLogGuardrailIndexCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_SpendLogGuardrailIndex.prisma().count()

        # results: prisma.types.LiteLLM_SpendLogGuardrailIndexCountAggregateOutput
        results = await LiteLLM_SpendLogGuardrailIndex.prisma().count(
            select={
                '_all': True,
                'policy_id': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_SpendLogGuardrailIndexCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereUniqueInput] = None,
    ) -> types.LiteLLM_SpendLogGuardrailIndexCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_SpendLogGuardrailIndexCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_SpendLogGuardrailIndexCountAggregateOutput]:
        """Count the number of LiteLLM_SpendLogGuardrailIndex records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_SpendLogGuardrailIndex fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_SpendLogGuardrailIndex filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_SpendLogGuardrailIndexCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_SpendLogGuardrailIndex.prisma().count()

        # results: prisma.types.LiteLLM_SpendLogGuardrailIndexCountAggregateOutput
        results = await LiteLLM_SpendLogGuardrailIndex.prisma().count(
            select={
                '_all': True,
                'start_time': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_SpendLogGuardrailIndexCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_SpendLogGuardrailIndexWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_SpendLogGuardrailIndex records.

        Parameters
        ----------
        where
            Optional LiteLLM_SpendLogGuardrailIndex filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_SpendLogGuardrailIndex records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_SpendLogGuardrailIndex records
        total = await LiteLLM_SpendLogGuardrailIndex.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_SpendLogGuardrailIndexScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_SpendLogGuardrailIndexWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_SpendLogGuardrailIndexAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_SpendLogGuardrailIndexSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_SpendLogGuardrailIndexMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_SpendLogGuardrailIndexMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_SpendLogGuardrailIndexScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_SpendLogGuardrailIndexCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_SpendLogGuardrailIndexScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_SpendLogGuardrailIndexScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_SpendLogGuardrailIndexGroupByOutput']:
        """Group LiteLLM_SpendLogGuardrailIndex records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_SpendLogGuardrailIndex fields to group records by
        where
            LiteLLM_SpendLogGuardrailIndex filter to select records
        take
            Limit the maximum number of LiteLLM_SpendLogGuardrailIndex records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_SpendLogGuardrailIndexGroupByOutput]
            A list of dictionaries representing the LiteLLM_SpendLogGuardrailIndex record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_SpendLogGuardrailIndex records by request_id values
        # and count how many records are in each group
        results = await LiteLLM_SpendLogGuardrailIndex.prisma().group_by(
            ['request_id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_SpendLogToolIndexActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_SpendLogToolIndex]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_SpendLogToolIndex.prisma().query_raw(
            'SELECT * FROM LiteLLM_SpendLogToolIndex WHERE request_id = $1',
            'bgjceijaia',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_SpendLogToolIndex
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_SpendLogToolIndex.prisma().query_first(
            'SELECT * FROM LiteLLM_SpendLogToolIndex WHERE tool_name = $1',
            'hifbdafhh',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_SpendLogToolIndexCreateInput,
        include: Optional[types.LiteLLM_SpendLogToolIndexInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_SpendLogToolIndex record.

        Parameters
        ----------
        data
            LiteLLM_SpendLogToolIndex record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogToolIndex model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogToolIndex
            The created LiteLLM_SpendLogToolIndex record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_SpendLogToolIndex record from just the required fields
        litellm_spendlogtoolindex = await LiteLLM_SpendLogToolIndex.prisma().create(
            data={
                # data to create a LiteLLM_SpendLogToolIndex record
                'request_id': 'bcabicaife',
                'tool_name': 'ibgjfchfj',
                'start_time': datetime.datetime.utcnow(),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_SpendLogToolIndexCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_SpendLogToolIndex records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_SpendLogToolIndex record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_SpendLogToolIndex.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_SpendLogToolIndex record
                    'request_id': 'bghafddebc',
                    'tool_name': 'bgaidgfbjh',
                    'start_time': datetime.datetime.utcnow(),
                },
                {
                    # data to create a LiteLLM_SpendLogToolIndex record
                    'request_id': 'bdejjhhggg',
                    'tool_name': 'fdahaiafb',
                    'start_time': datetime.datetime.utcnow(),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_SpendLogToolIndexWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogToolIndexInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_SpendLogToolIndex record.

        Parameters
        ----------
        where
            LiteLLM_SpendLogToolIndex filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogToolIndex model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogToolIndex
            The deleted LiteLLM_SpendLogToolIndex record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_spendlogtoolindex = await LiteLLM_SpendLogToolIndex.prisma().delete(
            where={
                # LiteLLM_SpendLogToolIndex where unique filter

            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_SpendLogToolIndexWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogToolIndexInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_SpendLogToolIndex record.

        Parameters
        ----------
        where
            LiteLLM_SpendLogToolIndex filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogToolIndex model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogToolIndex
            The found LiteLLM_SpendLogToolIndex record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_spendlogtoolindex = await LiteLLM_SpendLogToolIndex.prisma().find_unique(
            where={
                # LiteLLM_SpendLogToolIndex where unique filter

            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_SpendLogToolIndexWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogToolIndexInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_SpendLogToolIndex record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_SpendLogToolIndex filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogToolIndex model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogToolIndex
            The found LiteLLM_SpendLogToolIndex record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_spendlogtoolindex = await LiteLLM_SpendLogToolIndex.prisma().find_unique_or_raise(
            where={
                # LiteLLM_SpendLogToolIndex where unique filter

            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogToolIndexWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogToolIndexWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SpendLogToolIndexInclude] = None,
        order: Optional[Union[types.LiteLLM_SpendLogToolIndexOrderByInput, List[types.LiteLLM_SpendLogToolIndexOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SpendLogToolIndexScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_SpendLogToolIndex records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_SpendLogToolIndex records returned
        skip
            Ignore the first N results
        where
            LiteLLM_SpendLogToolIndex filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogToolIndex model
        order
            Order the returned LiteLLM_SpendLogToolIndex records by any field
        distinct
            Filter LiteLLM_SpendLogToolIndex records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_SpendLogToolIndex]
            The list of all LiteLLM_SpendLogToolIndex records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_SpendLogToolIndex records
        litellm_spendlogtoolindexs = await LiteLLM_SpendLogToolIndex.prisma().find_many(take=10)

        # find the first 5 LiteLLM_SpendLogToolIndex records ordered by the start_time field
        litellm_spendlogtoolindexs = await LiteLLM_SpendLogToolIndex.prisma().find_many(
            take=5,
            order={
                'start_time': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogToolIndexWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogToolIndexWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SpendLogToolIndexInclude] = None,
        order: Optional[Union[types.LiteLLM_SpendLogToolIndexOrderByInput, List[types.LiteLLM_SpendLogToolIndexOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SpendLogToolIndexScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_SpendLogToolIndex record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_SpendLogToolIndex filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogToolIndex model
        order
            Order the returned LiteLLM_SpendLogToolIndex records by any field
        distinct
            Filter LiteLLM_SpendLogToolIndex records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_SpendLogToolIndex
            The first LiteLLM_SpendLogToolIndex record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_SpendLogToolIndex record ordered by the request_id field
        litellm_spendlogtoolindex = await LiteLLM_SpendLogToolIndex.prisma().find_first(
            skip=1,
            order={
                'request_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogToolIndexWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogToolIndexWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SpendLogToolIndexInclude] = None,
        order: Optional[Union[types.LiteLLM_SpendLogToolIndexOrderByInput, List[types.LiteLLM_SpendLogToolIndexOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SpendLogToolIndexScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_SpendLogToolIndex record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_SpendLogToolIndex filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogToolIndex model
        order
            Order the returned LiteLLM_SpendLogToolIndex records by any field
        distinct
            Filter LiteLLM_SpendLogToolIndex records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_SpendLogToolIndex
            The first LiteLLM_SpendLogToolIndex record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_SpendLogToolIndex record ordered by the tool_name field
        litellm_spendlogtoolindex = await LiteLLM_SpendLogToolIndex.prisma().find_first_or_raise(
            skip=1,
            order={
                'tool_name': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_SpendLogToolIndexUpdateInput,
        where: types.LiteLLM_SpendLogToolIndexWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogToolIndexInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_SpendLogToolIndex record.

        Parameters
        ----------
        data
            LiteLLM_SpendLogToolIndex record data specifying what to update
        where
            LiteLLM_SpendLogToolIndex filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogToolIndex model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogToolIndex
            The updated LiteLLM_SpendLogToolIndex record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_spendlogtoolindex = await LiteLLM_SpendLogToolIndex.prisma().update(
            where={
                # LiteLLM_SpendLogToolIndex where unique filter

            },
            data={
                # data to update the LiteLLM_SpendLogToolIndex record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_SpendLogToolIndexWhereUniqueInput,
        data: types.LiteLLM_SpendLogToolIndexUpsertInput,
        include: Optional[types.LiteLLM_SpendLogToolIndexInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_SpendLogToolIndex filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_SpendLogToolIndex model

        Returns
        -------
        prisma.models.LiteLLM_SpendLogToolIndex
            The created or updated LiteLLM_SpendLogToolIndex record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_spendlogtoolindex = await LiteLLM_SpendLogToolIndex.prisma().upsert(
            where={
                # LiteLLM_SpendLogToolIndex where unique filter
            },
            data={
                'create': {
                    # LiteLLM_SpendLogToolIndex data to be set if the record does not exist
                },
                'update': {
                    # LiteLLM_SpendLogToolIndex data to be set if the record does exist
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_SpendLogToolIndexUpdateManyMutationInput,
        where: types.LiteLLM_SpendLogToolIndexWhereInput,
    ) -> int:
        """Update multiple LiteLLM_SpendLogToolIndex records

        Parameters
        ----------
        data
            LiteLLM_SpendLogToolIndex data to update the selected LiteLLM_SpendLogToolIndex records to
        where
            Filter to select the LiteLLM_SpendLogToolIndex records to update

        Returns
        -------
        int
            The total number of LiteLLM_SpendLogToolIndex records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_SpendLogToolIndex records
        total = await LiteLLM_SpendLogToolIndex.prisma().update_many(
            data={
                'start_time': datetime.datetime.utcnow()
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogToolIndexWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogToolIndexWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_SpendLogToolIndex records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_SpendLogToolIndex fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_SpendLogToolIndex filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_SpendLogToolIndexCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_SpendLogToolIndex.prisma().count()

        # results: prisma.types.LiteLLM_SpendLogToolIndexCountAggregateOutput
        results = await LiteLLM_SpendLogToolIndex.prisma().count(
            select={
                '_all': True,
                'request_id': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_SpendLogToolIndexCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogToolIndexWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogToolIndexWhereUniqueInput] = None,
    ) -> types.LiteLLM_SpendLogToolIndexCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_SpendLogToolIndexCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SpendLogToolIndexWhereInput] = None,
        cursor: Optional[types.LiteLLM_SpendLogToolIndexWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_SpendLogToolIndexCountAggregateOutput]:
        """Count the number of LiteLLM_SpendLogToolIndex records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_SpendLogToolIndex fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_SpendLogToolIndex filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_SpendLogToolIndexCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_SpendLogToolIndex.prisma().count()

        # results: prisma.types.LiteLLM_SpendLogToolIndexCountAggregateOutput
        results = await LiteLLM_SpendLogToolIndex.prisma().count(
            select={
                '_all': True,
                'tool_name': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_SpendLogToolIndexCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_SpendLogToolIndexWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_SpendLogToolIndex records.

        Parameters
        ----------
        where
            Optional LiteLLM_SpendLogToolIndex filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_SpendLogToolIndex records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_SpendLogToolIndex records
        total = await LiteLLM_SpendLogToolIndex.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_SpendLogToolIndexScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_SpendLogToolIndexWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_SpendLogToolIndexAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_SpendLogToolIndexSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_SpendLogToolIndexMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_SpendLogToolIndexMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_SpendLogToolIndexScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_SpendLogToolIndexCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_SpendLogToolIndexScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_SpendLogToolIndexScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_SpendLogToolIndexGroupByOutput']:
        """Group LiteLLM_SpendLogToolIndex records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_SpendLogToolIndex fields to group records by
        where
            LiteLLM_SpendLogToolIndex filter to select records
        take
            Limit the maximum number of LiteLLM_SpendLogToolIndex records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_SpendLogToolIndexGroupByOutput]
            A list of dictionaries representing the LiteLLM_SpendLogToolIndex record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_SpendLogToolIndex records by start_time values
        # and count how many records are in each group
        results = await LiteLLM_SpendLogToolIndex.prisma().group_by(
            ['start_time'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_PromptTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_PromptTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_PromptTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_PromptTable WHERE id = $1',
            'bheidchdbc',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_PromptTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_PromptTable.prisma().query_first(
            'SELECT * FROM LiteLLM_PromptTable WHERE prompt_id = $1',
            'ddecgfgj',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_PromptTableCreateInput,
        include: Optional[types.LiteLLM_PromptTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_PromptTable record.

        Parameters
        ----------
        data
            LiteLLM_PromptTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_PromptTable model

        Returns
        -------
        prisma.models.LiteLLM_PromptTable
            The created LiteLLM_PromptTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_PromptTable record from just the required fields
        litellm_prompttable = await LiteLLM_PromptTable.prisma().create(
            data={
                # data to create a LiteLLM_PromptTable record
                'prompt_id': 'baafhjifec',
                'litellm_params': Json({'jgbcfighb': True}),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_PromptTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_PromptTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_PromptTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_PromptTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_PromptTable record
                    'prompt_id': 'bagjdcgfce',
                    'litellm_params': Json({'gjjfcfbij': True}),
                },
                {
                    # data to create a LiteLLM_PromptTable record
                    'prompt_id': 'fdejhhede',
                    'litellm_params': Json({'jfjjgcdbf': True}),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_PromptTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PromptTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_PromptTable record.

        Parameters
        ----------
        where
            LiteLLM_PromptTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_PromptTable model

        Returns
        -------
        prisma.models.LiteLLM_PromptTable
            The deleted LiteLLM_PromptTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_prompttable = await LiteLLM_PromptTable.prisma().delete(
            where={
                'id': 'idjjhibfc',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_PromptTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PromptTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_PromptTable record.

        Parameters
        ----------
        where
            LiteLLM_PromptTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_PromptTable model

        Returns
        -------
        prisma.models.LiteLLM_PromptTable
            The found LiteLLM_PromptTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_prompttable = await LiteLLM_PromptTable.prisma().find_unique(
            where={
                'id': 'bjgdidgdfd',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_PromptTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PromptTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_PromptTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_PromptTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_PromptTable model

        Returns
        -------
        prisma.models.LiteLLM_PromptTable
            The found LiteLLM_PromptTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_prompttable = await LiteLLM_PromptTable.prisma().find_unique_or_raise(
            where={
                'id': 'bijcbbccda',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PromptTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PromptTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_PromptTableInclude] = None,
        order: Optional[Union[types.LiteLLM_PromptTableOrderByInput, List[types.LiteLLM_PromptTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_PromptTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_PromptTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_PromptTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_PromptTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_PromptTable model
        order
            Order the returned LiteLLM_PromptTable records by any field
        distinct
            Filter LiteLLM_PromptTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_PromptTable]
            The list of all LiteLLM_PromptTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_PromptTable records
        litellm_prompttables = await LiteLLM_PromptTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_PromptTable records ordered by the version field
        litellm_prompttables = await LiteLLM_PromptTable.prisma().find_many(
            take=5,
            order={
                'version': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PromptTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PromptTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_PromptTableInclude] = None,
        order: Optional[Union[types.LiteLLM_PromptTableOrderByInput, List[types.LiteLLM_PromptTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_PromptTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_PromptTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_PromptTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_PromptTable model
        order
            Order the returned LiteLLM_PromptTable records by any field
        distinct
            Filter LiteLLM_PromptTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_PromptTable
            The first LiteLLM_PromptTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_PromptTable record ordered by the litellm_params field
        litellm_prompttable = await LiteLLM_PromptTable.prisma().find_first(
            skip=1,
            order={
                'litellm_params': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PromptTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PromptTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_PromptTableInclude] = None,
        order: Optional[Union[types.LiteLLM_PromptTableOrderByInput, List[types.LiteLLM_PromptTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_PromptTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_PromptTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_PromptTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_PromptTable model
        order
            Order the returned LiteLLM_PromptTable records by any field
        distinct
            Filter LiteLLM_PromptTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_PromptTable
            The first LiteLLM_PromptTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_PromptTable record ordered by the prompt_info field
        litellm_prompttable = await LiteLLM_PromptTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'prompt_info': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_PromptTableUpdateInput,
        where: types.LiteLLM_PromptTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PromptTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_PromptTable record.

        Parameters
        ----------
        data
            LiteLLM_PromptTable record data specifying what to update
        where
            LiteLLM_PromptTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_PromptTable model

        Returns
        -------
        prisma.models.LiteLLM_PromptTable
            The updated LiteLLM_PromptTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_prompttable = await LiteLLM_PromptTable.prisma().update(
            where={
                'id': 'baiadjcdfj',
            },
            data={
                # data to update the LiteLLM_PromptTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_PromptTableWhereUniqueInput,
        data: types.LiteLLM_PromptTableUpsertInput,
        include: Optional[types.LiteLLM_PromptTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_PromptTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_PromptTable model

        Returns
        -------
        prisma.models.LiteLLM_PromptTable
            The created or updated LiteLLM_PromptTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_prompttable = await LiteLLM_PromptTable.prisma().upsert(
            where={
                'id': 'eeighihea',
            },
            data={
                'create': {
                    'id': 'eeighihea',
                    'prompt_id': 'fdejhhede',
                    'litellm_params': Json({'jfjjgcdbf': True}),
                },
                'update': {
                    'prompt_id': 'fdejhhede',
                    'litellm_params': Json({'jfjjgcdbf': True}),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_PromptTableUpdateManyMutationInput,
        where: types.LiteLLM_PromptTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_PromptTable records

        Parameters
        ----------
        data
            LiteLLM_PromptTable data to update the selected LiteLLM_PromptTable records to
        where
            Filter to select the LiteLLM_PromptTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_PromptTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_PromptTable records
        total = await LiteLLM_PromptTable.prisma().update_many(
            data={
                'created_at': datetime.datetime.utcnow()
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PromptTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PromptTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_PromptTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_PromptTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_PromptTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_PromptTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_PromptTable.prisma().count()

        # results: prisma.types.LiteLLM_PromptTableCountAggregateOutput
        results = await LiteLLM_PromptTable.prisma().count(
            select={
                '_all': True,
                'updated_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_PromptTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PromptTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PromptTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_PromptTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_PromptTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PromptTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PromptTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_PromptTableCountAggregateOutput]:
        """Count the number of LiteLLM_PromptTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_PromptTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_PromptTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_PromptTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_PromptTable.prisma().count()

        # results: prisma.types.LiteLLM_PromptTableCountAggregateOutput
        results = await LiteLLM_PromptTable.prisma().count(
            select={
                '_all': True,
                'id': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_PromptTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_PromptTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_PromptTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_PromptTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_PromptTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_PromptTable records
        total = await LiteLLM_PromptTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_PromptTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_PromptTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_PromptTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_PromptTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_PromptTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_PromptTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_PromptTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_PromptTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_PromptTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_PromptTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_PromptTableGroupByOutput']:
        """Group LiteLLM_PromptTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_PromptTable fields to group records by
        where
            LiteLLM_PromptTable filter to select records
        take
            Limit the maximum number of LiteLLM_PromptTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_PromptTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_PromptTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_PromptTable records by prompt_id values
        # and count how many records are in each group
        results = await LiteLLM_PromptTable.prisma().group_by(
            ['prompt_id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_HealthCheckTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_HealthCheckTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_HealthCheckTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_HealthCheckTable WHERE health_check_id = $1',
            'bjgcaahcjd',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_HealthCheckTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_HealthCheckTable.prisma().query_first(
            'SELECT * FROM LiteLLM_HealthCheckTable WHERE model_name = $1',
            'eajaedjfe',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_HealthCheckTableCreateInput,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_HealthCheckTable record.

        Parameters
        ----------
        data
            LiteLLM_HealthCheckTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_HealthCheckTable model

        Returns
        -------
        prisma.models.LiteLLM_HealthCheckTable
            The created LiteLLM_HealthCheckTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_HealthCheckTable record from just the required fields
        litellm_healthchecktable = await LiteLLM_HealthCheckTable.prisma().create(
            data={
                # data to create a LiteLLM_HealthCheckTable record
                'model_name': 'diebbdcbj',
                'status': 'bgbgicefbc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_HealthCheckTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_HealthCheckTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_HealthCheckTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_HealthCheckTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_HealthCheckTable record
                    'model_name': 'biefijhhcb',
                    'status': 'bhgbgacihi',
                },
                {
                    # data to create a LiteLLM_HealthCheckTable record
                    'model_name': 'bhjigebfgh',
                    'status': 'bjjchjieee',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_HealthCheckTableWhereUniqueInput,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_HealthCheckTable record.

        Parameters
        ----------
        where
            LiteLLM_HealthCheckTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_HealthCheckTable model

        Returns
        -------
        prisma.models.LiteLLM_HealthCheckTable
            The deleted LiteLLM_HealthCheckTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_healthchecktable = await LiteLLM_HealthCheckTable.prisma().delete(
            where={
                'health_check_id': 'hgchdfhjh',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_HealthCheckTableWhereUniqueInput,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_HealthCheckTable record.

        Parameters
        ----------
        where
            LiteLLM_HealthCheckTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_HealthCheckTable model

        Returns
        -------
        prisma.models.LiteLLM_HealthCheckTable
            The found LiteLLM_HealthCheckTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_healthchecktable = await LiteLLM_HealthCheckTable.prisma().find_unique(
            where={
                'health_check_id': 'cadjagcdeg',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_HealthCheckTableWhereUniqueInput,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_HealthCheckTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_HealthCheckTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_HealthCheckTable model

        Returns
        -------
        prisma.models.LiteLLM_HealthCheckTable
            The found LiteLLM_HealthCheckTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_healthchecktable = await LiteLLM_HealthCheckTable.prisma().find_unique_or_raise(
            where={
                'health_check_id': 'hchffbghf',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_HealthCheckTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_HealthCheckTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None,
        order: Optional[Union[types.LiteLLM_HealthCheckTableOrderByInput, List[types.LiteLLM_HealthCheckTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_HealthCheckTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_HealthCheckTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_HealthCheckTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_HealthCheckTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_HealthCheckTable model
        order
            Order the returned LiteLLM_HealthCheckTable records by any field
        distinct
            Filter LiteLLM_HealthCheckTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_HealthCheckTable]
            The list of all LiteLLM_HealthCheckTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_HealthCheckTable records
        litellm_healthchecktables = await LiteLLM_HealthCheckTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_HealthCheckTable records ordered by the model_id field
        litellm_healthchecktables = await LiteLLM_HealthCheckTable.prisma().find_many(
            take=5,
            order={
                'model_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_HealthCheckTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_HealthCheckTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None,
        order: Optional[Union[types.LiteLLM_HealthCheckTableOrderByInput, List[types.LiteLLM_HealthCheckTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_HealthCheckTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_HealthCheckTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_HealthCheckTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_HealthCheckTable model
        order
            Order the returned LiteLLM_HealthCheckTable records by any field
        distinct
            Filter LiteLLM_HealthCheckTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_HealthCheckTable
            The first LiteLLM_HealthCheckTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_HealthCheckTable record ordered by the status field
        litellm_healthchecktable = await LiteLLM_HealthCheckTable.prisma().find_first(
            skip=1,
            order={
                'status': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_HealthCheckTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_HealthCheckTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None,
        order: Optional[Union[types.LiteLLM_HealthCheckTableOrderByInput, List[types.LiteLLM_HealthCheckTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_HealthCheckTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_HealthCheckTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_HealthCheckTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_HealthCheckTable model
        order
            Order the returned LiteLLM_HealthCheckTable records by any field
        distinct
            Filter LiteLLM_HealthCheckTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_HealthCheckTable
            The first LiteLLM_HealthCheckTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_HealthCheckTable record ordered by the healthy_count field
        litellm_healthchecktable = await LiteLLM_HealthCheckTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'healthy_count': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_HealthCheckTableUpdateInput,
        where: types.LiteLLM_HealthCheckTableWhereUniqueInput,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_HealthCheckTable record.

        Parameters
        ----------
        data
            LiteLLM_HealthCheckTable record data specifying what to update
        where
            LiteLLM_HealthCheckTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_HealthCheckTable model

        Returns
        -------
        prisma.models.LiteLLM_HealthCheckTable
            The updated LiteLLM_HealthCheckTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_healthchecktable = await LiteLLM_HealthCheckTable.prisma().update(
            where={
                'health_check_id': 'behfggjjhg',
            },
            data={
                # data to update the LiteLLM_HealthCheckTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_HealthCheckTableWhereUniqueInput,
        data: types.LiteLLM_HealthCheckTableUpsertInput,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_HealthCheckTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_HealthCheckTable model

        Returns
        -------
        prisma.models.LiteLLM_HealthCheckTable
            The created or updated LiteLLM_HealthCheckTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_healthchecktable = await LiteLLM_HealthCheckTable.prisma().upsert(
            where={
                'health_check_id': 'bidfjddeij',
            },
            data={
                'create': {
                    'health_check_id': 'bidfjddeij',
                    'model_name': 'bhjigebfgh',
                    'status': 'bjjchjieee',
                },
                'update': {
                    'model_name': 'bhjigebfgh',
                    'status': 'bjjchjieee',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_HealthCheckTableUpdateManyMutationInput,
        where: types.LiteLLM_HealthCheckTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_HealthCheckTable records

        Parameters
        ----------
        data
            LiteLLM_HealthCheckTable data to update the selected LiteLLM_HealthCheckTable records to
        where
            Filter to select the LiteLLM_HealthCheckTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_HealthCheckTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_HealthCheckTable records
        total = await LiteLLM_HealthCheckTable.prisma().update_many(
            data={
                'unhealthy_count': 910845462
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_HealthCheckTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_HealthCheckTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_HealthCheckTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_HealthCheckTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_HealthCheckTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_HealthCheckTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_HealthCheckTable.prisma().count()

        # results: prisma.types.LiteLLM_HealthCheckTableCountAggregateOutput
        results = await LiteLLM_HealthCheckTable.prisma().count(
            select={
                '_all': True,
                'error_message': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_HealthCheckTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_HealthCheckTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_HealthCheckTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_HealthCheckTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_HealthCheckTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_HealthCheckTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_HealthCheckTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_HealthCheckTableCountAggregateOutput]:
        """Count the number of LiteLLM_HealthCheckTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_HealthCheckTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_HealthCheckTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_HealthCheckTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_HealthCheckTable.prisma().count()

        # results: prisma.types.LiteLLM_HealthCheckTableCountAggregateOutput
        results = await LiteLLM_HealthCheckTable.prisma().count(
            select={
                '_all': True,
                'response_time_ms': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_HealthCheckTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_HealthCheckTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_HealthCheckTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_HealthCheckTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_HealthCheckTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_HealthCheckTable records
        total = await LiteLLM_HealthCheckTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_HealthCheckTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_HealthCheckTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_HealthCheckTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_HealthCheckTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_HealthCheckTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_HealthCheckTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_HealthCheckTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_HealthCheckTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_HealthCheckTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_HealthCheckTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_HealthCheckTableGroupByOutput']:
        """Group LiteLLM_HealthCheckTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_HealthCheckTable fields to group records by
        where
            LiteLLM_HealthCheckTable filter to select records
        take
            Limit the maximum number of LiteLLM_HealthCheckTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_HealthCheckTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_HealthCheckTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_HealthCheckTable records by details values
        # and count how many records are in each group
        results = await LiteLLM_HealthCheckTable.prisma().group_by(
            ['details'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_SearchToolsTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_SearchToolsTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_SearchToolsTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_SearchToolsTable WHERE search_tool_id = $1',
            'beafjabhbj',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_SearchToolsTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_SearchToolsTable.prisma().query_first(
            'SELECT * FROM LiteLLM_SearchToolsTable WHERE search_tool_name = $1',
            'fdbjgidii',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_SearchToolsTableCreateInput,
        include: Optional[types.LiteLLM_SearchToolsTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_SearchToolsTable record.

        Parameters
        ----------
        data
            LiteLLM_SearchToolsTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_SearchToolsTable model

        Returns
        -------
        prisma.models.LiteLLM_SearchToolsTable
            The created LiteLLM_SearchToolsTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_SearchToolsTable record from just the required fields
        litellm_searchtoolstable = await LiteLLM_SearchToolsTable.prisma().create(
            data={
                # data to create a LiteLLM_SearchToolsTable record
                'search_tool_name': 'ijecdcbd',
                'litellm_params': Json({'iehbhajhi': True}),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_SearchToolsTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_SearchToolsTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_SearchToolsTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_SearchToolsTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_SearchToolsTable record
                    'search_tool_name': 'bdebcaajeh',
                    'litellm_params': Json({'jaheadhga': True}),
                },
                {
                    # data to create a LiteLLM_SearchToolsTable record
                    'search_tool_name': 'bgeafdahjd',
                    'litellm_params': Json({'bbbbfhhec': True}),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_SearchToolsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_SearchToolsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_SearchToolsTable record.

        Parameters
        ----------
        where
            LiteLLM_SearchToolsTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SearchToolsTable model

        Returns
        -------
        prisma.models.LiteLLM_SearchToolsTable
            The deleted LiteLLM_SearchToolsTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_searchtoolstable = await LiteLLM_SearchToolsTable.prisma().delete(
            where={
                'search_tool_id': 'bcbhjjgedb',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_SearchToolsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_SearchToolsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_SearchToolsTable record.

        Parameters
        ----------
        where
            LiteLLM_SearchToolsTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SearchToolsTable model

        Returns
        -------
        prisma.models.LiteLLM_SearchToolsTable
            The found LiteLLM_SearchToolsTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_searchtoolstable = await LiteLLM_SearchToolsTable.prisma().find_unique(
            where={
                'search_tool_id': 'iibhjieci',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_SearchToolsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_SearchToolsTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_SearchToolsTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_SearchToolsTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SearchToolsTable model

        Returns
        -------
        prisma.models.LiteLLM_SearchToolsTable
            The found LiteLLM_SearchToolsTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_searchtoolstable = await LiteLLM_SearchToolsTable.prisma().find_unique_or_raise(
            where={
                'search_tool_id': 'gajaacb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SearchToolsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_SearchToolsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SearchToolsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_SearchToolsTableOrderByInput, List[types.LiteLLM_SearchToolsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SearchToolsTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_SearchToolsTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_SearchToolsTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_SearchToolsTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SearchToolsTable model
        order
            Order the returned LiteLLM_SearchToolsTable records by any field
        distinct
            Filter LiteLLM_SearchToolsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_SearchToolsTable]
            The list of all LiteLLM_SearchToolsTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_SearchToolsTable records
        litellm_searchtoolstables = await LiteLLM_SearchToolsTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_SearchToolsTable records ordered by the litellm_params field
        litellm_searchtoolstables = await LiteLLM_SearchToolsTable.prisma().find_many(
            take=5,
            order={
                'litellm_params': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SearchToolsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_SearchToolsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SearchToolsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_SearchToolsTableOrderByInput, List[types.LiteLLM_SearchToolsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SearchToolsTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_SearchToolsTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_SearchToolsTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SearchToolsTable model
        order
            Order the returned LiteLLM_SearchToolsTable records by any field
        distinct
            Filter LiteLLM_SearchToolsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_SearchToolsTable
            The first LiteLLM_SearchToolsTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_SearchToolsTable record ordered by the search_tool_info field
        litellm_searchtoolstable = await LiteLLM_SearchToolsTable.prisma().find_first(
            skip=1,
            order={
                'search_tool_info': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SearchToolsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_SearchToolsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SearchToolsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_SearchToolsTableOrderByInput, List[types.LiteLLM_SearchToolsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SearchToolsTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_SearchToolsTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_SearchToolsTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SearchToolsTable model
        order
            Order the returned LiteLLM_SearchToolsTable records by any field
        distinct
            Filter LiteLLM_SearchToolsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_SearchToolsTable
            The first LiteLLM_SearchToolsTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_SearchToolsTable record ordered by the created_at field
        litellm_searchtoolstable = await LiteLLM_SearchToolsTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'created_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_SearchToolsTableUpdateInput,
        where: types.LiteLLM_SearchToolsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_SearchToolsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_SearchToolsTable record.

        Parameters
        ----------
        data
            LiteLLM_SearchToolsTable record data specifying what to update
        where
            LiteLLM_SearchToolsTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_SearchToolsTable model

        Returns
        -------
        prisma.models.LiteLLM_SearchToolsTable
            The updated LiteLLM_SearchToolsTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_searchtoolstable = await LiteLLM_SearchToolsTable.prisma().update(
            where={
                'search_tool_id': 'bbjiffahhi',
            },
            data={
                # data to update the LiteLLM_SearchToolsTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_SearchToolsTableWhereUniqueInput,
        data: types.LiteLLM_SearchToolsTableUpsertInput,
        include: Optional[types.LiteLLM_SearchToolsTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_SearchToolsTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_SearchToolsTable model

        Returns
        -------
        prisma.models.LiteLLM_SearchToolsTable
            The created or updated LiteLLM_SearchToolsTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_searchtoolstable = await LiteLLM_SearchToolsTable.prisma().upsert(
            where={
                'search_tool_id': 'caibbdfhih',
            },
            data={
                'create': {
                    'search_tool_id': 'caibbdfhih',
                    'search_tool_name': 'bgeafdahjd',
                    'litellm_params': Json({'bbbbfhhec': True}),
                },
                'update': {
                    'search_tool_name': 'bgeafdahjd',
                    'litellm_params': Json({'bbbbfhhec': True}),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_SearchToolsTableUpdateManyMutationInput,
        where: types.LiteLLM_SearchToolsTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_SearchToolsTable records

        Parameters
        ----------
        data
            LiteLLM_SearchToolsTable data to update the selected LiteLLM_SearchToolsTable records to
        where
            Filter to select the LiteLLM_SearchToolsTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_SearchToolsTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_SearchToolsTable records
        total = await LiteLLM_SearchToolsTable.prisma().update_many(
            data={
                'updated_at': datetime.datetime.utcnow()
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SearchToolsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_SearchToolsTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_SearchToolsTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_SearchToolsTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_SearchToolsTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_SearchToolsTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_SearchToolsTable.prisma().count()

        # results: prisma.types.LiteLLM_SearchToolsTableCountAggregateOutput
        results = await LiteLLM_SearchToolsTable.prisma().count(
            select={
                '_all': True,
                'search_tool_id': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_SearchToolsTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SearchToolsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_SearchToolsTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_SearchToolsTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_SearchToolsTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SearchToolsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_SearchToolsTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_SearchToolsTableCountAggregateOutput]:
        """Count the number of LiteLLM_SearchToolsTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_SearchToolsTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_SearchToolsTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_SearchToolsTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_SearchToolsTable.prisma().count()

        # results: prisma.types.LiteLLM_SearchToolsTableCountAggregateOutput
        results = await LiteLLM_SearchToolsTable.prisma().count(
            select={
                '_all': True,
                'search_tool_name': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_SearchToolsTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_SearchToolsTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_SearchToolsTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_SearchToolsTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_SearchToolsTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_SearchToolsTable records
        total = await LiteLLM_SearchToolsTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_SearchToolsTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_SearchToolsTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_SearchToolsTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_SearchToolsTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_SearchToolsTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_SearchToolsTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_SearchToolsTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_SearchToolsTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_SearchToolsTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_SearchToolsTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_SearchToolsTableGroupByOutput']:
        """Group LiteLLM_SearchToolsTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_SearchToolsTable fields to group records by
        where
            LiteLLM_SearchToolsTable filter to select records
        take
            Limit the maximum number of LiteLLM_SearchToolsTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_SearchToolsTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_SearchToolsTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_SearchToolsTable records by litellm_params values
        # and count how many records are in each group
        results = await LiteLLM_SearchToolsTable.prisma().group_by(
            ['litellm_params'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_SSOConfigActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_SSOConfig]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_SSOConfig.prisma().query_raw(
            'SELECT * FROM LiteLLM_SSOConfig WHERE id = $1',
            'bjbbffdiaa',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_SSOConfig
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_SSOConfig.prisma().query_first(
            'SELECT * FROM LiteLLM_SSOConfig WHERE sso_settings = $1',
            Json({'bhjgeigibh': True}),
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_SSOConfigCreateInput,
        include: Optional[types.LiteLLM_SSOConfigInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_SSOConfig record.

        Parameters
        ----------
        data
            LiteLLM_SSOConfig record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_SSOConfig model

        Returns
        -------
        prisma.models.LiteLLM_SSOConfig
            The created LiteLLM_SSOConfig record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_SSOConfig record from just the required fields
        litellm_ssoconfig = await LiteLLM_SSOConfig.prisma().create(
            data={
                # data to create a LiteLLM_SSOConfig record
                'sso_settings': Json({'bgeadjjaeg': True}),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_SSOConfigCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_SSOConfig records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_SSOConfig record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_SSOConfig.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_SSOConfig record
                    'sso_settings': Json({'cahigchjhf': True}),
                },
                {
                    # data to create a LiteLLM_SSOConfig record
                    'sso_settings': Json({'bgciaegcga': True}),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_SSOConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_SSOConfigInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_SSOConfig record.

        Parameters
        ----------
        where
            LiteLLM_SSOConfig filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SSOConfig model

        Returns
        -------
        prisma.models.LiteLLM_SSOConfig
            The deleted LiteLLM_SSOConfig record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_ssoconfig = await LiteLLM_SSOConfig.prisma().delete(
            where={
                'id': 'bihcfdeejd',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_SSOConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_SSOConfigInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_SSOConfig record.

        Parameters
        ----------
        where
            LiteLLM_SSOConfig filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SSOConfig model

        Returns
        -------
        prisma.models.LiteLLM_SSOConfig
            The found LiteLLM_SSOConfig record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_ssoconfig = await LiteLLM_SSOConfig.prisma().find_unique(
            where={
                'id': 'bhcjhejiec',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_SSOConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_SSOConfigInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_SSOConfig record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_SSOConfig filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SSOConfig model

        Returns
        -------
        prisma.models.LiteLLM_SSOConfig
            The found LiteLLM_SSOConfig record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_ssoconfig = await LiteLLM_SSOConfig.prisma().find_unique_or_raise(
            where={
                'id': 'bicdhjiibj',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SSOConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_SSOConfigWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SSOConfigInclude] = None,
        order: Optional[Union[types.LiteLLM_SSOConfigOrderByInput, List[types.LiteLLM_SSOConfigOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SSOConfigScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_SSOConfig records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_SSOConfig records returned
        skip
            Ignore the first N results
        where
            LiteLLM_SSOConfig filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SSOConfig model
        order
            Order the returned LiteLLM_SSOConfig records by any field
        distinct
            Filter LiteLLM_SSOConfig records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_SSOConfig]
            The list of all LiteLLM_SSOConfig records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_SSOConfig records
        litellm_ssoconfigs = await LiteLLM_SSOConfig.prisma().find_many(take=10)

        # find the first 5 LiteLLM_SSOConfig records ordered by the created_at field
        litellm_ssoconfigs = await LiteLLM_SSOConfig.prisma().find_many(
            take=5,
            order={
                'created_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SSOConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_SSOConfigWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SSOConfigInclude] = None,
        order: Optional[Union[types.LiteLLM_SSOConfigOrderByInput, List[types.LiteLLM_SSOConfigOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SSOConfigScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_SSOConfig record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_SSOConfig filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SSOConfig model
        order
            Order the returned LiteLLM_SSOConfig records by any field
        distinct
            Filter LiteLLM_SSOConfig records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_SSOConfig
            The first LiteLLM_SSOConfig record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_SSOConfig record ordered by the updated_at field
        litellm_ssoconfig = await LiteLLM_SSOConfig.prisma().find_first(
            skip=1,
            order={
                'updated_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SSOConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_SSOConfigWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SSOConfigInclude] = None,
        order: Optional[Union[types.LiteLLM_SSOConfigOrderByInput, List[types.LiteLLM_SSOConfigOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SSOConfigScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_SSOConfig record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_SSOConfig filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SSOConfig model
        order
            Order the returned LiteLLM_SSOConfig records by any field
        distinct
            Filter LiteLLM_SSOConfig records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_SSOConfig
            The first LiteLLM_SSOConfig record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_SSOConfig record ordered by the id field
        litellm_ssoconfig = await LiteLLM_SSOConfig.prisma().find_first_or_raise(
            skip=1,
            order={
                'id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_SSOConfigUpdateInput,
        where: types.LiteLLM_SSOConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_SSOConfigInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_SSOConfig record.

        Parameters
        ----------
        data
            LiteLLM_SSOConfig record data specifying what to update
        where
            LiteLLM_SSOConfig filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_SSOConfig model

        Returns
        -------
        prisma.models.LiteLLM_SSOConfig
            The updated LiteLLM_SSOConfig record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_ssoconfig = await LiteLLM_SSOConfig.prisma().update(
            where={
                'id': 'hhdgjfcge',
            },
            data={
                # data to update the LiteLLM_SSOConfig record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_SSOConfigWhereUniqueInput,
        data: types.LiteLLM_SSOConfigUpsertInput,
        include: Optional[types.LiteLLM_SSOConfigInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_SSOConfig filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_SSOConfig model

        Returns
        -------
        prisma.models.LiteLLM_SSOConfig
            The created or updated LiteLLM_SSOConfig record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_ssoconfig = await LiteLLM_SSOConfig.prisma().upsert(
            where={
                'id': 'cdjigibcb',
            },
            data={
                'create': {
                    'id': 'cdjigibcb',
                    'sso_settings': Json({'bgciaegcga': True}),
                },
                'update': {
                    'sso_settings': Json({'bgciaegcga': True}),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_SSOConfigUpdateManyMutationInput,
        where: types.LiteLLM_SSOConfigWhereInput,
    ) -> int:
        """Update multiple LiteLLM_SSOConfig records

        Parameters
        ----------
        data
            LiteLLM_SSOConfig data to update the selected LiteLLM_SSOConfig records to
        where
            Filter to select the LiteLLM_SSOConfig records to update

        Returns
        -------
        int
            The total number of LiteLLM_SSOConfig records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_SSOConfig records
        total = await LiteLLM_SSOConfig.prisma().update_many(
            data={
                'sso_settings': Json({'dicgfhbic': True})
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SSOConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_SSOConfigWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_SSOConfig records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_SSOConfig fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_SSOConfig filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_SSOConfigCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_SSOConfig.prisma().count()

        # results: prisma.types.LiteLLM_SSOConfigCountAggregateOutput
        results = await LiteLLM_SSOConfig.prisma().count(
            select={
                '_all': True,
                'created_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_SSOConfigCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SSOConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_SSOConfigWhereUniqueInput] = None,
    ) -> types.LiteLLM_SSOConfigCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_SSOConfigCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SSOConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_SSOConfigWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_SSOConfigCountAggregateOutput]:
        """Count the number of LiteLLM_SSOConfig records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_SSOConfig fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_SSOConfig filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_SSOConfigCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_SSOConfig.prisma().count()

        # results: prisma.types.LiteLLM_SSOConfigCountAggregateOutput
        results = await LiteLLM_SSOConfig.prisma().count(
            select={
                '_all': True,
                'updated_at': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_SSOConfigCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_SSOConfigWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_SSOConfig records.

        Parameters
        ----------
        where
            Optional LiteLLM_SSOConfig filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_SSOConfig records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_SSOConfig records
        total = await LiteLLM_SSOConfig.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_SSOConfigScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_SSOConfigWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_SSOConfigAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_SSOConfigSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_SSOConfigMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_SSOConfigMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_SSOConfigScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_SSOConfigCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_SSOConfigScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_SSOConfigScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_SSOConfigGroupByOutput']:
        """Group LiteLLM_SSOConfig records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_SSOConfig fields to group records by
        where
            LiteLLM_SSOConfig filter to select records
        take
            Limit the maximum number of LiteLLM_SSOConfig records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_SSOConfigGroupByOutput]
            A list of dictionaries representing the LiteLLM_SSOConfig record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_SSOConfig records by id values
        # and count how many records are in each group
        results = await LiteLLM_SSOConfig.prisma().group_by(
            ['id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ManagedVectorStoreIndexTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ManagedVectorStoreIndexTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ManagedVectorStoreIndexTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_ManagedVectorStoreIndexTable WHERE id = $1',
            'fjcijccih',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreIndexTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ManagedVectorStoreIndexTable.prisma().query_first(
            'SELECT * FROM LiteLLM_ManagedVectorStoreIndexTable WHERE index_name = $1',
            'bbjbfibaae',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ManagedVectorStoreIndexTableCreateInput,
        include: Optional[types.LiteLLM_ManagedVectorStoreIndexTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ManagedVectorStoreIndexTable record.

        Parameters
        ----------
        data
            LiteLLM_ManagedVectorStoreIndexTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreIndexTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreIndexTable
            The created LiteLLM_ManagedVectorStoreIndexTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ManagedVectorStoreIndexTable record from just the required fields
        litellm_managedvectorstoreindextable = await LiteLLM_ManagedVectorStoreIndexTable.prisma().create(
            data={
                # data to create a LiteLLM_ManagedVectorStoreIndexTable record
                'index_name': 'bffhjeiicb',
                'litellm_params': Json({'iajgghcec': True}),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ManagedVectorStoreIndexTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ManagedVectorStoreIndexTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ManagedVectorStoreIndexTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ManagedVectorStoreIndexTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ManagedVectorStoreIndexTable record
                    'index_name': 'baahheihgd',
                    'litellm_params': Json({'jhffbicge': True}),
                },
                {
                    # data to create a LiteLLM_ManagedVectorStoreIndexTable record
                    'index_name': 'bejbfdgeab',
                    'litellm_params': Json({'bfadaefeje': True}),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ManagedVectorStoreIndexTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoreIndexTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ManagedVectorStoreIndexTable record.

        Parameters
        ----------
        where
            LiteLLM_ManagedVectorStoreIndexTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreIndexTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreIndexTable
            The deleted LiteLLM_ManagedVectorStoreIndexTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedvectorstoreindextable = await LiteLLM_ManagedVectorStoreIndexTable.prisma().delete(
            where={
                'id': 'bceheeaff',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ManagedVectorStoreIndexTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoreIndexTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ManagedVectorStoreIndexTable record.

        Parameters
        ----------
        where
            LiteLLM_ManagedVectorStoreIndexTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreIndexTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreIndexTable
            The found LiteLLM_ManagedVectorStoreIndexTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedvectorstoreindextable = await LiteLLM_ManagedVectorStoreIndexTable.prisma().find_unique(
            where={
                'id': 'eadgifiga',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ManagedVectorStoreIndexTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoreIndexTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ManagedVectorStoreIndexTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ManagedVectorStoreIndexTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreIndexTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreIndexTable
            The found LiteLLM_ManagedVectorStoreIndexTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedvectorstoreindextable = await LiteLLM_ManagedVectorStoreIndexTable.prisma().find_unique_or_raise(
            where={
                'id': 'bhbdefcgcb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedVectorStoreIndexTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedVectorStoreIndexTableOrderByInput, List[types.LiteLLM_ManagedVectorStoreIndexTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedVectorStoreIndexTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ManagedVectorStoreIndexTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ManagedVectorStoreIndexTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ManagedVectorStoreIndexTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreIndexTable model
        order
            Order the returned LiteLLM_ManagedVectorStoreIndexTable records by any field
        distinct
            Filter LiteLLM_ManagedVectorStoreIndexTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ManagedVectorStoreIndexTable]
            The list of all LiteLLM_ManagedVectorStoreIndexTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ManagedVectorStoreIndexTable records
        litellm_managedvectorstoreindextables = await LiteLLM_ManagedVectorStoreIndexTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ManagedVectorStoreIndexTable records ordered by the litellm_params field
        litellm_managedvectorstoreindextables = await LiteLLM_ManagedVectorStoreIndexTable.prisma().find_many(
            take=5,
            order={
                'litellm_params': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedVectorStoreIndexTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedVectorStoreIndexTableOrderByInput, List[types.LiteLLM_ManagedVectorStoreIndexTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedVectorStoreIndexTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ManagedVectorStoreIndexTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedVectorStoreIndexTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreIndexTable model
        order
            Order the returned LiteLLM_ManagedVectorStoreIndexTable records by any field
        distinct
            Filter LiteLLM_ManagedVectorStoreIndexTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreIndexTable
            The first LiteLLM_ManagedVectorStoreIndexTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ManagedVectorStoreIndexTable record ordered by the index_info field
        litellm_managedvectorstoreindextable = await LiteLLM_ManagedVectorStoreIndexTable.prisma().find_first(
            skip=1,
            order={
                'index_info': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ManagedVectorStoreIndexTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ManagedVectorStoreIndexTableOrderByInput, List[types.LiteLLM_ManagedVectorStoreIndexTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ManagedVectorStoreIndexTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ManagedVectorStoreIndexTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedVectorStoreIndexTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreIndexTable model
        order
            Order the returned LiteLLM_ManagedVectorStoreIndexTable records by any field
        distinct
            Filter LiteLLM_ManagedVectorStoreIndexTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreIndexTable
            The first LiteLLM_ManagedVectorStoreIndexTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ManagedVectorStoreIndexTable record ordered by the created_at field
        litellm_managedvectorstoreindextable = await LiteLLM_ManagedVectorStoreIndexTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'created_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ManagedVectorStoreIndexTableUpdateInput,
        where: types.LiteLLM_ManagedVectorStoreIndexTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoreIndexTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ManagedVectorStoreIndexTable record.

        Parameters
        ----------
        data
            LiteLLM_ManagedVectorStoreIndexTable record data specifying what to update
        where
            LiteLLM_ManagedVectorStoreIndexTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreIndexTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreIndexTable
            The updated LiteLLM_ManagedVectorStoreIndexTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_managedvectorstoreindextable = await LiteLLM_ManagedVectorStoreIndexTable.prisma().update(
            where={
                'id': 'gfidfjffe',
            },
            data={
                # data to update the LiteLLM_ManagedVectorStoreIndexTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ManagedVectorStoreIndexTableWhereUniqueInput,
        data: types.LiteLLM_ManagedVectorStoreIndexTableUpsertInput,
        include: Optional[types.LiteLLM_ManagedVectorStoreIndexTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ManagedVectorStoreIndexTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ManagedVectorStoreIndexTable model

        Returns
        -------
        prisma.models.LiteLLM_ManagedVectorStoreIndexTable
            The created or updated LiteLLM_ManagedVectorStoreIndexTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_managedvectorstoreindextable = await LiteLLM_ManagedVectorStoreIndexTable.prisma().upsert(
            where={
                'id': 'bhfjeijfff',
            },
            data={
                'create': {
                    'id': 'bhfjeijfff',
                    'index_name': 'bejbfdgeab',
                    'litellm_params': Json({'bfadaefeje': True}),
                },
                'update': {
                    'index_name': 'bejbfdgeab',
                    'litellm_params': Json({'bfadaefeje': True}),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ManagedVectorStoreIndexTableUpdateManyMutationInput,
        where: types.LiteLLM_ManagedVectorStoreIndexTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ManagedVectorStoreIndexTable records

        Parameters
        ----------
        data
            LiteLLM_ManagedVectorStoreIndexTable data to update the selected LiteLLM_ManagedVectorStoreIndexTable records to
        where
            Filter to select the LiteLLM_ManagedVectorStoreIndexTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_ManagedVectorStoreIndexTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ManagedVectorStoreIndexTable records
        total = await LiteLLM_ManagedVectorStoreIndexTable.prisma().update_many(
            data={
                'created_by': 'bbeadjibga'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ManagedVectorStoreIndexTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ManagedVectorStoreIndexTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedVectorStoreIndexTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ManagedVectorStoreIndexTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ManagedVectorStoreIndexTable.prisma().count()

        # results: prisma.types.LiteLLM_ManagedVectorStoreIndexTableCountAggregateOutput
        results = await LiteLLM_ManagedVectorStoreIndexTable.prisma().count(
            select={
                '_all': True,
                'updated_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ManagedVectorStoreIndexTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_ManagedVectorStoreIndexTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ManagedVectorStoreIndexTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ManagedVectorStoreIndexTableCountAggregateOutput]:
        """Count the number of LiteLLM_ManagedVectorStoreIndexTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ManagedVectorStoreIndexTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ManagedVectorStoreIndexTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ManagedVectorStoreIndexTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ManagedVectorStoreIndexTable.prisma().count()

        # results: prisma.types.LiteLLM_ManagedVectorStoreIndexTableCountAggregateOutput
        results = await LiteLLM_ManagedVectorStoreIndexTable.prisma().count(
            select={
                '_all': True,
                'updated_by': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ManagedVectorStoreIndexTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ManagedVectorStoreIndexTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ManagedVectorStoreIndexTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_ManagedVectorStoreIndexTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ManagedVectorStoreIndexTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ManagedVectorStoreIndexTable records
        total = await LiteLLM_ManagedVectorStoreIndexTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ManagedVectorStoreIndexTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ManagedVectorStoreIndexTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ManagedVectorStoreIndexTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ManagedVectorStoreIndexTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ManagedVectorStoreIndexTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ManagedVectorStoreIndexTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ManagedVectorStoreIndexTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ManagedVectorStoreIndexTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ManagedVectorStoreIndexTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ManagedVectorStoreIndexTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ManagedVectorStoreIndexTableGroupByOutput']:
        """Group LiteLLM_ManagedVectorStoreIndexTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ManagedVectorStoreIndexTable fields to group records by
        where
            LiteLLM_ManagedVectorStoreIndexTable filter to select records
        take
            Limit the maximum number of LiteLLM_ManagedVectorStoreIndexTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ManagedVectorStoreIndexTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_ManagedVectorStoreIndexTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ManagedVectorStoreIndexTable records by id values
        # and count how many records are in each group
        results = await LiteLLM_ManagedVectorStoreIndexTable.prisma().group_by(
            ['id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_CacheConfigActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_CacheConfig]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_CacheConfig.prisma().query_raw(
            'SELECT * FROM LiteLLM_CacheConfig WHERE id = $1',
            'bjfbjbiggf',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_CacheConfig
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_CacheConfig.prisma().query_first(
            'SELECT * FROM LiteLLM_CacheConfig WHERE cache_settings = $1',
            Json({'chdbaagcc': True}),
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_CacheConfigCreateInput,
        include: Optional[types.LiteLLM_CacheConfigInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_CacheConfig record.

        Parameters
        ----------
        data
            LiteLLM_CacheConfig record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_CacheConfig model

        Returns
        -------
        prisma.models.LiteLLM_CacheConfig
            The created LiteLLM_CacheConfig record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_CacheConfig record from just the required fields
        litellm_cacheconfig = await LiteLLM_CacheConfig.prisma().create(
            data={
                # data to create a LiteLLM_CacheConfig record
                'cache_settings': Json({'fbbijihb': True}),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_CacheConfigCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_CacheConfig records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_CacheConfig record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_CacheConfig.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_CacheConfig record
                    'cache_settings': Json({'bfjbgjjidg': True}),
                },
                {
                    # data to create a LiteLLM_CacheConfig record
                    'cache_settings': Json({'bfdihaifd': True}),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_CacheConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_CacheConfigInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_CacheConfig record.

        Parameters
        ----------
        where
            LiteLLM_CacheConfig filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_CacheConfig model

        Returns
        -------
        prisma.models.LiteLLM_CacheConfig
            The deleted LiteLLM_CacheConfig record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_cacheconfig = await LiteLLM_CacheConfig.prisma().delete(
            where={
                'id': 'bfddhdffbe',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_CacheConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_CacheConfigInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_CacheConfig record.

        Parameters
        ----------
        where
            LiteLLM_CacheConfig filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_CacheConfig model

        Returns
        -------
        prisma.models.LiteLLM_CacheConfig
            The found LiteLLM_CacheConfig record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_cacheconfig = await LiteLLM_CacheConfig.prisma().find_unique(
            where={
                'id': 'bdaiebdagh',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_CacheConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_CacheConfigInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_CacheConfig record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_CacheConfig filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_CacheConfig model

        Returns
        -------
        prisma.models.LiteLLM_CacheConfig
            The found LiteLLM_CacheConfig record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_cacheconfig = await LiteLLM_CacheConfig.prisma().find_unique_or_raise(
            where={
                'id': 'jgebebebg',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CacheConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_CacheConfigWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_CacheConfigInclude] = None,
        order: Optional[Union[types.LiteLLM_CacheConfigOrderByInput, List[types.LiteLLM_CacheConfigOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_CacheConfigScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_CacheConfig records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_CacheConfig records returned
        skip
            Ignore the first N results
        where
            LiteLLM_CacheConfig filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_CacheConfig model
        order
            Order the returned LiteLLM_CacheConfig records by any field
        distinct
            Filter LiteLLM_CacheConfig records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_CacheConfig]
            The list of all LiteLLM_CacheConfig records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_CacheConfig records
        litellm_cacheconfigs = await LiteLLM_CacheConfig.prisma().find_many(take=10)

        # find the first 5 LiteLLM_CacheConfig records ordered by the created_at field
        litellm_cacheconfigs = await LiteLLM_CacheConfig.prisma().find_many(
            take=5,
            order={
                'created_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CacheConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_CacheConfigWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_CacheConfigInclude] = None,
        order: Optional[Union[types.LiteLLM_CacheConfigOrderByInput, List[types.LiteLLM_CacheConfigOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_CacheConfigScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_CacheConfig record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_CacheConfig filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_CacheConfig model
        order
            Order the returned LiteLLM_CacheConfig records by any field
        distinct
            Filter LiteLLM_CacheConfig records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_CacheConfig
            The first LiteLLM_CacheConfig record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_CacheConfig record ordered by the updated_at field
        litellm_cacheconfig = await LiteLLM_CacheConfig.prisma().find_first(
            skip=1,
            order={
                'updated_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CacheConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_CacheConfigWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_CacheConfigInclude] = None,
        order: Optional[Union[types.LiteLLM_CacheConfigOrderByInput, List[types.LiteLLM_CacheConfigOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_CacheConfigScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_CacheConfig record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_CacheConfig filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_CacheConfig model
        order
            Order the returned LiteLLM_CacheConfig records by any field
        distinct
            Filter LiteLLM_CacheConfig records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_CacheConfig
            The first LiteLLM_CacheConfig record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_CacheConfig record ordered by the id field
        litellm_cacheconfig = await LiteLLM_CacheConfig.prisma().find_first_or_raise(
            skip=1,
            order={
                'id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_CacheConfigUpdateInput,
        where: types.LiteLLM_CacheConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_CacheConfigInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_CacheConfig record.

        Parameters
        ----------
        data
            LiteLLM_CacheConfig record data specifying what to update
        where
            LiteLLM_CacheConfig filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_CacheConfig model

        Returns
        -------
        prisma.models.LiteLLM_CacheConfig
            The updated LiteLLM_CacheConfig record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_cacheconfig = await LiteLLM_CacheConfig.prisma().update(
            where={
                'id': 'gjhbefhcj',
            },
            data={
                # data to update the LiteLLM_CacheConfig record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_CacheConfigWhereUniqueInput,
        data: types.LiteLLM_CacheConfigUpsertInput,
        include: Optional[types.LiteLLM_CacheConfigInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_CacheConfig filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_CacheConfig model

        Returns
        -------
        prisma.models.LiteLLM_CacheConfig
            The created or updated LiteLLM_CacheConfig record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_cacheconfig = await LiteLLM_CacheConfig.prisma().upsert(
            where={
                'id': 'bdfgbjccje',
            },
            data={
                'create': {
                    'id': 'bdfgbjccje',
                    'cache_settings': Json({'bfdihaifd': True}),
                },
                'update': {
                    'cache_settings': Json({'bfdihaifd': True}),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_CacheConfigUpdateManyMutationInput,
        where: types.LiteLLM_CacheConfigWhereInput,
    ) -> int:
        """Update multiple LiteLLM_CacheConfig records

        Parameters
        ----------
        data
            LiteLLM_CacheConfig data to update the selected LiteLLM_CacheConfig records to
        where
            Filter to select the LiteLLM_CacheConfig records to update

        Returns
        -------
        int
            The total number of LiteLLM_CacheConfig records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_CacheConfig records
        total = await LiteLLM_CacheConfig.prisma().update_many(
            data={
                'cache_settings': Json({'bjchjbfbbb': True})
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CacheConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_CacheConfigWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_CacheConfig records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_CacheConfig fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_CacheConfig filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_CacheConfigCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_CacheConfig.prisma().count()

        # results: prisma.types.LiteLLM_CacheConfigCountAggregateOutput
        results = await LiteLLM_CacheConfig.prisma().count(
            select={
                '_all': True,
                'created_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_CacheConfigCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CacheConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_CacheConfigWhereUniqueInput] = None,
    ) -> types.LiteLLM_CacheConfigCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_CacheConfigCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_CacheConfigWhereInput] = None,
        cursor: Optional[types.LiteLLM_CacheConfigWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_CacheConfigCountAggregateOutput]:
        """Count the number of LiteLLM_CacheConfig records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_CacheConfig fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_CacheConfig filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_CacheConfigCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_CacheConfig.prisma().count()

        # results: prisma.types.LiteLLM_CacheConfigCountAggregateOutput
        results = await LiteLLM_CacheConfig.prisma().count(
            select={
                '_all': True,
                'updated_at': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_CacheConfigCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_CacheConfigWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_CacheConfig records.

        Parameters
        ----------
        where
            Optional LiteLLM_CacheConfig filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_CacheConfig records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_CacheConfig records
        total = await LiteLLM_CacheConfig.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_CacheConfigScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_CacheConfigWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_CacheConfigAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_CacheConfigSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_CacheConfigMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_CacheConfigMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_CacheConfigScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_CacheConfigCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_CacheConfigScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_CacheConfigScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_CacheConfigGroupByOutput']:
        """Group LiteLLM_CacheConfig records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_CacheConfig fields to group records by
        where
            LiteLLM_CacheConfig filter to select records
        take
            Limit the maximum number of LiteLLM_CacheConfig records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_CacheConfigGroupByOutput]
            A list of dictionaries representing the LiteLLM_CacheConfig record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_CacheConfig records by id values
        # and count how many records are in each group
        results = await LiteLLM_CacheConfig.prisma().group_by(
            ['id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_UISettingsActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_UISettings]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_UISettings.prisma().query_raw(
            'SELECT * FROM LiteLLM_UISettings WHERE id = $1',
            'cachfbejaa',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_UISettings
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_UISettings.prisma().query_first(
            'SELECT * FROM LiteLLM_UISettings WHERE ui_settings = $1',
            Json({'bfjddjgebd': True}),
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_UISettingsCreateInput,
        include: Optional[types.LiteLLM_UISettingsInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_UISettings record.

        Parameters
        ----------
        data
            LiteLLM_UISettings record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_UISettings model

        Returns
        -------
        prisma.models.LiteLLM_UISettings
            The created LiteLLM_UISettings record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_UISettings record from just the required fields
        litellm_uisettings = await LiteLLM_UISettings.prisma().create(
            data={
                # data to create a LiteLLM_UISettings record
                'ui_settings': Json({'babifceddi': True}),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_UISettingsCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_UISettings records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_UISettings record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_UISettings.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_UISettings record
                    'ui_settings': Json({'bgfgjbjah': True}),
                },
                {
                    # data to create a LiteLLM_UISettings record
                    'ui_settings': Json({'bfaifigiia': True}),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_UISettingsWhereUniqueInput,
        include: Optional[types.LiteLLM_UISettingsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_UISettings record.

        Parameters
        ----------
        where
            LiteLLM_UISettings filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_UISettings model

        Returns
        -------
        prisma.models.LiteLLM_UISettings
            The deleted LiteLLM_UISettings record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_uisettings = await LiteLLM_UISettings.prisma().delete(
            where={
                'id': 'bebgicaggf',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_UISettingsWhereUniqueInput,
        include: Optional[types.LiteLLM_UISettingsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_UISettings record.

        Parameters
        ----------
        where
            LiteLLM_UISettings filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_UISettings model

        Returns
        -------
        prisma.models.LiteLLM_UISettings
            The found LiteLLM_UISettings record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_uisettings = await LiteLLM_UISettings.prisma().find_unique(
            where={
                'id': 'cedfddicc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_UISettingsWhereUniqueInput,
        include: Optional[types.LiteLLM_UISettingsInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_UISettings record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_UISettings filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_UISettings model

        Returns
        -------
        prisma.models.LiteLLM_UISettings
            The found LiteLLM_UISettings record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_uisettings = await LiteLLM_UISettings.prisma().find_unique_or_raise(
            where={
                'id': 'dfeaijicd',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UISettingsWhereInput] = None,
        cursor: Optional[types.LiteLLM_UISettingsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_UISettingsInclude] = None,
        order: Optional[Union[types.LiteLLM_UISettingsOrderByInput, List[types.LiteLLM_UISettingsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_UISettingsScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_UISettings records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_UISettings records returned
        skip
            Ignore the first N results
        where
            LiteLLM_UISettings filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_UISettings model
        order
            Order the returned LiteLLM_UISettings records by any field
        distinct
            Filter LiteLLM_UISettings records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_UISettings]
            The list of all LiteLLM_UISettings records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_UISettings records
        litellm_uisettings = await LiteLLM_UISettings.prisma().find_many(take=10)

        # find the first 5 LiteLLM_UISettings records ordered by the created_at field
        litellm_uisettings = await LiteLLM_UISettings.prisma().find_many(
            take=5,
            order={
                'created_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UISettingsWhereInput] = None,
        cursor: Optional[types.LiteLLM_UISettingsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_UISettingsInclude] = None,
        order: Optional[Union[types.LiteLLM_UISettingsOrderByInput, List[types.LiteLLM_UISettingsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_UISettingsScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_UISettings record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_UISettings filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_UISettings model
        order
            Order the returned LiteLLM_UISettings records by any field
        distinct
            Filter LiteLLM_UISettings records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_UISettings
            The first LiteLLM_UISettings record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_UISettings record ordered by the updated_at field
        litellm_uisettings = await LiteLLM_UISettings.prisma().find_first(
            skip=1,
            order={
                'updated_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UISettingsWhereInput] = None,
        cursor: Optional[types.LiteLLM_UISettingsWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_UISettingsInclude] = None,
        order: Optional[Union[types.LiteLLM_UISettingsOrderByInput, List[types.LiteLLM_UISettingsOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_UISettingsScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_UISettings record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_UISettings filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_UISettings model
        order
            Order the returned LiteLLM_UISettings records by any field
        distinct
            Filter LiteLLM_UISettings records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_UISettings
            The first LiteLLM_UISettings record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_UISettings record ordered by the id field
        litellm_uisettings = await LiteLLM_UISettings.prisma().find_first_or_raise(
            skip=1,
            order={
                'id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_UISettingsUpdateInput,
        where: types.LiteLLM_UISettingsWhereUniqueInput,
        include: Optional[types.LiteLLM_UISettingsInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_UISettings record.

        Parameters
        ----------
        data
            LiteLLM_UISettings record data specifying what to update
        where
            LiteLLM_UISettings filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_UISettings model

        Returns
        -------
        prisma.models.LiteLLM_UISettings
            The updated LiteLLM_UISettings record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_uisettings = await LiteLLM_UISettings.prisma().update(
            where={
                'id': 'baggcibdii',
            },
            data={
                # data to update the LiteLLM_UISettings record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_UISettingsWhereUniqueInput,
        data: types.LiteLLM_UISettingsUpsertInput,
        include: Optional[types.LiteLLM_UISettingsInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_UISettings filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_UISettings model

        Returns
        -------
        prisma.models.LiteLLM_UISettings
            The created or updated LiteLLM_UISettings record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_uisettings = await LiteLLM_UISettings.prisma().upsert(
            where={
                'id': 'bbjffcjief',
            },
            data={
                'create': {
                    'id': 'bbjffcjief',
                    'ui_settings': Json({'bfaifigiia': True}),
                },
                'update': {
                    'ui_settings': Json({'bfaifigiia': True}),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_UISettingsUpdateManyMutationInput,
        where: types.LiteLLM_UISettingsWhereInput,
    ) -> int:
        """Update multiple LiteLLM_UISettings records

        Parameters
        ----------
        data
            LiteLLM_UISettings data to update the selected LiteLLM_UISettings records to
        where
            Filter to select the LiteLLM_UISettings records to update

        Returns
        -------
        int
            The total number of LiteLLM_UISettings records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_UISettings records
        total = await LiteLLM_UISettings.prisma().update_many(
            data={
                'ui_settings': Json({'fffaabdfe': True})
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UISettingsWhereInput] = None,
        cursor: Optional[types.LiteLLM_UISettingsWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_UISettings records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_UISettings fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_UISettings filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_UISettingsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_UISettings.prisma().count()

        # results: prisma.types.LiteLLM_UISettingsCountAggregateOutput
        results = await LiteLLM_UISettings.prisma().count(
            select={
                '_all': True,
                'created_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_UISettingsCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UISettingsWhereInput] = None,
        cursor: Optional[types.LiteLLM_UISettingsWhereUniqueInput] = None,
    ) -> types.LiteLLM_UISettingsCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_UISettingsCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_UISettingsWhereInput] = None,
        cursor: Optional[types.LiteLLM_UISettingsWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_UISettingsCountAggregateOutput]:
        """Count the number of LiteLLM_UISettings records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_UISettings fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_UISettings filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_UISettingsCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_UISettings.prisma().count()

        # results: prisma.types.LiteLLM_UISettingsCountAggregateOutput
        results = await LiteLLM_UISettings.prisma().count(
            select={
                '_all': True,
                'updated_at': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_UISettingsCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_UISettingsWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_UISettings records.

        Parameters
        ----------
        where
            Optional LiteLLM_UISettings filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_UISettings records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_UISettings records
        total = await LiteLLM_UISettings.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_UISettingsScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_UISettingsWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_UISettingsAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_UISettingsSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_UISettingsMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_UISettingsMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_UISettingsScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_UISettingsCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_UISettingsScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_UISettingsScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_UISettingsGroupByOutput']:
        """Group LiteLLM_UISettings records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_UISettings fields to group records by
        where
            LiteLLM_UISettings filter to select records
        take
            Limit the maximum number of LiteLLM_UISettings records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_UISettingsGroupByOutput]
            A list of dictionaries representing the LiteLLM_UISettings record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_UISettings records by id values
        # and count how many records are in each group
        results = await LiteLLM_UISettings.prisma().group_by(
            ['id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ConfigOverridesActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ConfigOverrides]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ConfigOverrides.prisma().query_raw(
            'SELECT * FROM LiteLLM_ConfigOverrides WHERE config_type = $1',
            'beeeiacbhb',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ConfigOverrides
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ConfigOverrides.prisma().query_first(
            'SELECT * FROM LiteLLM_ConfigOverrides WHERE config_value = $1',
            Json({'caaffegbdg': True}),
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ConfigOverridesCreateInput,
        include: Optional[types.LiteLLM_ConfigOverridesInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ConfigOverrides record.

        Parameters
        ----------
        data
            LiteLLM_ConfigOverrides record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ConfigOverrides model

        Returns
        -------
        prisma.models.LiteLLM_ConfigOverrides
            The created LiteLLM_ConfigOverrides record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ConfigOverrides record from just the required fields
        litellm_configoverrides = await LiteLLM_ConfigOverrides.prisma().create(
            data={
                # data to create a LiteLLM_ConfigOverrides record
                'config_type': 'bbjieejjaf',
                'config_value': Json({'caachcajic': True}),
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ConfigOverridesCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ConfigOverrides records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ConfigOverrides record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ConfigOverrides.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ConfigOverrides record
                    'config_type': 'beigacgfid',
                    'config_value': Json({'bgehjgiidg': True}),
                },
                {
                    # data to create a LiteLLM_ConfigOverrides record
                    'config_type': 'ggididbh',
                    'config_value': Json({'caehgabhgc': True}),
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ConfigOverridesWhereUniqueInput,
        include: Optional[types.LiteLLM_ConfigOverridesInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ConfigOverrides record.

        Parameters
        ----------
        where
            LiteLLM_ConfigOverrides filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ConfigOverrides model

        Returns
        -------
        prisma.models.LiteLLM_ConfigOverrides
            The deleted LiteLLM_ConfigOverrides record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_configoverrides = await LiteLLM_ConfigOverrides.prisma().delete(
            where={
                'config_type': 'bdcdghgbeh',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ConfigOverridesWhereUniqueInput,
        include: Optional[types.LiteLLM_ConfigOverridesInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ConfigOverrides record.

        Parameters
        ----------
        where
            LiteLLM_ConfigOverrides filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ConfigOverrides model

        Returns
        -------
        prisma.models.LiteLLM_ConfigOverrides
            The found LiteLLM_ConfigOverrides record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_configoverrides = await LiteLLM_ConfigOverrides.prisma().find_unique(
            where={
                'config_type': 'bhgbabhfca',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ConfigOverridesWhereUniqueInput,
        include: Optional[types.LiteLLM_ConfigOverridesInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ConfigOverrides record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ConfigOverrides filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ConfigOverrides model

        Returns
        -------
        prisma.models.LiteLLM_ConfigOverrides
            The found LiteLLM_ConfigOverrides record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_configoverrides = await LiteLLM_ConfigOverrides.prisma().find_unique_or_raise(
            where={
                'config_type': 'fbichfdgj',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ConfigOverridesWhereInput] = None,
        cursor: Optional[types.LiteLLM_ConfigOverridesWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ConfigOverridesInclude] = None,
        order: Optional[Union[types.LiteLLM_ConfigOverridesOrderByInput, List[types.LiteLLM_ConfigOverridesOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ConfigOverridesScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ConfigOverrides records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ConfigOverrides records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ConfigOverrides filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ConfigOverrides model
        order
            Order the returned LiteLLM_ConfigOverrides records by any field
        distinct
            Filter LiteLLM_ConfigOverrides records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ConfigOverrides]
            The list of all LiteLLM_ConfigOverrides records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ConfigOverrides records
        litellm_configoverrides = await LiteLLM_ConfigOverrides.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ConfigOverrides records ordered by the created_at field
        litellm_configoverrides = await LiteLLM_ConfigOverrides.prisma().find_many(
            take=5,
            order={
                'created_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ConfigOverridesWhereInput] = None,
        cursor: Optional[types.LiteLLM_ConfigOverridesWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ConfigOverridesInclude] = None,
        order: Optional[Union[types.LiteLLM_ConfigOverridesOrderByInput, List[types.LiteLLM_ConfigOverridesOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ConfigOverridesScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ConfigOverrides record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ConfigOverrides filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ConfigOverrides model
        order
            Order the returned LiteLLM_ConfigOverrides records by any field
        distinct
            Filter LiteLLM_ConfigOverrides records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ConfigOverrides
            The first LiteLLM_ConfigOverrides record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ConfigOverrides record ordered by the updated_at field
        litellm_configoverrides = await LiteLLM_ConfigOverrides.prisma().find_first(
            skip=1,
            order={
                'updated_at': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ConfigOverridesWhereInput] = None,
        cursor: Optional[types.LiteLLM_ConfigOverridesWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ConfigOverridesInclude] = None,
        order: Optional[Union[types.LiteLLM_ConfigOverridesOrderByInput, List[types.LiteLLM_ConfigOverridesOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ConfigOverridesScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ConfigOverrides record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ConfigOverrides filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ConfigOverrides model
        order
            Order the returned LiteLLM_ConfigOverrides records by any field
        distinct
            Filter LiteLLM_ConfigOverrides records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ConfigOverrides
            The first LiteLLM_ConfigOverrides record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ConfigOverrides record ordered by the config_type field
        litellm_configoverrides = await LiteLLM_ConfigOverrides.prisma().find_first_or_raise(
            skip=1,
            order={
                'config_type': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ConfigOverridesUpdateInput,
        where: types.LiteLLM_ConfigOverridesWhereUniqueInput,
        include: Optional[types.LiteLLM_ConfigOverridesInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ConfigOverrides record.

        Parameters
        ----------
        data
            LiteLLM_ConfigOverrides record data specifying what to update
        where
            LiteLLM_ConfigOverrides filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ConfigOverrides model

        Returns
        -------
        prisma.models.LiteLLM_ConfigOverrides
            The updated LiteLLM_ConfigOverrides record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_configoverrides = await LiteLLM_ConfigOverrides.prisma().update(
            where={
                'config_type': 'cjdihjfa',
            },
            data={
                # data to update the LiteLLM_ConfigOverrides record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ConfigOverridesWhereUniqueInput,
        data: types.LiteLLM_ConfigOverridesUpsertInput,
        include: Optional[types.LiteLLM_ConfigOverridesInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ConfigOverrides filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ConfigOverrides model

        Returns
        -------
        prisma.models.LiteLLM_ConfigOverrides
            The created or updated LiteLLM_ConfigOverrides record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_configoverrides = await LiteLLM_ConfigOverrides.prisma().upsert(
            where={
                'config_type': 'eiacbdfid',
            },
            data={
                'create': {
                    'config_type': 'eiacbdfid',
                    'config_value': Json({'caehgabhgc': True}),
                },
                'update': {
                    'config_value': Json({'caehgabhgc': True}),
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ConfigOverridesUpdateManyMutationInput,
        where: types.LiteLLM_ConfigOverridesWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ConfigOverrides records

        Parameters
        ----------
        data
            LiteLLM_ConfigOverrides data to update the selected LiteLLM_ConfigOverrides records to
        where
            Filter to select the LiteLLM_ConfigOverrides records to update

        Returns
        -------
        int
            The total number of LiteLLM_ConfigOverrides records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ConfigOverrides records
        total = await LiteLLM_ConfigOverrides.prisma().update_many(
            data={
                'config_value': Json({'biggibejea': True})
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ConfigOverridesWhereInput] = None,
        cursor: Optional[types.LiteLLM_ConfigOverridesWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ConfigOverrides records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ConfigOverrides fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ConfigOverrides filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ConfigOverridesCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ConfigOverrides.prisma().count()

        # results: prisma.types.LiteLLM_ConfigOverridesCountAggregateOutput
        results = await LiteLLM_ConfigOverrides.prisma().count(
            select={
                '_all': True,
                'created_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ConfigOverridesCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ConfigOverridesWhereInput] = None,
        cursor: Optional[types.LiteLLM_ConfigOverridesWhereUniqueInput] = None,
    ) -> types.LiteLLM_ConfigOverridesCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ConfigOverridesCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ConfigOverridesWhereInput] = None,
        cursor: Optional[types.LiteLLM_ConfigOverridesWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ConfigOverridesCountAggregateOutput]:
        """Count the number of LiteLLM_ConfigOverrides records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ConfigOverrides fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ConfigOverrides filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ConfigOverridesCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ConfigOverrides.prisma().count()

        # results: prisma.types.LiteLLM_ConfigOverridesCountAggregateOutput
        results = await LiteLLM_ConfigOverrides.prisma().count(
            select={
                '_all': True,
                'updated_at': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ConfigOverridesCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ConfigOverridesWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ConfigOverrides records.

        Parameters
        ----------
        where
            Optional LiteLLM_ConfigOverrides filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ConfigOverrides records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ConfigOverrides records
        total = await LiteLLM_ConfigOverrides.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ConfigOverridesScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ConfigOverridesWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ConfigOverridesAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ConfigOverridesSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ConfigOverridesMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ConfigOverridesMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ConfigOverridesScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ConfigOverridesCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ConfigOverridesScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ConfigOverridesScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ConfigOverridesGroupByOutput']:
        """Group LiteLLM_ConfigOverrides records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ConfigOverrides fields to group records by
        where
            LiteLLM_ConfigOverrides filter to select records
        take
            Limit the maximum number of LiteLLM_ConfigOverrides records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ConfigOverridesGroupByOutput]
            A list of dictionaries representing the LiteLLM_ConfigOverrides record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ConfigOverrides records by config_type values
        # and count how many records are in each group
        results = await LiteLLM_ConfigOverrides.prisma().group_by(
            ['config_type'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_SkillsTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_SkillsTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_SkillsTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_SkillsTable WHERE skill_id = $1',
            'bbfejcgdaj',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_SkillsTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_SkillsTable.prisma().query_first(
            'SELECT * FROM LiteLLM_SkillsTable WHERE display_title = $1',
            'jhfihdegg',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_SkillsTableCreateInput,
        include: Optional[types.LiteLLM_SkillsTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_SkillsTable record.

        Parameters
        ----------
        data
            LiteLLM_SkillsTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_SkillsTable model

        Returns
        -------
        prisma.models.LiteLLM_SkillsTable
            The created LiteLLM_SkillsTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_SkillsTable record from just the required fields
        litellm_skillstable = await LiteLLM_SkillsTable.prisma().create(
            data={
                # data to create a LiteLLM_SkillsTable record
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_SkillsTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_SkillsTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_SkillsTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_SkillsTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_SkillsTable record
                },
                {
                    # data to create a LiteLLM_SkillsTable record
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_SkillsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_SkillsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_SkillsTable record.

        Parameters
        ----------
        where
            LiteLLM_SkillsTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SkillsTable model

        Returns
        -------
        prisma.models.LiteLLM_SkillsTable
            The deleted LiteLLM_SkillsTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_skillstable = await LiteLLM_SkillsTable.prisma().delete(
            where={
                'skill_id': 'hbdcfgaed',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_SkillsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_SkillsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_SkillsTable record.

        Parameters
        ----------
        where
            LiteLLM_SkillsTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SkillsTable model

        Returns
        -------
        prisma.models.LiteLLM_SkillsTable
            The found LiteLLM_SkillsTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_skillstable = await LiteLLM_SkillsTable.prisma().find_unique(
            where={
                'skill_id': 'hbhcccifg',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_SkillsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_SkillsTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_SkillsTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_SkillsTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_SkillsTable model

        Returns
        -------
        prisma.models.LiteLLM_SkillsTable
            The found LiteLLM_SkillsTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_skillstable = await LiteLLM_SkillsTable.prisma().find_unique_or_raise(
            where={
                'skill_id': 'hihgjcej',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SkillsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_SkillsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SkillsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_SkillsTableOrderByInput, List[types.LiteLLM_SkillsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SkillsTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_SkillsTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_SkillsTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_SkillsTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SkillsTable model
        order
            Order the returned LiteLLM_SkillsTable records by any field
        distinct
            Filter LiteLLM_SkillsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_SkillsTable]
            The list of all LiteLLM_SkillsTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_SkillsTable records
        litellm_skillstables = await LiteLLM_SkillsTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_SkillsTable records ordered by the description field
        litellm_skillstables = await LiteLLM_SkillsTable.prisma().find_many(
            take=5,
            order={
                'description': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SkillsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_SkillsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SkillsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_SkillsTableOrderByInput, List[types.LiteLLM_SkillsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SkillsTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_SkillsTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_SkillsTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SkillsTable model
        order
            Order the returned LiteLLM_SkillsTable records by any field
        distinct
            Filter LiteLLM_SkillsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_SkillsTable
            The first LiteLLM_SkillsTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_SkillsTable record ordered by the instructions field
        litellm_skillstable = await LiteLLM_SkillsTable.prisma().find_first(
            skip=1,
            order={
                'instructions': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SkillsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_SkillsTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_SkillsTableInclude] = None,
        order: Optional[Union[types.LiteLLM_SkillsTableOrderByInput, List[types.LiteLLM_SkillsTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_SkillsTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_SkillsTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_SkillsTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_SkillsTable model
        order
            Order the returned LiteLLM_SkillsTable records by any field
        distinct
            Filter LiteLLM_SkillsTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_SkillsTable
            The first LiteLLM_SkillsTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_SkillsTable record ordered by the source field
        litellm_skillstable = await LiteLLM_SkillsTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'source': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_SkillsTableUpdateInput,
        where: types.LiteLLM_SkillsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_SkillsTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_SkillsTable record.

        Parameters
        ----------
        data
            LiteLLM_SkillsTable record data specifying what to update
        where
            LiteLLM_SkillsTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_SkillsTable model

        Returns
        -------
        prisma.models.LiteLLM_SkillsTable
            The updated LiteLLM_SkillsTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_skillstable = await LiteLLM_SkillsTable.prisma().update(
            where={
                'skill_id': 'habdcgcbe',
            },
            data={
                # data to update the LiteLLM_SkillsTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_SkillsTableWhereUniqueInput,
        data: types.LiteLLM_SkillsTableUpsertInput,
        include: Optional[types.LiteLLM_SkillsTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_SkillsTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_SkillsTable model

        Returns
        -------
        prisma.models.LiteLLM_SkillsTable
            The created or updated LiteLLM_SkillsTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_skillstable = await LiteLLM_SkillsTable.prisma().upsert(
            where={
                'skill_id': 'bgbhfifccd',
            },
            data={
                'create': {
                    'skill_id': 'bgbhfifccd',
                },
                'update': {
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_SkillsTableUpdateManyMutationInput,
        where: types.LiteLLM_SkillsTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_SkillsTable records

        Parameters
        ----------
        data
            LiteLLM_SkillsTable data to update the selected LiteLLM_SkillsTable records to
        where
            Filter to select the LiteLLM_SkillsTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_SkillsTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_SkillsTable records
        total = await LiteLLM_SkillsTable.prisma().update_many(
            data={
                'latest_version': 'cdajichhc'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SkillsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_SkillsTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_SkillsTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_SkillsTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_SkillsTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_SkillsTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_SkillsTable.prisma().count()

        # results: prisma.types.LiteLLM_SkillsTableCountAggregateOutput
        results = await LiteLLM_SkillsTable.prisma().count(
            select={
                '_all': True,
                'file_content': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_SkillsTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SkillsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_SkillsTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_SkillsTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_SkillsTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_SkillsTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_SkillsTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_SkillsTableCountAggregateOutput]:
        """Count the number of LiteLLM_SkillsTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_SkillsTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_SkillsTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_SkillsTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_SkillsTable.prisma().count()

        # results: prisma.types.LiteLLM_SkillsTableCountAggregateOutput
        results = await LiteLLM_SkillsTable.prisma().count(
            select={
                '_all': True,
                'file_name': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_SkillsTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_SkillsTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_SkillsTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_SkillsTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_SkillsTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_SkillsTable records
        total = await LiteLLM_SkillsTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_SkillsTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_SkillsTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_SkillsTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_SkillsTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_SkillsTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_SkillsTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_SkillsTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_SkillsTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_SkillsTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_SkillsTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_SkillsTableGroupByOutput']:
        """Group LiteLLM_SkillsTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_SkillsTable fields to group records by
        where
            LiteLLM_SkillsTable filter to select records
        take
            Limit the maximum number of LiteLLM_SkillsTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_SkillsTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_SkillsTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_SkillsTable records by file_type values
        # and count how many records are in each group
        results = await LiteLLM_SkillsTable.prisma().group_by(
            ['file_type'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_PolicyTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_PolicyTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_PolicyTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_PolicyTable WHERE policy_id = $1',
            'fidaadfej',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_PolicyTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_PolicyTable.prisma().query_first(
            'SELECT * FROM LiteLLM_PolicyTable WHERE policy_name = $1',
            'bhihfhchfe',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_PolicyTableCreateInput,
        include: Optional[types.LiteLLM_PolicyTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_PolicyTable record.

        Parameters
        ----------
        data
            LiteLLM_PolicyTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyTable model

        Returns
        -------
        prisma.models.LiteLLM_PolicyTable
            The created LiteLLM_PolicyTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_PolicyTable record from just the required fields
        litellm_policytable = await LiteLLM_PolicyTable.prisma().create(
            data={
                # data to create a LiteLLM_PolicyTable record
                'policy_name': 'bgcfccghcd',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_PolicyTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_PolicyTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_PolicyTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_PolicyTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_PolicyTable record
                    'policy_name': 'ibjjfafga',
                },
                {
                    # data to create a LiteLLM_PolicyTable record
                    'policy_name': 'bghcggagdd',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_PolicyTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PolicyTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_PolicyTable record.

        Parameters
        ----------
        where
            LiteLLM_PolicyTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyTable model

        Returns
        -------
        prisma.models.LiteLLM_PolicyTable
            The deleted LiteLLM_PolicyTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_policytable = await LiteLLM_PolicyTable.prisma().delete(
            where={
                'policy_id': 'bfjdcgjfji',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_PolicyTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PolicyTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_PolicyTable record.

        Parameters
        ----------
        where
            LiteLLM_PolicyTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyTable model

        Returns
        -------
        prisma.models.LiteLLM_PolicyTable
            The found LiteLLM_PolicyTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_policytable = await LiteLLM_PolicyTable.prisma().find_unique(
            where={
                'policy_id': 'bgfcbdfcdb',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_PolicyTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PolicyTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_PolicyTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_PolicyTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyTable model

        Returns
        -------
        prisma.models.LiteLLM_PolicyTable
            The found LiteLLM_PolicyTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_policytable = await LiteLLM_PolicyTable.prisma().find_unique_or_raise(
            where={
                'policy_id': 'bhchfcedge',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PolicyTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PolicyTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_PolicyTableInclude] = None,
        order: Optional[Union[types.LiteLLM_PolicyTableOrderByInput, List[types.LiteLLM_PolicyTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_PolicyTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_PolicyTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_PolicyTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_PolicyTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyTable model
        order
            Order the returned LiteLLM_PolicyTable records by any field
        distinct
            Filter LiteLLM_PolicyTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_PolicyTable]
            The list of all LiteLLM_PolicyTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_PolicyTable records
        litellm_policytables = await LiteLLM_PolicyTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_PolicyTable records ordered by the version_number field
        litellm_policytables = await LiteLLM_PolicyTable.prisma().find_many(
            take=5,
            order={
                'version_number': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PolicyTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PolicyTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_PolicyTableInclude] = None,
        order: Optional[Union[types.LiteLLM_PolicyTableOrderByInput, List[types.LiteLLM_PolicyTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_PolicyTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_PolicyTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_PolicyTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyTable model
        order
            Order the returned LiteLLM_PolicyTable records by any field
        distinct
            Filter LiteLLM_PolicyTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_PolicyTable
            The first LiteLLM_PolicyTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_PolicyTable record ordered by the version_status field
        litellm_policytable = await LiteLLM_PolicyTable.prisma().find_first(
            skip=1,
            order={
                'version_status': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PolicyTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PolicyTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_PolicyTableInclude] = None,
        order: Optional[Union[types.LiteLLM_PolicyTableOrderByInput, List[types.LiteLLM_PolicyTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_PolicyTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_PolicyTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_PolicyTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyTable model
        order
            Order the returned LiteLLM_PolicyTable records by any field
        distinct
            Filter LiteLLM_PolicyTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_PolicyTable
            The first LiteLLM_PolicyTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_PolicyTable record ordered by the parent_version_id field
        litellm_policytable = await LiteLLM_PolicyTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'parent_version_id': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_PolicyTableUpdateInput,
        where: types.LiteLLM_PolicyTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PolicyTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_PolicyTable record.

        Parameters
        ----------
        data
            LiteLLM_PolicyTable record data specifying what to update
        where
            LiteLLM_PolicyTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyTable model

        Returns
        -------
        prisma.models.LiteLLM_PolicyTable
            The updated LiteLLM_PolicyTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_policytable = await LiteLLM_PolicyTable.prisma().update(
            where={
                'policy_id': 'bjaifdjhd',
            },
            data={
                # data to update the LiteLLM_PolicyTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_PolicyTableWhereUniqueInput,
        data: types.LiteLLM_PolicyTableUpsertInput,
        include: Optional[types.LiteLLM_PolicyTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_PolicyTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyTable model

        Returns
        -------
        prisma.models.LiteLLM_PolicyTable
            The created or updated LiteLLM_PolicyTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_policytable = await LiteLLM_PolicyTable.prisma().upsert(
            where={
                'policy_id': 'biieibbgcg',
            },
            data={
                'create': {
                    'policy_id': 'biieibbgcg',
                    'policy_name': 'bghcggagdd',
                },
                'update': {
                    'policy_name': 'bghcggagdd',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_PolicyTableUpdateManyMutationInput,
        where: types.LiteLLM_PolicyTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_PolicyTable records

        Parameters
        ----------
        data
            LiteLLM_PolicyTable data to update the selected LiteLLM_PolicyTable records to
        where
            Filter to select the LiteLLM_PolicyTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_PolicyTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_PolicyTable records
        total = await LiteLLM_PolicyTable.prisma().update_many(
            data={
                'is_latest': False
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PolicyTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PolicyTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_PolicyTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_PolicyTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_PolicyTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_PolicyTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_PolicyTable.prisma().count()

        # results: prisma.types.LiteLLM_PolicyTableCountAggregateOutput
        results = await LiteLLM_PolicyTable.prisma().count(
            select={
                '_all': True,
                'published_at': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_PolicyTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PolicyTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PolicyTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_PolicyTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_PolicyTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PolicyTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PolicyTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_PolicyTableCountAggregateOutput]:
        """Count the number of LiteLLM_PolicyTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_PolicyTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_PolicyTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_PolicyTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_PolicyTable.prisma().count()

        # results: prisma.types.LiteLLM_PolicyTableCountAggregateOutput
        results = await LiteLLM_PolicyTable.prisma().count(
            select={
                '_all': True,
                'production_at': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_PolicyTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_PolicyTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_PolicyTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_PolicyTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_PolicyTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_PolicyTable records
        total = await LiteLLM_PolicyTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_PolicyTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_PolicyTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_PolicyTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_PolicyTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_PolicyTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_PolicyTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_PolicyTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_PolicyTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_PolicyTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_PolicyTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_PolicyTableGroupByOutput']:
        """Group LiteLLM_PolicyTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_PolicyTable fields to group records by
        where
            LiteLLM_PolicyTable filter to select records
        take
            Limit the maximum number of LiteLLM_PolicyTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_PolicyTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_PolicyTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_PolicyTable records by inherit values
        # and count how many records are in each group
        results = await LiteLLM_PolicyTable.prisma().group_by(
            ['inherit'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_PolicyAttachmentTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_PolicyAttachmentTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_PolicyAttachmentTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_PolicyAttachmentTable WHERE attachment_id = $1',
            'bheihfebgi',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_PolicyAttachmentTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_PolicyAttachmentTable.prisma().query_first(
            'SELECT * FROM LiteLLM_PolicyAttachmentTable WHERE policy_name = $1',
            'biifjcaib',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_PolicyAttachmentTableCreateInput,
        include: Optional[types.LiteLLM_PolicyAttachmentTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_PolicyAttachmentTable record.

        Parameters
        ----------
        data
            LiteLLM_PolicyAttachmentTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyAttachmentTable model

        Returns
        -------
        prisma.models.LiteLLM_PolicyAttachmentTable
            The created LiteLLM_PolicyAttachmentTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_PolicyAttachmentTable record from just the required fields
        litellm_policyattachmenttable = await LiteLLM_PolicyAttachmentTable.prisma().create(
            data={
                # data to create a LiteLLM_PolicyAttachmentTable record
                'policy_name': 'fgbhfghcg',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_PolicyAttachmentTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_PolicyAttachmentTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_PolicyAttachmentTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_PolicyAttachmentTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_PolicyAttachmentTable record
                    'policy_name': 'iaidibhfb',
                },
                {
                    # data to create a LiteLLM_PolicyAttachmentTable record
                    'policy_name': 'bahaddafdc',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_PolicyAttachmentTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PolicyAttachmentTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_PolicyAttachmentTable record.

        Parameters
        ----------
        where
            LiteLLM_PolicyAttachmentTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyAttachmentTable model

        Returns
        -------
        prisma.models.LiteLLM_PolicyAttachmentTable
            The deleted LiteLLM_PolicyAttachmentTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_policyattachmenttable = await LiteLLM_PolicyAttachmentTable.prisma().delete(
            where={
                'attachment_id': 'eiaabgdjh',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_PolicyAttachmentTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PolicyAttachmentTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_PolicyAttachmentTable record.

        Parameters
        ----------
        where
            LiteLLM_PolicyAttachmentTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyAttachmentTable model

        Returns
        -------
        prisma.models.LiteLLM_PolicyAttachmentTable
            The found LiteLLM_PolicyAttachmentTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_policyattachmenttable = await LiteLLM_PolicyAttachmentTable.prisma().find_unique(
            where={
                'attachment_id': 'dhidbgbi',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_PolicyAttachmentTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PolicyAttachmentTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_PolicyAttachmentTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_PolicyAttachmentTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyAttachmentTable model

        Returns
        -------
        prisma.models.LiteLLM_PolicyAttachmentTable
            The found LiteLLM_PolicyAttachmentTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_policyattachmenttable = await LiteLLM_PolicyAttachmentTable.prisma().find_unique_or_raise(
            where={
                'attachment_id': 'ebgcfaed',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PolicyAttachmentTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PolicyAttachmentTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_PolicyAttachmentTableInclude] = None,
        order: Optional[Union[types.LiteLLM_PolicyAttachmentTableOrderByInput, List[types.LiteLLM_PolicyAttachmentTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_PolicyAttachmentTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_PolicyAttachmentTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_PolicyAttachmentTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_PolicyAttachmentTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyAttachmentTable model
        order
            Order the returned LiteLLM_PolicyAttachmentTable records by any field
        distinct
            Filter LiteLLM_PolicyAttachmentTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_PolicyAttachmentTable]
            The list of all LiteLLM_PolicyAttachmentTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_PolicyAttachmentTable records
        litellm_policyattachmenttables = await LiteLLM_PolicyAttachmentTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_PolicyAttachmentTable records ordered by the scope field
        litellm_policyattachmenttables = await LiteLLM_PolicyAttachmentTable.prisma().find_many(
            take=5,
            order={
                'scope': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PolicyAttachmentTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PolicyAttachmentTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_PolicyAttachmentTableInclude] = None,
        order: Optional[Union[types.LiteLLM_PolicyAttachmentTableOrderByInput, List[types.LiteLLM_PolicyAttachmentTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_PolicyAttachmentTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_PolicyAttachmentTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_PolicyAttachmentTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyAttachmentTable model
        order
            Order the returned LiteLLM_PolicyAttachmentTable records by any field
        distinct
            Filter LiteLLM_PolicyAttachmentTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_PolicyAttachmentTable
            The first LiteLLM_PolicyAttachmentTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_PolicyAttachmentTable record ordered by the teams field
        litellm_policyattachmenttable = await LiteLLM_PolicyAttachmentTable.prisma().find_first(
            skip=1,
            order={
                'teams': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PolicyAttachmentTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PolicyAttachmentTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_PolicyAttachmentTableInclude] = None,
        order: Optional[Union[types.LiteLLM_PolicyAttachmentTableOrderByInput, List[types.LiteLLM_PolicyAttachmentTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_PolicyAttachmentTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_PolicyAttachmentTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_PolicyAttachmentTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyAttachmentTable model
        order
            Order the returned LiteLLM_PolicyAttachmentTable records by any field
        distinct
            Filter LiteLLM_PolicyAttachmentTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_PolicyAttachmentTable
            The first LiteLLM_PolicyAttachmentTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_PolicyAttachmentTable record ordered by the keys field
        litellm_policyattachmenttable = await LiteLLM_PolicyAttachmentTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'keys': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_PolicyAttachmentTableUpdateInput,
        where: types.LiteLLM_PolicyAttachmentTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PolicyAttachmentTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_PolicyAttachmentTable record.

        Parameters
        ----------
        data
            LiteLLM_PolicyAttachmentTable record data specifying what to update
        where
            LiteLLM_PolicyAttachmentTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyAttachmentTable model

        Returns
        -------
        prisma.models.LiteLLM_PolicyAttachmentTable
            The updated LiteLLM_PolicyAttachmentTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_policyattachmenttable = await LiteLLM_PolicyAttachmentTable.prisma().update(
            where={
                'attachment_id': 'bhehecefci',
            },
            data={
                # data to update the LiteLLM_PolicyAttachmentTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_PolicyAttachmentTableWhereUniqueInput,
        data: types.LiteLLM_PolicyAttachmentTableUpsertInput,
        include: Optional[types.LiteLLM_PolicyAttachmentTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_PolicyAttachmentTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_PolicyAttachmentTable model

        Returns
        -------
        prisma.models.LiteLLM_PolicyAttachmentTable
            The created or updated LiteLLM_PolicyAttachmentTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_policyattachmenttable = await LiteLLM_PolicyAttachmentTable.prisma().upsert(
            where={
                'attachment_id': 'bbbibeefcb',
            },
            data={
                'create': {
                    'attachment_id': 'bbbibeefcb',
                    'policy_name': 'bahaddafdc',
                },
                'update': {
                    'policy_name': 'bahaddafdc',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_PolicyAttachmentTableUpdateManyMutationInput,
        where: types.LiteLLM_PolicyAttachmentTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_PolicyAttachmentTable records

        Parameters
        ----------
        data
            LiteLLM_PolicyAttachmentTable data to update the selected LiteLLM_PolicyAttachmentTable records to
        where
            Filter to select the LiteLLM_PolicyAttachmentTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_PolicyAttachmentTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_PolicyAttachmentTable records
        total = await LiteLLM_PolicyAttachmentTable.prisma().update_many(
            data={
                'models': ['bdeaddcffi']
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PolicyAttachmentTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PolicyAttachmentTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_PolicyAttachmentTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_PolicyAttachmentTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_PolicyAttachmentTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_PolicyAttachmentTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_PolicyAttachmentTable.prisma().count()

        # results: prisma.types.LiteLLM_PolicyAttachmentTableCountAggregateOutput
        results = await LiteLLM_PolicyAttachmentTable.prisma().count(
            select={
                '_all': True,
                'tags': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_PolicyAttachmentTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PolicyAttachmentTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PolicyAttachmentTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_PolicyAttachmentTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_PolicyAttachmentTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_PolicyAttachmentTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_PolicyAttachmentTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_PolicyAttachmentTableCountAggregateOutput]:
        """Count the number of LiteLLM_PolicyAttachmentTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_PolicyAttachmentTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_PolicyAttachmentTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_PolicyAttachmentTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_PolicyAttachmentTable.prisma().count()

        # results: prisma.types.LiteLLM_PolicyAttachmentTableCountAggregateOutput
        results = await LiteLLM_PolicyAttachmentTable.prisma().count(
            select={
                '_all': True,
                'created_at': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_PolicyAttachmentTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_PolicyAttachmentTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_PolicyAttachmentTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_PolicyAttachmentTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_PolicyAttachmentTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_PolicyAttachmentTable records
        total = await LiteLLM_PolicyAttachmentTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_PolicyAttachmentTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_PolicyAttachmentTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_PolicyAttachmentTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_PolicyAttachmentTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_PolicyAttachmentTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_PolicyAttachmentTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_PolicyAttachmentTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_PolicyAttachmentTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_PolicyAttachmentTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_PolicyAttachmentTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_PolicyAttachmentTableGroupByOutput']:
        """Group LiteLLM_PolicyAttachmentTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_PolicyAttachmentTable fields to group records by
        where
            LiteLLM_PolicyAttachmentTable filter to select records
        take
            Limit the maximum number of LiteLLM_PolicyAttachmentTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_PolicyAttachmentTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_PolicyAttachmentTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_PolicyAttachmentTable records by created_by values
        # and count how many records are in each group
        results = await LiteLLM_PolicyAttachmentTable.prisma().group_by(
            ['created_by'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ToolTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ToolTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ToolTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_ToolTable WHERE tool_id = $1',
            'gcfejfaih',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ToolTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ToolTable.prisma().query_first(
            'SELECT * FROM LiteLLM_ToolTable WHERE tool_name = $1',
            'bbbdbcfedg',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ToolTableCreateInput,
        include: Optional[types.LiteLLM_ToolTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ToolTable record.

        Parameters
        ----------
        data
            LiteLLM_ToolTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ToolTable model

        Returns
        -------
        prisma.models.LiteLLM_ToolTable
            The created LiteLLM_ToolTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ToolTable record from just the required fields
        litellm_tooltable = await LiteLLM_ToolTable.prisma().create(
            data={
                # data to create a LiteLLM_ToolTable record
                'tool_name': 'biiaegedcf',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ToolTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ToolTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ToolTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ToolTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ToolTable record
                    'tool_name': 'bdajbbggji',
                },
                {
                    # data to create a LiteLLM_ToolTable record
                    'tool_name': 'gijeafaad',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ToolTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ToolTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ToolTable record.

        Parameters
        ----------
        where
            LiteLLM_ToolTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ToolTable model

        Returns
        -------
        prisma.models.LiteLLM_ToolTable
            The deleted LiteLLM_ToolTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_tooltable = await LiteLLM_ToolTable.prisma().delete(
            where={
                'tool_id': 'beahcfcaai',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ToolTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ToolTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ToolTable record.

        Parameters
        ----------
        where
            LiteLLM_ToolTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ToolTable model

        Returns
        -------
        prisma.models.LiteLLM_ToolTable
            The found LiteLLM_ToolTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_tooltable = await LiteLLM_ToolTable.prisma().find_unique(
            where={
                'tool_id': 'bcihcaeghd',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ToolTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ToolTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ToolTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ToolTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ToolTable model

        Returns
        -------
        prisma.models.LiteLLM_ToolTable
            The found LiteLLM_ToolTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_tooltable = await LiteLLM_ToolTable.prisma().find_unique_or_raise(
            where={
                'tool_id': 'gbchadegc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ToolTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ToolTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ToolTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ToolTableOrderByInput, List[types.LiteLLM_ToolTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ToolTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ToolTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ToolTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ToolTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ToolTable model
        order
            Order the returned LiteLLM_ToolTable records by any field
        distinct
            Filter LiteLLM_ToolTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ToolTable]
            The list of all LiteLLM_ToolTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ToolTable records
        litellm_tooltables = await LiteLLM_ToolTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ToolTable records ordered by the origin field
        litellm_tooltables = await LiteLLM_ToolTable.prisma().find_many(
            take=5,
            order={
                'origin': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ToolTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ToolTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ToolTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ToolTableOrderByInput, List[types.LiteLLM_ToolTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ToolTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ToolTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ToolTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ToolTable model
        order
            Order the returned LiteLLM_ToolTable records by any field
        distinct
            Filter LiteLLM_ToolTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ToolTable
            The first LiteLLM_ToolTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ToolTable record ordered by the input_policy field
        litellm_tooltable = await LiteLLM_ToolTable.prisma().find_first(
            skip=1,
            order={
                'input_policy': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ToolTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ToolTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ToolTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ToolTableOrderByInput, List[types.LiteLLM_ToolTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ToolTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ToolTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ToolTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ToolTable model
        order
            Order the returned LiteLLM_ToolTable records by any field
        distinct
            Filter LiteLLM_ToolTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ToolTable
            The first LiteLLM_ToolTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ToolTable record ordered by the output_policy field
        litellm_tooltable = await LiteLLM_ToolTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'output_policy': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ToolTableUpdateInput,
        where: types.LiteLLM_ToolTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ToolTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ToolTable record.

        Parameters
        ----------
        data
            LiteLLM_ToolTable record data specifying what to update
        where
            LiteLLM_ToolTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ToolTable model

        Returns
        -------
        prisma.models.LiteLLM_ToolTable
            The updated LiteLLM_ToolTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_tooltable = await LiteLLM_ToolTable.prisma().update(
            where={
                'tool_id': 'bfdcjijjjb',
            },
            data={
                # data to update the LiteLLM_ToolTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ToolTableWhereUniqueInput,
        data: types.LiteLLM_ToolTableUpsertInput,
        include: Optional[types.LiteLLM_ToolTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ToolTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ToolTable model

        Returns
        -------
        prisma.models.LiteLLM_ToolTable
            The created or updated LiteLLM_ToolTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_tooltable = await LiteLLM_ToolTable.prisma().upsert(
            where={
                'tool_id': 'caacjjgedg',
            },
            data={
                'create': {
                    'tool_id': 'caacjjgedg',
                    'tool_name': 'gijeafaad',
                },
                'update': {
                    'tool_name': 'gijeafaad',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ToolTableUpdateManyMutationInput,
        where: types.LiteLLM_ToolTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ToolTable records

        Parameters
        ----------
        data
            LiteLLM_ToolTable data to update the selected LiteLLM_ToolTable records to
        where
            Filter to select the LiteLLM_ToolTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_ToolTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ToolTable records
        total = await LiteLLM_ToolTable.prisma().update_many(
            data={
                'call_count': 1453883005
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ToolTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ToolTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ToolTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ToolTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ToolTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ToolTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ToolTable.prisma().count()

        # results: prisma.types.LiteLLM_ToolTableCountAggregateOutput
        results = await LiteLLM_ToolTable.prisma().count(
            select={
                '_all': True,
                'assignments': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ToolTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ToolTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ToolTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_ToolTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ToolTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ToolTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ToolTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ToolTableCountAggregateOutput]:
        """Count the number of LiteLLM_ToolTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ToolTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ToolTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ToolTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ToolTable.prisma().count()

        # results: prisma.types.LiteLLM_ToolTableCountAggregateOutput
        results = await LiteLLM_ToolTable.prisma().count(
            select={
                '_all': True,
                'key_hash': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ToolTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ToolTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ToolTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_ToolTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ToolTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ToolTable records
        total = await LiteLLM_ToolTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ToolTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ToolTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ToolTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ToolTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ToolTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ToolTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ToolTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ToolTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ToolTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ToolTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ToolTableGroupByOutput']:
        """Group LiteLLM_ToolTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ToolTable fields to group records by
        where
            LiteLLM_ToolTable filter to select records
        take
            Limit the maximum number of LiteLLM_ToolTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ToolTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_ToolTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ToolTable records by team_id values
        # and count how many records are in each group
        results = await LiteLLM_ToolTable.prisma().group_by(
            ['team_id'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_AccessGroupTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_AccessGroupTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_AccessGroupTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_AccessGroupTable WHERE access_group_id = $1',
            'bdahjhgafa',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_AccessGroupTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_AccessGroupTable.prisma().query_first(
            'SELECT * FROM LiteLLM_AccessGroupTable WHERE access_group_name = $1',
            'cgjhggh',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_AccessGroupTableCreateInput,
        include: Optional[types.LiteLLM_AccessGroupTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_AccessGroupTable record.

        Parameters
        ----------
        data
            LiteLLM_AccessGroupTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_AccessGroupTable model

        Returns
        -------
        prisma.models.LiteLLM_AccessGroupTable
            The created LiteLLM_AccessGroupTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_AccessGroupTable record from just the required fields
        litellm_accessgrouptable = await LiteLLM_AccessGroupTable.prisma().create(
            data={
                # data to create a LiteLLM_AccessGroupTable record
                'access_group_name': 'bibdbeebci',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_AccessGroupTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_AccessGroupTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_AccessGroupTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_AccessGroupTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_AccessGroupTable record
                    'access_group_name': 'bfdbbfbhdh',
                },
                {
                    # data to create a LiteLLM_AccessGroupTable record
                    'access_group_name': 'bggbaaceda',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_AccessGroupTableWhereUniqueInput,
        include: Optional[types.LiteLLM_AccessGroupTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_AccessGroupTable record.

        Parameters
        ----------
        where
            LiteLLM_AccessGroupTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_AccessGroupTable model

        Returns
        -------
        prisma.models.LiteLLM_AccessGroupTable
            The deleted LiteLLM_AccessGroupTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_accessgrouptable = await LiteLLM_AccessGroupTable.prisma().delete(
            where={
                'access_group_id': 'bfhjicejf',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_AccessGroupTableWhereUniqueInput,
        include: Optional[types.LiteLLM_AccessGroupTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_AccessGroupTable record.

        Parameters
        ----------
        where
            LiteLLM_AccessGroupTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_AccessGroupTable model

        Returns
        -------
        prisma.models.LiteLLM_AccessGroupTable
            The found LiteLLM_AccessGroupTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_accessgrouptable = await LiteLLM_AccessGroupTable.prisma().find_unique(
            where={
                'access_group_id': 'bihggeiffg',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_AccessGroupTableWhereUniqueInput,
        include: Optional[types.LiteLLM_AccessGroupTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_AccessGroupTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_AccessGroupTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_AccessGroupTable model

        Returns
        -------
        prisma.models.LiteLLM_AccessGroupTable
            The found LiteLLM_AccessGroupTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_accessgrouptable = await LiteLLM_AccessGroupTable.prisma().find_unique_or_raise(
            where={
                'access_group_id': 'gfjcjcgj',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AccessGroupTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_AccessGroupTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_AccessGroupTableInclude] = None,
        order: Optional[Union[types.LiteLLM_AccessGroupTableOrderByInput, List[types.LiteLLM_AccessGroupTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_AccessGroupTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_AccessGroupTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_AccessGroupTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_AccessGroupTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_AccessGroupTable model
        order
            Order the returned LiteLLM_AccessGroupTable records by any field
        distinct
            Filter LiteLLM_AccessGroupTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_AccessGroupTable]
            The list of all LiteLLM_AccessGroupTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_AccessGroupTable records
        litellm_accessgrouptables = await LiteLLM_AccessGroupTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_AccessGroupTable records ordered by the description field
        litellm_accessgrouptables = await LiteLLM_AccessGroupTable.prisma().find_many(
            take=5,
            order={
                'description': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AccessGroupTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_AccessGroupTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_AccessGroupTableInclude] = None,
        order: Optional[Union[types.LiteLLM_AccessGroupTableOrderByInput, List[types.LiteLLM_AccessGroupTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_AccessGroupTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_AccessGroupTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_AccessGroupTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_AccessGroupTable model
        order
            Order the returned LiteLLM_AccessGroupTable records by any field
        distinct
            Filter LiteLLM_AccessGroupTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_AccessGroupTable
            The first LiteLLM_AccessGroupTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_AccessGroupTable record ordered by the access_model_names field
        litellm_accessgrouptable = await LiteLLM_AccessGroupTable.prisma().find_first(
            skip=1,
            order={
                'access_model_names': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AccessGroupTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_AccessGroupTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_AccessGroupTableInclude] = None,
        order: Optional[Union[types.LiteLLM_AccessGroupTableOrderByInput, List[types.LiteLLM_AccessGroupTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_AccessGroupTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_AccessGroupTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_AccessGroupTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_AccessGroupTable model
        order
            Order the returned LiteLLM_AccessGroupTable records by any field
        distinct
            Filter LiteLLM_AccessGroupTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_AccessGroupTable
            The first LiteLLM_AccessGroupTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_AccessGroupTable record ordered by the access_mcp_server_ids field
        litellm_accessgrouptable = await LiteLLM_AccessGroupTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'access_mcp_server_ids': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_AccessGroupTableUpdateInput,
        where: types.LiteLLM_AccessGroupTableWhereUniqueInput,
        include: Optional[types.LiteLLM_AccessGroupTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_AccessGroupTable record.

        Parameters
        ----------
        data
            LiteLLM_AccessGroupTable record data specifying what to update
        where
            LiteLLM_AccessGroupTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_AccessGroupTable model

        Returns
        -------
        prisma.models.LiteLLM_AccessGroupTable
            The updated LiteLLM_AccessGroupTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_accessgrouptable = await LiteLLM_AccessGroupTable.prisma().update(
            where={
                'access_group_id': 'bdbfcaecji',
            },
            data={
                # data to update the LiteLLM_AccessGroupTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_AccessGroupTableWhereUniqueInput,
        data: types.LiteLLM_AccessGroupTableUpsertInput,
        include: Optional[types.LiteLLM_AccessGroupTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_AccessGroupTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_AccessGroupTable model

        Returns
        -------
        prisma.models.LiteLLM_AccessGroupTable
            The created or updated LiteLLM_AccessGroupTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_accessgrouptable = await LiteLLM_AccessGroupTable.prisma().upsert(
            where={
                'access_group_id': 'bhehbjdead',
            },
            data={
                'create': {
                    'access_group_id': 'bhehbjdead',
                    'access_group_name': 'bggbaaceda',
                },
                'update': {
                    'access_group_name': 'bggbaaceda',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_AccessGroupTableUpdateManyMutationInput,
        where: types.LiteLLM_AccessGroupTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_AccessGroupTable records

        Parameters
        ----------
        data
            LiteLLM_AccessGroupTable data to update the selected LiteLLM_AccessGroupTable records to
        where
            Filter to select the LiteLLM_AccessGroupTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_AccessGroupTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_AccessGroupTable records
        total = await LiteLLM_AccessGroupTable.prisma().update_many(
            data={
                'access_agent_ids': ['bdehfgfjbc']
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AccessGroupTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_AccessGroupTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_AccessGroupTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_AccessGroupTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_AccessGroupTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_AccessGroupTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_AccessGroupTable.prisma().count()

        # results: prisma.types.LiteLLM_AccessGroupTableCountAggregateOutput
        results = await LiteLLM_AccessGroupTable.prisma().count(
            select={
                '_all': True,
                'assigned_team_ids': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_AccessGroupTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AccessGroupTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_AccessGroupTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_AccessGroupTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_AccessGroupTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_AccessGroupTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_AccessGroupTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_AccessGroupTableCountAggregateOutput]:
        """Count the number of LiteLLM_AccessGroupTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_AccessGroupTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_AccessGroupTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_AccessGroupTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_AccessGroupTable.prisma().count()

        # results: prisma.types.LiteLLM_AccessGroupTableCountAggregateOutput
        results = await LiteLLM_AccessGroupTable.prisma().count(
            select={
                '_all': True,
                'assigned_key_ids': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_AccessGroupTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_AccessGroupTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_AccessGroupTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_AccessGroupTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_AccessGroupTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_AccessGroupTable records
        total = await LiteLLM_AccessGroupTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_AccessGroupTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_AccessGroupTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_AccessGroupTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_AccessGroupTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_AccessGroupTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_AccessGroupTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_AccessGroupTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_AccessGroupTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_AccessGroupTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_AccessGroupTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_AccessGroupTableGroupByOutput']:
        """Group LiteLLM_AccessGroupTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_AccessGroupTable fields to group records by
        where
            LiteLLM_AccessGroupTable filter to select records
        take
            Limit the maximum number of LiteLLM_AccessGroupTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_AccessGroupTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_AccessGroupTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_AccessGroupTable records by created_at values
        # and count how many records are in each group
        results = await LiteLLM_AccessGroupTable.prisma().group_by(
            ['created_at'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]


class LiteLLM_ClaudeCodePluginTableActions(Generic[_PrismaModelT]):
    __slots__ = (
        '_client',
        '_model',
    )

    def __init__(self, client: Prisma, model: Type[_PrismaModelT]) -> None:
        self._client = client
        self._model = model

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[_PrismaModelT]:
        """Execute a raw SQL query

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        List[prisma.models.LiteLLM_ClaudeCodePluginTable]
            The records returned by the SQL query

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        users = await LiteLLM_ClaudeCodePluginTable.prisma().query_raw(
            'SELECT * FROM LiteLLM_ClaudeCodePluginTable WHERE id = $1',
            'bjcbhdjeeb',
        )
        ```
        """
        return await self._client.query_raw(query, *args, model=self._model)

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> Optional[_PrismaModelT]:
        """Execute a raw SQL query, returning the first result

        Parameters
        ----------
        query
            The raw SQL query string to be executed
        *args
            Parameters to be passed to the SQL query, these MUST be used over
            string formatting to avoid an SQL injection vulnerability

        Returns
        -------
        prisma.models.LiteLLM_ClaudeCodePluginTable
            The first record returned by the SQL query
        None
            The raw SQL query did not return any records

        Raises
        ------
        prisma_errors.RawQueryError
            This could be due to invalid syntax, mismatched number of parameters or any other error
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        user = await LiteLLM_ClaudeCodePluginTable.prisma().query_first(
            'SELECT * FROM LiteLLM_ClaudeCodePluginTable WHERE name = $1',
            'jacahdcdi',
        )
        ```
        """
        return await self._client.query_first(query, *args, model=self._model)

    async def create(
        self,
        data: types.LiteLLM_ClaudeCodePluginTableCreateInput,
        include: Optional[types.LiteLLM_ClaudeCodePluginTableInclude] = None
    ) -> _PrismaModelT:
        """Create a new LiteLLM_ClaudeCodePluginTable record.

        Parameters
        ----------
        data
            LiteLLM_ClaudeCodePluginTable record data
        include
            Specifies which relations should be loaded on the returned LiteLLM_ClaudeCodePluginTable model

        Returns
        -------
        prisma.models.LiteLLM_ClaudeCodePluginTable
            The created LiteLLM_ClaudeCodePluginTable record

        Raises
        ------
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # create a LiteLLM_ClaudeCodePluginTable record from just the required fields
        litellm_claudecodeplugintable = await LiteLLM_ClaudeCodePluginTable.prisma().create(
            data={
                # data to create a LiteLLM_ClaudeCodePluginTable record
                'name': 'bdjgdjgicd',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='create',
            model=self._model,
            arguments={
                'data': data,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def create_many(
        self,
        data: List[types.LiteLLM_ClaudeCodePluginTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> int:
        """Create multiple LiteLLM_ClaudeCodePluginTable records at once.

        This function is *not* available when using SQLite.

        Parameters
        ----------
        data
            List of LiteLLM_ClaudeCodePluginTable record data
        skip_duplicates
            Boolean flag for ignoring unique constraint errors

        Returns
        -------
        int
            The total number of records created

        Raises
        ------
        prisma.errors.UnsupportedDatabaseError
            Attempting to query when using SQLite
        prisma.errors.UniqueViolationError
            A unique constraint check has failed, these can be ignored with the `skip_duplicates` argument
        prisma.errors.MissingRequiredValueError
            Value is required but was not found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        total = await LiteLLM_ClaudeCodePluginTable.prisma().create_many(
            data=[
                {
                    # data to create a LiteLLM_ClaudeCodePluginTable record
                    'name': 'fajeeijge',
                },
                {
                    # data to create a LiteLLM_ClaudeCodePluginTable record
                    'name': 'haabcbdcf',
                },
            ],
            skip_duplicates=True,
        )
        ```
        """
        if skip_duplicates and self._client._active_provider in CREATE_MANY_SKIP_DUPLICATES_UNSUPPORTED:
            raise errors.UnsupportedDatabaseError(self._client._active_provider, 'create_many_skip_duplicates')

        resp = await self._client._execute(
            method='create_many',
            model=self._model,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    async def delete(
        self,
        where: types.LiteLLM_ClaudeCodePluginTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ClaudeCodePluginTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Delete a single LiteLLM_ClaudeCodePluginTable record.

        Parameters
        ----------
        where
            LiteLLM_ClaudeCodePluginTable filter to select the record to be deleted, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ClaudeCodePluginTable model

        Returns
        -------
        prisma.models.LiteLLM_ClaudeCodePluginTable
            The deleted LiteLLM_ClaudeCodePluginTable record
        None
            Could not find a record to delete

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_claudecodeplugintable = await LiteLLM_ClaudeCodePluginTable.prisma().delete(
            where={
                'id': 'fjahchjha',
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='delete',
                model=self._model,
                arguments={
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def find_unique(
        self,
        where: types.LiteLLM_ClaudeCodePluginTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ClaudeCodePluginTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Find a unique LiteLLM_ClaudeCodePluginTable record.

        Parameters
        ----------
        where
            LiteLLM_ClaudeCodePluginTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ClaudeCodePluginTable model

        Returns
        -------
        prisma.models.LiteLLM_ClaudeCodePluginTable
            The found LiteLLM_ClaudeCodePluginTable record
        None
            No record matching the given input could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_claudecodeplugintable = await LiteLLM_ClaudeCodePluginTable.prisma().find_unique(
            where={
                'id': 'fdieegcfj',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None
        return model_parse(self._model, result)

    async def find_unique_or_raise(
        self,
        where: types.LiteLLM_ClaudeCodePluginTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ClaudeCodePluginTableInclude] = None
    ) -> _PrismaModelT:
        """Find a unique LiteLLM_ClaudeCodePluginTable record. Raises `RecordNotFoundError` if no record is found.

        Parameters
        ----------
        where
            LiteLLM_ClaudeCodePluginTable filter to find the record, must be unique
        include
            Specifies which relations should be loaded on the returned LiteLLM_ClaudeCodePluginTable model

        Returns
        -------
        prisma.models.LiteLLM_ClaudeCodePluginTable
            The found LiteLLM_ClaudeCodePluginTable record

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_claudecodeplugintable = await LiteLLM_ClaudeCodePluginTable.prisma().find_unique_or_raise(
            where={
                'id': 'biijhcbcaa',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_unique_or_raise',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def find_many(
        self,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ClaudeCodePluginTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ClaudeCodePluginTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ClaudeCodePluginTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ClaudeCodePluginTableOrderByInput, List[types.LiteLLM_ClaudeCodePluginTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ClaudeCodePluginTableScalarFieldKeys]] = None,
    ) -> List[_PrismaModelT]:
        """Find multiple LiteLLM_ClaudeCodePluginTable records.

        An empty list is returned if no records could be found.

        Parameters
        ----------
        take
            Limit the maximum number of LiteLLM_ClaudeCodePluginTable records returned
        skip
            Ignore the first N results
        where
            LiteLLM_ClaudeCodePluginTable filter to select records
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ClaudeCodePluginTable model
        order
            Order the returned LiteLLM_ClaudeCodePluginTable records by any field
        distinct
            Filter LiteLLM_ClaudeCodePluginTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        List[prisma.models.LiteLLM_ClaudeCodePluginTable]
            The list of all LiteLLM_ClaudeCodePluginTable records that could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the first 10 LiteLLM_ClaudeCodePluginTable records
        litellm_claudecodeplugintables = await LiteLLM_ClaudeCodePluginTable.prisma().find_many(take=10)

        # find the first 5 LiteLLM_ClaudeCodePluginTable records ordered by the version field
        litellm_claudecodeplugintables = await LiteLLM_ClaudeCodePluginTable.prisma().find_many(
            take=5,
            order={
                'version': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_many',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return [model_parse(self._model, r) for r in resp['data']['result']]

    async def find_first(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ClaudeCodePluginTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ClaudeCodePluginTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ClaudeCodePluginTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ClaudeCodePluginTableOrderByInput, List[types.LiteLLM_ClaudeCodePluginTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ClaudeCodePluginTableScalarFieldKeys]] = None,
    ) -> Optional[_PrismaModelT]:
        """Find a single LiteLLM_ClaudeCodePluginTable record.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ClaudeCodePluginTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ClaudeCodePluginTable model
        order
            Order the returned LiteLLM_ClaudeCodePluginTable records by any field
        distinct
            Filter LiteLLM_ClaudeCodePluginTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ClaudeCodePluginTable
            The first LiteLLM_ClaudeCodePluginTable record found, matching the given arguments
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ClaudeCodePluginTable record ordered by the description field
        litellm_claudecodeplugintable = await LiteLLM_ClaudeCodePluginTable.prisma().find_first(
            skip=1,
            order={
                'description': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        result = resp['data']['result']
        if result is None:
            return None

        return model_parse(self._model, result)

    async def find_first_or_raise(
        self,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ClaudeCodePluginTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ClaudeCodePluginTableWhereUniqueInput] = None,
        include: Optional[types.LiteLLM_ClaudeCodePluginTableInclude] = None,
        order: Optional[Union[types.LiteLLM_ClaudeCodePluginTableOrderByInput, List[types.LiteLLM_ClaudeCodePluginTableOrderByInput]]] = None,
        distinct: Optional[List[types.LiteLLM_ClaudeCodePluginTableScalarFieldKeys]] = None,
    ) -> _PrismaModelT:
        """Find a single LiteLLM_ClaudeCodePluginTable record. Raises `RecordNotFoundError` if no record was found.

        Parameters
        ----------
        skip
            Ignore the first N records
        where
            LiteLLM_ClaudeCodePluginTable filter to select the record
        cursor
            Specifies the position in the list to start returning results from, (typically an ID field)
        include
            Specifies which relations should be loaded on the returned LiteLLM_ClaudeCodePluginTable model
        order
            Order the returned LiteLLM_ClaudeCodePluginTable records by any field
        distinct
            Filter LiteLLM_ClaudeCodePluginTable records by either a single distinct field or distinct combinations of fields

        Returns
        -------
        prisma.models.LiteLLM_ClaudeCodePluginTable
            The first LiteLLM_ClaudeCodePluginTable record found, matching the given arguments

        Raises
        ------
        prisma.errors.RecordNotFoundError
            No record was found
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # find the second LiteLLM_ClaudeCodePluginTable record ordered by the manifest_json field
        litellm_claudecodeplugintable = await LiteLLM_ClaudeCodePluginTable.prisma().find_first_or_raise(
            skip=1,
            order={
                'manifest_json': 'desc',
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='find_first_or_raise',
            model=self._model,
            arguments={
                'skip': skip,
                'where': where,
                'order_by': order,
                'cursor': cursor,
                'include': include,
                'distinct': distinct,
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update(
        self,
        data: types.LiteLLM_ClaudeCodePluginTableUpdateInput,
        where: types.LiteLLM_ClaudeCodePluginTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ClaudeCodePluginTableInclude] = None
    ) -> Optional[_PrismaModelT]:
        """Update a single LiteLLM_ClaudeCodePluginTable record.

        Parameters
        ----------
        data
            LiteLLM_ClaudeCodePluginTable record data specifying what to update
        where
            LiteLLM_ClaudeCodePluginTable filter to select the unique record to create / update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ClaudeCodePluginTable model

        Returns
        -------
        prisma.models.LiteLLM_ClaudeCodePluginTable
            The updated LiteLLM_ClaudeCodePluginTable record
        None
            No record could be found

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        litellm_claudecodeplugintable = await LiteLLM_ClaudeCodePluginTable.prisma().update(
            where={
                'id': 'bacafajjcj',
            },
            data={
                # data to update the LiteLLM_ClaudeCodePluginTable record to
            },
        )
        ```
        """
        try:
            resp = await self._client._execute(
                method='update',
                model=self._model,
                arguments={
                    'data': data,
                    'where': where,
                    'include': include,
                },
            )
        except errors.RecordNotFoundError:
            return None

        return model_parse(self._model, resp['data']['result'])

    async def upsert(
        self,
        where: types.LiteLLM_ClaudeCodePluginTableWhereUniqueInput,
        data: types.LiteLLM_ClaudeCodePluginTableUpsertInput,
        include: Optional[types.LiteLLM_ClaudeCodePluginTableInclude] = None,
    ) -> _PrismaModelT:
        """Updates an existing record or create a new one

        Parameters
        ----------
        where
            LiteLLM_ClaudeCodePluginTable filter to select the unique record to create / update
        data
            Data specifying what fields to set on create and update
        include
            Specifies which relations should be loaded on the returned LiteLLM_ClaudeCodePluginTable model

        Returns
        -------
        prisma.models.LiteLLM_ClaudeCodePluginTable
            The created or updated LiteLLM_ClaudeCodePluginTable record

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python
        prisma.errors.MissingRequiredValueError
            Value is required but was not found

        Example
        -------
        ```py
        litellm_claudecodeplugintable = await LiteLLM_ClaudeCodePluginTable.prisma().upsert(
            where={
                'id': 'jjiigehfa',
            },
            data={
                'create': {
                    'id': 'jjiigehfa',
                    'name': 'haabcbdcf',
                },
                'update': {
                    'name': 'haabcbdcf',
                },
            },
        )
        ```
        """
        resp = await self._client._execute(
            method='upsert',
            model=self._model,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )
        return model_parse(self._model, resp['data']['result'])

    async def update_many(
        self,
        data: types.LiteLLM_ClaudeCodePluginTableUpdateManyMutationInput,
        where: types.LiteLLM_ClaudeCodePluginTableWhereInput,
    ) -> int:
        """Update multiple LiteLLM_ClaudeCodePluginTable records

        Parameters
        ----------
        data
            LiteLLM_ClaudeCodePluginTable data to update the selected LiteLLM_ClaudeCodePluginTable records to
        where
            Filter to select the LiteLLM_ClaudeCodePluginTable records to update

        Returns
        -------
        int
            The total number of LiteLLM_ClaudeCodePluginTable records that were updated

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # update all LiteLLM_ClaudeCodePluginTable records
        total = await LiteLLM_ClaudeCodePluginTable.prisma().update_many(
            data={
                'files_json': 'bfajgfhhf'
            },
            where={}
        )
        ```
        """
        resp = await self._client._execute(
            method='update_many',
            model=self._model,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    @overload
    async def count(
        self,
        select: None = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ClaudeCodePluginTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ClaudeCodePluginTableWhereUniqueInput] = None,
    ) -> int:
        """Count the number of LiteLLM_ClaudeCodePluginTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ClaudeCodePluginTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ClaudeCodePluginTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ClaudeCodePluginTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ClaudeCodePluginTable.prisma().count()

        # results: prisma.types.LiteLLM_ClaudeCodePluginTableCountAggregateOutput
        results = await LiteLLM_ClaudeCodePluginTable.prisma().count(
            select={
                '_all': True,
                'enabled': True,
            },
        )
        ```
        """


    @overload
    async def count(
        self,
        select: types.LiteLLM_ClaudeCodePluginTableCountAggregateInput,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ClaudeCodePluginTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ClaudeCodePluginTableWhereUniqueInput] = None,
    ) -> types.LiteLLM_ClaudeCodePluginTableCountAggregateOutput:
        ...

    async def count(
        self,
        select: Optional[types.LiteLLM_ClaudeCodePluginTableCountAggregateInput] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        where: Optional[types.LiteLLM_ClaudeCodePluginTableWhereInput] = None,
        cursor: Optional[types.LiteLLM_ClaudeCodePluginTableWhereUniqueInput] = None,
    ) -> Union[int, types.LiteLLM_ClaudeCodePluginTableCountAggregateOutput]:
        """Count the number of LiteLLM_ClaudeCodePluginTable records present in the database

        Parameters
        ----------
        select
            Select the LiteLLM_ClaudeCodePluginTable fields to be counted
        take
            Limit the maximum result
        skip
            Ignore the first N records
        where
            LiteLLM_ClaudeCodePluginTable filter to find records
        cursor
            Specifies the position in the list to start counting results from, (typically an ID field)
        order
            This parameter is deprecated and will be removed in a future release

        Returns
        -------
        int
            The total number of records found, returned if `select` is not given

        prisma.types.LiteLLM_ClaudeCodePluginTableCountAggregateOutput
            Data returned when `select` is used, the fields present in this dictionary will
            match the fields passed in the `select` argument

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # total: int
        total = await LiteLLM_ClaudeCodePluginTable.prisma().count()

        # results: prisma.types.LiteLLM_ClaudeCodePluginTableCountAggregateOutput
        results = await LiteLLM_ClaudeCodePluginTable.prisma().count(
            select={
                '_all': True,
                'created_at': True,
            },
        )
        ```
        """

        # TODO: this selection building should be moved to the QueryBuilder
        #
        # note the distinction between checking for `not select` here and `select is None`
        # later is to handle the case that the given select dictionary is empty, this
        # is a limitation of our types.
        if not select:
            root_selection = ['_count { _all }']
        else:

            root_selection = [
                '_count {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))
            ]

        resp = await self._client._execute(
            method='count',
            model=self._model,
            arguments={
                'take': take,
                'skip': skip,
                'where': where,
                'cursor': cursor,
            },
            root_selection=root_selection,
        )

        if select is None:
            return cast(int, resp['data']['result']['_count']['_all'])
        else:
            return cast(types.LiteLLM_ClaudeCodePluginTableCountAggregateOutput, resp['data']['result']['_count'])

    async def delete_many(
        self,
        where: Optional[types.LiteLLM_ClaudeCodePluginTableWhereInput] = None
    ) -> int:
        """Delete multiple LiteLLM_ClaudeCodePluginTable records.

        Parameters
        ----------
        where
            Optional LiteLLM_ClaudeCodePluginTable filter to find the records to be deleted

        Returns
        -------
        int
            The total number of LiteLLM_ClaudeCodePluginTable records that were deleted

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # delete all LiteLLM_ClaudeCodePluginTable records
        total = await LiteLLM_ClaudeCodePluginTable.prisma().delete_many()
        ```
        """
        resp = await self._client._execute(
            method='delete_many',
            model=self._model,
            arguments={'where': where},
            root_selection=['count'],
        )
        return int(resp['data']['result']['count'])

    # TODO: make this easier to work with safely, currently output fields are typed as
    #       not required, we should refactor the return type
    # TODO: consider returning a Dict where the keys are a Tuple of the `by` selection
    # TODO: statically type that the order argument is required when take or skip are present
    async def group_by(
        self,
        by: List['types.LiteLLM_ClaudeCodePluginTableScalarFieldKeys'],
        *,
        where: Optional['types.LiteLLM_ClaudeCodePluginTableWhereInput'] = None,
        take: Optional[int] = None,
        skip: Optional[int] = None,
        avg: Optional['types.LiteLLM_ClaudeCodePluginTableAvgAggregateInput'] = None,
        sum: Optional['types.LiteLLM_ClaudeCodePluginTableSumAggregateInput'] = None,
        min: Optional['types.LiteLLM_ClaudeCodePluginTableMinAggregateInput'] = None,
        max: Optional['types.LiteLLM_ClaudeCodePluginTableMaxAggregateInput'] = None,
        having: Optional['types.LiteLLM_ClaudeCodePluginTableScalarWhereWithAggregatesInput'] = None,
        count: Optional[Union[bool, 'types.LiteLLM_ClaudeCodePluginTableCountAggregateInput']] = None,
        order: Optional[Union[Mapping['types.LiteLLM_ClaudeCodePluginTableScalarFieldKeys', 'types.SortOrder'], List[Mapping['types.LiteLLM_ClaudeCodePluginTableScalarFieldKeys', 'types.SortOrder']]]] = None,
    ) -> List['types.LiteLLM_ClaudeCodePluginTableGroupByOutput']:
        """Group LiteLLM_ClaudeCodePluginTable records by one or more field values and perform aggregations
        each group such as finding the average.

        Parameters
        ----------
        by
            List of scalar LiteLLM_ClaudeCodePluginTable fields to group records by
        where
            LiteLLM_ClaudeCodePluginTable filter to select records
        take
            Limit the maximum number of LiteLLM_ClaudeCodePluginTable records returned
        skip
            Ignore the first N records
        avg
            Adds the average of all values of the specified fields to the `_avg` field
            in the returned data.
        sum
            Adds the sum of all values of the specified fields to the `_sum` field
            in the returned data.
        min
            Adds the smallest available value for the specified fields to the `_min` field
            in the returned data.
        max
            Adds the largest available value for the specified fields to the `_max` field
            in the returned data.
        count
            Adds a count of non-fields to the `_count` field in the returned data.
        having
            Allows you to filter groups by an aggregate value - for example only return
            groups having an average age less than 50.
        order
            Lets you order the returned list by any property that is also present in `by`.
            Only **one** field is allowed at a time.

        Returns
        -------
        List[prisma.types.LiteLLM_ClaudeCodePluginTableGroupByOutput]
            A list of dictionaries representing the LiteLLM_ClaudeCodePluginTable record,
            this will also have additional fields present if aggregation arguments
            are used (see the above parameters)

        Raises
        ------
        prisma.errors.PrismaError
            Catch all for every exception raised by Prisma Client Python

        Example
        -------
        ```py
        # group LiteLLM_ClaudeCodePluginTable records by updated_at values
        # and count how many records are in each group
        results = await LiteLLM_ClaudeCodePluginTable.prisma().group_by(
            ['updated_at'],
            count=True,
        )
        ```
        """
        if order is None:
            if take is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'take\' is present')

            if skip is not None:
                raise TypeError('Missing argument: \'order\' which is required when \'skip\' is present')

        root_selection: List[str] = [*by]
        if avg is not None:
            root_selection.append(_select_fields('_avg', avg))

        if min is not None:
            root_selection.append(_select_fields('_min', min))

        if sum is not None:
            root_selection.append(_select_fields('_sum', sum))

        if max is not None:
            root_selection.append(_select_fields('_max', max))

        if count is not None:
            if count is True:
                root_selection.append('_count { _all }')
            elif isinstance(count, dict):
                root_selection.append(_select_fields('_count', count))

        resp = await self._client._execute(
            method='group_by',
            model=self._model,
            arguments={
                'by': by,
                'take': take,
                'skip': skip,
                'where': where,
                'having': having,
                'orderBy': order,
            },
            root_selection=root_selection,
        )
        return resp['data']['result']  # type: ignore[no-any-return]



def _select_fields(root: str, select: Mapping[str, Any]) -> str:
    """Helper to build a GraphQL selection string

    This is a work around until field selection is added to the query builder.
    """

    return root + ' {{ {0} }}'.format(' '.join(k for k, v in select.items() if v is True))


from . import models