
    iz                         d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	m
Z
 ddlmZ ddlmZ dd	lmZmZmZmZ  G d
 de      Zy)zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.   )BaseSDK    )modelsutils)HookContext)OptionalNullableUNSET)get_security_from_env)unmarshal_json_response)AnyMappingOptionalUnionc                   p   e Zd ZdZedddddedeej                  ej                  f   de
ej                     dee   dee   d	eeeef      d
ej                   fdZedddddedeej                  ej                  f   de
ej                     dee   dee   d	eeeef      d
ej                   fdZedddddeej&                  ej(                  f   dede
ej                     dee   dee   d	eeeef      d
ej                   fdZedddddeej&                  ej(                  f   dede
ej                     dee   dee   d	eeeef      d
ej                   fdZedddddedeej                  ej                  f   de
ej                     dee   dee   d	eeeef      d
ej.                  fdZedddddedeej                  ej                  f   de
ej                     dee   dee   d	eeeef      d
ej.                  fdZedddddedeej4                  ej6                  f   de
ej                     dee   dee   d	eeeef      d
ej.                  fdZedddddedeej4                  ej6                  f   de
ej                     dee   dee   d	eeeef      d
ej.                  fdZy)ClassifierszClassifiers API.N)retries
server_url
timeout_mshttp_headersmodelinputsr   r   r   r   returnc                   d}d}|| j                   j                  }||}n| j                  ||      }t        j                  ||      | j                  dd||ddddd|| j                   j                  fd	|
      }	|t        k(  r2| j                   j                  t        ur| j                   j                  }d}
t        |t        j                        r|g df}
| j                  t        | j                   |xs ddg t        | j                   j                  t        j                              |	g d|
      }d}t        j                   |dd      rt#        t        j$                  |      S t        j                   |dd      r0t#        t        j&                  |      }t        j(                  ||      t        j                   |dd      r,t        j*                  |      }t        j,                  d||      t        j                   |dd      r,t        j*                  |      }t        j,                  d||      t        j,                  d|      )  Moderations

        :param model: ID of the model to use.
        :param inputs: Text to classify.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        Nr   r   POST/v1/moderationsTF
user-agentapplication/jsonc                  R    t        j                   dddt        j                        S NFjsonr   serialize_request_bodyr   ClassificationRequestrequests   S/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/mistralai/classifiers.py<lambda>z&Classifiers.moderate.<locals>.<lambda>A   #    (D(Dvv/K/K)     methodpathbase_urlurl_variablesr'   request_body_requiredrequest_has_path_paramsrequest_has_query_paramsuser_agent_headeraccept_header_valuer   securityget_serialized_bodyr   429500502503504 moderations_v1_moderations_postconfigr/   operation_idoauth2_scopessecurity_source4224XX5XXhook_ctxr'   error_status_codesretry_config200rF   rG   *API error occurredrH   Unexpected response received)sdk_configurationr   _get_urlr   r%   _build_requestr6   r	   rL   
isinstancer   RetryConfig
do_requestr   r
   Securitymatch_responser   ModerationResponseHTTPValidationErrorDataHTTPValidationErrorstream_to_textSDKErrorselfr   r   r   r   r   r   r/   r0   reqrL   http_resresponse_datahttp_res_textr'   s                 @r(   moderatezClassifiers.moderate   s8   , //::J!!H}}X}=H..

 !!"'"&$)%)* 2%++44! "! " 
& e%%22%?00==gu001#%HIL?? --!R>  5**33V__! 4% # 
 "%1CD*6+D+DhOO%1CD3..M ,,]HEE%5!00:M//"6-PP%5!00:M//"6-PPoo<hGGr+   c                  K   d}d}|| j                   j                  }||}n| j                  ||      }t        j                  ||      | j                  dd||ddddd|| j                   j                  fd	|
      }	|t        k(  r2| j                   j                  t        ur| j                   j                  }d}
t        |t        j                        r|g df}
| j                  t        | j                   |xs ddg t        | j                   j                  t        j                              |	g d|
       d{   }d}t        j                   |dd      rt#        t        j$                  |      S t        j                   |dd      r0t#        t        j&                  |      }t        j(                  ||      t        j                   |dd      r4t        j*                  |       d{   }t        j,                  d||      t        j                   |dd      r4t        j*                  |       d{   }t        j,                  d||      t        j,                  d|      7 +7 7 6w)r   Nr   r   r   TFr   r   c                  R    t        j                   dddt        j                        S r!   r#   r&   s   r(   r)   z,Classifiers.moderate_async.<locals>.<lambda>   r*   r+   r,   r8   r>   r?   r@   rE   rI   rM   rF   rG   rN   rO   rH   rP   )rQ   r   rR   r   r%   _build_request_asyncr6   r	   rL   rT   r   rU   do_request_asyncr   r
   rW   rX   r   rY   rZ   r[   stream_to_text_asyncr]   r^   s                 @r(   moderate_asynczClassifiers.moderate_asynco   s\    , //::J!!H}}X}=H..

 ''"'"&$)%)* 2%++44! "! ( 
& e%%22%?00==gu001#%HIL.. --!R>  5**33V__! 4% / 
 
 "%1CD*6+D+DhOO%1CD3..M ,,]HEE%5"'"<"<X"FFM//"6-PP%5"'"<"<X"FFM//"6-PPoo<hGG=
0 G G8   E I5I.B-I51I12A
I5<I3=2I51I53I5c                   d}d}|| j                   j                  }||}n| j                  ||      }t        j                  t        j                  |t        j                        |      | j                  dd||ddddd|| j                   j                  fd	|
      }	|t        k(  r2| j                   j                  t        ur| j                   j                  }d}
t        |t
        j                        r|g df}
| j                  t        | j                   |xs ddg t!        | j                   j                  t        j"                              |	g d|
      }d}t        j$                  |dd      rt'        t        j(                  |      S t        j$                  |dd      r0t'        t        j*                  |      }t        j,                  ||      t        j$                  |dd      r,t        j.                  |      }t        j0                  d||      t        j$                  |dd      r,t        j.                  |      }t        j0                  d||      t        j0                  d|      )  Chat Moderations

        :param inputs: Chat to classify
        :param model:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        Nr   r   r   /v1/chat/moderationsTFr   r   c                  R    t        j                   dddt        j                        S r!   r   r$   r   ChatModerationRequestr&   s   r(   r)   z+Classifiers.moderate_chat.<locals>.<lambda>  r*   r+   r,   r8   r>   )chat_moderations_v1_chat_moderations_postr@   rE   rI   rM   rF   rG   rN   rO   rH   rP   )rQ   r   rR   r   rr   r   get_pydantic_modelChatModerationRequestInputsrS   r6   r	   rL   rT   rU   rV   r   r
   rW   rX   r   rY   rZ   r[   r\   r]   r_   r   r   r   r   r   r   r/   r0   r`   rL   ra   rb   rc   r'   s                 @r(   moderate_chatzClassifiers.moderate_chat   sK   , //::J!!H}}X}=H..++FF4V4VW

 !!''"&$)%)* 2%++44! "! " 
& e%%22%?00==gu001#%HIL?? --!RH  5**33V__! 4% # 
 "%1CD*6+D+DhOO%1CD3..M ,,]HEE%5!00:M//"6-PP%5!00:M//"6-PPoo<hGGr+   c                2  K   d}d}|| j                   j                  }||}n| j                  ||      }t        j                  t        j                  |t        j                        |      | j                  dd||ddddd|| j                   j                  fd	|
      }	|t        k(  r2| j                   j                  t        ur| j                   j                  }d}
t        |t
        j                        r|g df}
| j                  t        | j                   |xs ddg t!        | j                   j                  t        j"                              |	g d|
       d{   }d}t        j$                  |dd      rt'        t        j(                  |      S t        j$                  |dd      r0t'        t        j*                  |      }t        j,                  ||      t        j$                  |dd      r4t        j.                  |       d{   }t        j0                  d||      t        j$                  |dd      r4t        j.                  |       d{   }t        j0                  d||      t        j0                  d|      7 +7 7 6w)rm   Nrn   r   ro   TFr   r   c                  R    t        j                   dddt        j                        S r!   rq   r&   s   r(   r)   z1Classifiers.moderate_chat_async.<locals>.<lambda>a  r*   r+   r,   r8   r>   rs   r@   rE   rI   rM   rF   rG   rN   rO   rH   rP   )rQ   r   rR   r   rr   r   rt   ru   rg   r6   r	   rL   rT   rU   rh   r   r
   rW   rX   r   rY   rZ   r[   ri   r]   rv   s                 @r(   moderate_chat_asynczClassifiers.moderate_chat_async/  so    , //::J!!H}}X}=H..++FF4V4VW

 ''''"&$)%)* 2%++44! "! ( 
& e%%22%?00==gu001#%HIL.. --!RH  5**33V__! 4% / 
 
 "%1CD*6+D+DhOO%1CD3..M ,,]HEE%5"'"<"<X"FFM//"6-PP%5"'"<"<X"FFM//"6-PPoo<hGG=
0 G G8   E"J%J&B-JJA
JJ2JJJc                   d}d}|| j                   j                  }||}n| j                  ||      }t        j                  ||      | j                  dd||ddddd|| j                   j                  fd	|
      }	|t        k(  r2| j                   j                  t        ur| j                   j                  }d}
t        |t        j                        r|g df}
| j                  t        | j                   |xs ddg t        | j                   j                  t        j                              |	g d|
      }d}t        j                   |dd      rt#        t        j$                  |      S t        j                   |dd      r0t#        t        j&                  |      }t        j(                  ||      t        j                   |dd      r,t        j*                  |      }t        j,                  d||      t        j                   |dd      r,t        j*                  |      }t        j,                  d||      t        j,                  d|      )  Classifications

        :param model: ID of the model to use.
        :param inputs: Text to classify.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        Nr   r   /v1/classificationsTFr   r   c                  R    t        j                   dddt        j                        S r!   r#   r&   s   r(   r)   z&Classifiers.classify.<locals>.<lambda>  r*   r+   r,   r8   r>   'classifications_v1_classifications_postr@   rE   rI   rM   rF   rG   rN   rO   rH   rP   )rQ   r   rR   r   r%   rS   r6   r	   rL   rT   r   rU   rV   r   r
   rW   rX   r   ClassificationResponserZ   r[   r\   r]   r^   s                 @r(   classifyzClassifiers.classify  s8   , //::J!!H}}X}=H..

 !!&'"&$)%)* 2%++44! "! " 
& e%%22%?00==gu001#%HIL?? --!RF  5**33V__! 4% # 
 "%1CD*6+H+H(SS%1CD3..M ,,]HEE%5!00:M//"6-PP%5!00:M//"6-PPoo<hGGr+   c                  K   d}d}|| j                   j                  }||}n| j                  ||      }t        j                  ||      | j                  dd||ddddd|| j                   j                  fd	|
      }	|t        k(  r2| j                   j                  t        ur| j                   j                  }d}
t        |t        j                        r|g df}
| j                  t        | j                   |xs ddg t        | j                   j                  t        j                              |	g d|
       d{   }d}t        j                   |dd      rt#        t        j$                  |      S t        j                   |dd      r0t#        t        j&                  |      }t        j(                  ||      t        j                   |dd      r4t        j*                  |       d{   }t        j,                  d||      t        j                   |dd      r4t        j*                  |       d{   }t        j,                  d||      t        j,                  d|      7 +7 7 6w)r}   Nr   r   r~   TFr   r   c                  R    t        j                   dddt        j                        S r!   r#   r&   s   r(   r)   z,Classifiers.classify_async.<locals>.<lambda>!  r*   r+   r,   r8   r>   r   r@   rE   rI   rM   rF   rG   rN   rO   rH   rP   )rQ   r   rR   r   r%   rg   r6   r	   rL   rT   r   rU   rh   r   r
   rW   rX   r   r   rZ   r[   ri   r]   r^   s                 @r(   classify_asynczClassifiers.classify_async  s\    , //::J!!H}}X}=H..

 ''&'"&$)%)* 2%++44! "! ( 
& e%%22%?00==gu001#%HIL.. --!RF  5**33V__! 4% / 
 
 "%1CD*6+H+H(SS%1CD3..M ,,]HEE%5"'"<"<X"FFM//"6-PP%5"'"<"<X"FFM//"6-PPoo<hGG=
0 G Grk   c                   d}d}|| j                   j                  }||}n| j                  ||      }t        j                  |t        j                  |t        j                              | j                  dd||ddddd|| j                   j                  fd	|
      }	|t        k(  r2| j                   j                  t        ur| j                   j                  }d}
t        |t
        j                        r|g df}
| j                  t        | j                   |xs ddg t!        | j                   j                  t        j"                              |	g d|
      }d}t        j$                  |dd      rt'        t        j(                  |      S t        j$                  |dd      r0t'        t        j*                  |      }t        j,                  ||      t        j$                  |dd      r,t        j.                  |      }t        j0                  d||      t        j$                  |dd      r,t        j.                  |      }t        j0                  d||      t        j0                  d|      )  Chat Classifications

        :param model:
        :param inputs: Chat to classify
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        Nr   r   /v1/chat/classificationsTFr   r   c                  R    t        j                   dddt        j                        S r!   r   r$   r   ChatClassificationRequestr&   s   r(   r)   z+Classifiers.classify_chat.<locals>.<lambda>~  #    (D(Dvv/O/O) r+   r,   r8   r>   1chat_classifications_v1_chat_classifications_postr@   rE   rI   rM   rF   rG   rN   rO   rH   rP   )rQ   r   rR   r   r   r   rt   InputsrS   r6   r	   rL   rT   rU   rV   r   r
   rW   rX   r   r   rZ   r[   r\   r]   r^   s                 @r(   classify_chatzClassifiers.classify_chatO  sI   & //::J!!H}}X}=H22++FFMMB

 !!+'"&$)%)* 2%++44! "! " 
& e%%22%?00==gu001#%HIL?? --!RP  5**33V__! 4% # 
 "%1CD*6+H+H(SS%1CD3..M ,,]HEE%5!00:M//"6-PP%5!00:M//"6-PPoo<hGGr+   c                2  K   d}d}|| j                   j                  }||}n| j                  ||      }t        j                  |t        j                  |t        j                              | j                  dd||ddddd|| j                   j                  fd	|
      }	|t        k(  r2| j                   j                  t        ur| j                   j                  }d}
t        |t
        j                        r|g df}
| j                  t        | j                   |xs ddg t!        | j                   j                  t        j"                              |	g d|
       d{   }d}t        j$                  |dd      rt'        t        j(                  |      S t        j$                  |dd      r0t'        t        j*                  |      }t        j,                  ||      t        j$                  |dd      r4t        j.                  |       d{   }t        j0                  d||      t        j$                  |dd      r4t        j.                  |       d{   }t        j0                  d||      t        j0                  d|      7 +7 7 6w)r   Nr   r   r   TFr   r   c                  R    t        j                   dddt        j                        S r!   r   r&   s   r(   r)   z1Classifiers.classify_chat_async.<locals>.<lambda>  r   r+   r,   r8   r>   r   r@   rE   rI   rM   rF   rG   rN   rO   rH   rP   )rQ   r   rR   r   r   r   rt   r   rg   r6   r	   rL   rT   rU   rh   r   r
   rW   rX   r   r   rZ   r[   ri   r]   r^   s                 @r(   classify_chat_asynczClassifiers.classify_chat_async  sm    & //::J!!H}}X}=H22++FFMMB

 ''+'"&$)%)* 2%++44! "! ( 
& e%%22%?00==gu001#%HIL.. --!RP  5**33V__! 4% / 
 
 "%1CD*6+H+H(SS%1CD3..M ,,]HEE%5"'"<"<X"FFM//"6-PP%5"'"<"<X"FFM//"6-PPoo<hGG=
0 G Gr{   )__name__
__module____qualname____doc__r	   strr   r   ClassificationRequestInputs$ClassificationRequestInputsTypedDictr   r   rU   r   intr   rY   rd   rj   ru   $ChatModerationRequestInputsTypedDictrw   rz   r   r   r   r   InputsTypedDictr   r    r+   r(   r   r      s\    8=$($(48^H ^H ..779
	^H "%"3"34^H SM^H SM^H wsCx01^H 
	"	"^HP 8=$($(48^H ^H ..779
	^H "%"3"34^H SM^H SM^H wsCx01^H 
	"	"^HP 8=$($(48^H ..779
^H ^H "%"3"34^H SM^H SM^H wsCx01^H 
	"	"^HP 8=$($(48^H ..779
^H ^H "%"3"34^H SM^H SM^H wsCx01^H 
	"	"^HP 8=$($(48^H ^H ..779
	^H "%"3"34^H SM^H SM^H wsCx01^H 
	&	&^HP 8=$($(48^H ^H ..779
	^H "%"3"34^H SM^H SM^H wsCx01^H 
	&	&^HJ 8=$($(48[H [H fmmV%;%;;<	[H
 "%"3"34[H SM[H SM[H wsCx01[H 
	&	&[HD 8=$($(48[H [H fmmV%;%;;<	[H
 "%"3"34[H SM[H SM[H wsCx01[H 
	&	&[Hr+   r   N)r   basesdkr   	mistralair   r   mistralai._hooksr   mistralai.typesr   r	   mistralai.utilsr
   'mistralai.utils.unmarshal_json_responser   typingr   r   r   r   r   r   r+   r(   <module>r      s0    G  # ( 3 1 K 0 0{H' {Hr+   