
    g=                     ~    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
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)NullableOptionalNullableUNSET)get_security_from_env)AnyMappingOptionalUnionc                      e Zd ZdZeedddddeej                  ej                  f   de	e
   de	ej                     dee
   dee   d	eee
e
f      d
eej                      fdZeedddddeej                  ej                  f   de	e
   de	ej                     dee
   dee   d	eee
e
f      d
eej                      fdZedddddeej&                  ej(                  f   dee
   de	ej                     dee
   dee   d	eee
e
f      d
eej                      fdZedddddeej&                  ej(                  f   dee
   de	ej                     dee
   dee   d	eee
e
f      d
eej                      fdZy)ClassifierszClassifiers API.N)modelretries
server_url
timeout_mshttp_headersinputsr   r   r   r   r   returnc                   d}d}|| j                   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        dg t        | j                   j
                  t        j                              |	g d|
      }d}t        j                  |dd      r5t        j                   |j"                  t$        t        j&                           S t        j                  |dd      rDt        j                   |j"                  t        j(                        }t        j*                  |      t        j                  |ddgd      r7t        j,                  |      }t        j.                  d|j0                  ||      |j2                  j5                  d      }t        j,                  |      }t        j.                  d|j0                   d| d|j0                  ||      )  Moderations

        :param inputs: Text 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   POST/v1/moderationsTF
user-agentapplication/jsonc                  R    t        j                   dddt        j                        S NFjsonr   serialize_request_bodyr   ClassificationRequestrequests   J/var/www/openai/venv/lib/python3.12/site-packages/mistralai/classifiers.py<lambda>z&Classifiers.moderate.<locals>.<lambda>>   !    (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operation_idoauth2_scopessecurity_source4224XX5XXhook_ctxr'   error_status_codesretry_config200rD   datarE   rF   *API error occurredContent-Type$Unexpected response received (code: , type: ))sdk_configurationr   r   r%   _build_requestr6   r
   rJ   
isinstancer   RetryConfig
do_requestr   r   Securitymatch_responseunmarshal_jsontextr   ClassificationResponseHTTPValidationErrorDataHTTPValidationErrorstream_to_textSDKErrorstatus_codeheadersgetselfr   r   r   r   r   r   r/   r0   reqrJ   http_resrM   http_res_textcontent_typer'   s                  @r(   moderatezClassifiers.moderate   s]   , //::J!!H..

 !!"'"&$)%)* 2%++44! "! " 
& e%%22%?00==gu001#%HIL?? >  5**33V__! 4% # 
 %1CD''x(E(EF  %1CD''v7U7UVD,,$775%.#>!00:M//$h&:&:M8   ''++N;,,X6oo283G3G2HQ]P^^_`  	
 	
r+   c                4  K   d}d}|| j                   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        dg t        | j                   j
                  t        j                              |	g d|
       d{   }d}t        j                  |dd      r5t        j                   |j"                  t$        t        j&                           S t        j                  |dd      rDt        j                   |j"                  t        j(                        }t        j*                  |      t        j                  |ddgd      r?t        j,                  |       d{   }t        j.                  d|j0                  ||      |j2                  j5                  d      }t        j,                  |       d{   }t        j.                  d|j0                   d| d|j0                  ||      7 q7 7 <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?   rC   rG   rK   rD   rL   rE   rF   rN   rO   rP   rQ   rR   rS   )rT   r   r   r%   _build_request_asyncr6   r
   rJ   rV   r   rW   do_request_asyncr   r   rY   rZ   r[   r\   r   r]   r^   r_   stream_to_text_asyncra   rb   rc   rd   re   s                  @r(   moderate_asynczClassifiers.moderate_asyncp   s    , //::J!!H..

 ''"'"&$)%)* 2%++44! "! ( 
& e%%22%?00==gu001#%HIL.. >  5**33V__! 4% / 
 
 %1CD''x(E(EF  %1CD''v7U7UVD,,$775%.#>"'"<"<X"FFM//$h&:&:M8   ''++N;#88BBoo283G3G2HQ]P^^_`  	
 	
;
, G Cs8   DJ J!CJ?J AJJ8JJJ)r   r   r   r   c                2   d}d}|| j                   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        dg t        | j                   j                  t        j                               |	g d|
      }d}t	        j"                  |dd      r5t	        j$                  |j&                  t(        t        j*                           S t	        j"                  |dd      rDt	        j$                  |j&                  t        j,                        }t        j.                  |      t	        j"                  |ddgd      r7t	        j0                  |      }t        j2                  d|j4                  ||      |j6                  j9                  d      }t	        j0                  |      }t        j2                  d|j4                   d| d|j4                  ||      )  Moderations Chat

        :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.
        Nr   r   /v1/chat/moderationsTFr   r   c                  R    t        j                   dddt        j                        S r!   r   r$   r   ChatClassificationRequestr&   s   r(   r)   z+Classifiers.moderate_chat.<locals>.<lambda>  !    (D(Dvv/O/O)r+   r,   r8   )moderations_chat_v1_chat_moderations_postr?   rC   rG   rK   rD   rL   rE   rF   rN   rO   rP   rQ   rR   rS   )rT   r   r   rw   r   get_pydantic_modelChatClassificationRequestInputsrU   r6   r
   rJ   rV   rW   rX   r   r   rY   rZ   r[   r\   r   r]   r^   r_   r`   ra   rb   rc   rd   re   s                  @r(   moderate_chatzClassifiers.moderate_chat   su   , //::J!!H22++>> 	
 !!''"&$)%)* 2%++44! "! " 
& e%%22%?00==gu001#%HIL?? H  5**33V__! 4% # 
 %1CD''x(E(EF  %1CD''v7U7UVD,,$775%.#>!00:M//$h&:&:M8   ''++N;,,X6oo283G3G2HQ]P^^_`  	
 	
r+   c                x  K   d}d}|| j                   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        dg t        | j                   j                  t        j                               |	g d|
       d{   }d}t	        j"                  |dd      r5t	        j$                  |j&                  t(        t        j*                           S t	        j"                  |dd      rDt	        j$                  |j&                  t        j,                        }t        j.                  |      t	        j"                  |ddgd      r?t	        j0                  |       d{   }t        j2                  d|j4                  ||      |j6                  j9                  d      }t	        j0                  |       d{   }t        j2                  d|j4                   d| d|j4                  ||      7 q7 7 <w)rs   Nr   r   rt   TFr   r   c                  R    t        j                   dddt        j                        S r!   rv   r&   s   r(   r)   z1Classifiers.moderate_chat_async.<locals>.<lambda>h  rx   r+   r,   r8   ry   r?   rC   rG   rK   rD   rL   rE   rF   rN   rO   rP   rQ   rR   rS   )rT   r   r   rw   r   rz   r{   rn   r6   r
   rJ   rV   rW   ro   r   r   rY   rZ   r[   r\   r   r]   r^   r_   rp   ra   rb   rc   rd   re   s                  @r(   moderate_chat_asynczClassifiers.moderate_chat_async6  s    , //::J!!H22++>> 	
 ''''"&$)%)* 2%++44! "! ( 
& e%%22%?00==gu001#%HIL.. H  5**33V__! 4% / 
 
 %1CD''x(E(EF  %1CD''v7U7UVD,,$775%.#>"'"<"<X"FFM//$h&:&:M8   ''++N;#88BBoo283G3G2HQ]P^^_`  	
 	
;
, G Cs8   D?J:J3CJ:!J6"AJ:;J8<8J:6J:8J:)__name__
__module____qualname____doc__r
   r   r   ClassificationRequestInputs$ClassificationRequestInputsTypedDictr	   strr   rW   r   intr   r]   rk   rq   r{   (ChatClassificationRequestInputsTypedDictr   r|   r    r+   r(   r   r      s    (-7<$($(48`
 ..779
`
  $`
 "%"3"34`
 SM`
 SM`
 wsCx01`
 
&//	0`
R (-7<$($(48`
 ..779
`
  $`
 "%"3"34`
 SM`
 SM`
 wsCx01`
 
&//	0`
T 8=$($(48b
 22;;=
b
 }b
 "%"3"34b
 SMb
 SMb
 wsCx01b
 
&//	0b
X 8=$($(48b
 22;;=
b
 }b
 "%"3"34b
 SMb
 SMb
 wsCx01b
 
&//	0b
r+   r   N)r   basesdkr   	mistralair   r   mistralai._hooksr   mistralai.typesr   r	   r
   mistralai.utilsr   typingr   r   r   r   r   r   r+   r(   <module>r      s.    G  # ( = = 1 0 0M
' M
r+   