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                   @   n   e Zd ZdefddZddddeje deje de	e
 fd	d
Zdd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   X/home/ubuntu/.local/lib/python3.10/site-packages/deepgram/manage/v1/models/raw_client.py__init__      
zRawModelsClient.__init__Ninclude_outdatedrequest_optionsr   r   returnc             	   C   s   | j jjd| j  jdd|i|d}z@d|j  krdk r3n nttt	t|
 d}t||dW S |jd	krMtt|jttjt	tj|
 dd
|
 }W n tye   t|jt|j|jdw t|jt|j|d)a  
        Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models.

        Parameters
        ----------
        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/modelsGETr   base_urlmethodparamsr      ,  type_object_responsedata  headersbodystatus_coder0   r1   )r   httpx_clientrequestget_environmentbaser3   typingcastr   r   jsonr   r   dictr0   Anyr   r   textr   r   r   	_response_data_response_jsonr   r   r   list   sD   
	

zRawModelsClient.listr   model_idc             	   C   s   | j jjdt| | j  jd|d}z@d|j  kr dk r5n ntt	t
t	| d}t||dW S |jdkrOtt|jttjt
tj| dd	| }W n tyg   t|jt|j|jd
w t|jt|j|d
)a  
        Returns metadata for a specific public model

        Parameters
        ----------
        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
        
v1/models/r!   r#   r$   r   r&   r'   r(   r+   r.   r/   r2   )r   r4   r5   r	   r6   r7   r3   r8   r9   r   r   r:   r   r   r;   r0   r<   r   r   r=   r   rD   r   r?   r@   rA   r   r   r   getK   s@   


zRawModelsClient.get)__name__
__module____qualname__r   r   r8   Optionalboolr
   r   r   rB   strr   rH   r   r   r   r   r      $    
7r   c                   @   r   )AsyncRawModelsClientr   c                C   r   r   r   r   r   r   r   r      r   zAsyncRawModelsClient.__init__Nr   r   r   r   c             	      s   | j jjd| j  jdd|i|dI dH }z@d|j  kr"dk r7n nttt	t|
 d}t||d	W S |jd
krQtt|jttjt	tj|
 dd|
 }W n tyi   t|jt|j|jdw t|jt|j|d)a  
        Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models.

        Parameters
        ----------
        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"   Nr&   r'   r(   r+   r.   r/   r2   )r   r4   r5   r6   r7   r3   r8   r9   r   r   r:   r   r   r;   r0   r<   r   r   r=   r>   r   r   r   rB      sF   
	

zAsyncRawModelsClient.listrC   rD   c             	      s   | j jjdt| | j  jd|dI dH }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 for a specific public model

        Parameters
        ----------
        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
        rE   r!   rF   Nr&   r'   r(   r+   r.   r/   r2   )r   r4   r5   r	   r6   r7   r3   r8   r9   r   r   r:   r   r   r;   r0   r<   r   r   r=   rG   r   r   r   rH      sB   


zAsyncRawModelsClient.get)rI   rJ   rK   r   r   r8   rL   rM   r
   r   r   rB   rN   r   rH   r   r   r   r   rP      rO   rP   )r8   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   rP   r   r   r   r   <module>   s   n