o
    i:&                     @   s   d dl Z d dlmZ ddlmZ ddlmZmZ ddlm	Z	m
Z
 ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ G dd dZG dd dZdS )    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)construct_type)BadRequestError)GetModelV1Response)ListModelsV1Responsec                
   @   v   e Zd ZdefddZddddedeje deje	 d	e
e fd
dZdddededeje	 d	e
e fddZdS )RawModelsClientclient_wrapperc                C   
   || _ d S N_client_wrapperselfr    r   a/home/ubuntu/.local/lib/python3.10/site-packages/deepgram/manage/v1/projects/models/raw_client.py__init__      
zRawModelsClient.__init__Ninclude_outdatedrequest_options
project_idr   r   returnc             	   C   s   | j jjdt| d| j  jdd|i|d}z@d|j  kr$dk r9n ntt	t
t	| d}t||d	W S |jd
krStt|jttjt
tj| dd| }W n tyk   t|jt|j|jdw t|jt|j|d)a#  
        Returns metadata on all the latest models that a specific project has access to, including non-public models

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        include_outdated : typing.Optional[bool]
            returns non-latest versions of models

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

        Returns
        -------
        HttpResponse[ListModelsV1Response]
            A list of models
        v1/projects//modelsGETr   base_urlmethodparamsr      ,  type_object_responsedata  headersbodystatus_coder2   r3   )r   httpx_clientrequestr	   get_environmentbaser5   typingcastr   r   jsonr   r   dictr2   Anyr   r   textr   r   r   r   	_response_data_response_jsonr   r   r   list   sD   
	

zRawModelsClient.listr   model_idc             	   C   s   | j jjdt| dt| | j  jd|d}z@d|j  kr%dk r:n ntt	t
t	| d}t||dW S |jd	krTtt|jttjt
tj| dd
| }W n tyl   t|jt|j|jdw t|jt|j|d)a  
        Returns metadata for a specific model

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        model_id : str
            The specific UUID of the model

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

        Returns
        -------
        HttpResponse[GetModelV1Response]
            A model object that can be either STT or TTS
        r!   /models/r#   r%   r&   r   r(   r)   r*   r-   r0   r1   r4   )r   r6   r7   r	   r8   r9   r5   r:   r;   r   r   r<   r   r   r=   r2   r>   r   r   r?   r   r   rF   r   rA   rB   rC   r   r   r   getR   s@   


zRawModelsClient.get)__name__
__module____qualname__r   r   strr:   Optionalboolr
   r   r   rD   r   rJ   r   r   r   r   r      .    
>r   c                
   @   r   )AsyncRawModelsClientr   c                C   r   r   r   r   r   r   r   r      r   zAsyncRawModelsClient.__init__Nr   r   r   r   r    c             	      s   | j jjdt| d| j  jdd|i|dI dH }z@d|j  kr(dk r=n ntt	t
t	| d	}t||d
W S |jdkrWtt|jttjt
tj| d	d| }W n tyo   t|jt|j|jdw t|jt|j|d)a(  
        Returns metadata on all the latest models that a specific project has access to, including non-public models

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        include_outdated : typing.Optional[bool]
            returns non-latest versions of models

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

        Returns
        -------
        AsyncHttpResponse[ListModelsV1Response]
            A list of models
        r!   r"   r#   r   r$   Nr(   r)   r*   r-   r0   r1   r4   )r   r6   r7   r	   r8   r9   r5   r:   r;   r   r   r<   r   r   r=   r2   r>   r   r   r?   r@   r   r   r   rD      sF   
	

zAsyncRawModelsClient.listrE   rF   c             	      s   | j jjdt| dt| | j  jd|dI dH }z@d|j  kr)dk r>n ntt	t
t	| d}t||d	W S |jd
krXtt|jttjt
tj| dd| }W n typ   t|jt|j|jdw t|jt|j|d)a  
        Returns metadata for a specific model

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        model_id : str
            The specific UUID of the model

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

        Returns
        -------
        AsyncHttpResponse[GetModelV1Response]
            A model object that can be either STT or TTS
        r!   rG   r#   rH   Nr(   r)   r*   r-   r0   r1   r4   )r   r6   r7   r	   r8   r9   r5   r:   r;   r   r   r<   r   r   r=   r2   r>   r   r   r?   rI   r   r   r   rJ      sB   


zAsyncRawModelsClient.get)rK   rL   rM   r   r   rN   r:   rO   rP   r
   r   r   rD   r   rJ   r   r   r   r   rR      rQ   rR   )r:   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r   core.jsonable_encoderr	   core.request_optionsr
   core.unchecked_base_modelr   errors.bad_request_errorr   types.get_model_v1responser   types.list_models_v1responser   r   rR   r   r   r   r   <module>   s   x