
    i,                         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 dd	lmZ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)unmarshal_json_response)AnyListMappingOptionalUnionc                      e Zd ZdZdeeeeeeedddddee   deej                  ej                  f   dee   deee      dee   d	ee   d
ee   deeej                   ej"                  f      de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deeeeeeedddddee   deej                  ej                  f   dee   deee      dee   d	ee   d
ee   deeej                   ej"                  f      de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y)OcrzOCR APIN)idpagesinclude_image_base64image_limitimage_min_sizebbox_annotation_formatdocument_annotation_formatretries
server_url
timeout_mshttp_headersmodeldocumentr   r   r   r   r   r   r   r   r   r   r   returnc                   d}d}|| j                   j                  }||}n| j                  ||      }t        j                  ||t        j                  |t        j                        ||||t        j                  |t        t        j                           t        j                  |	t        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        j0                  ||      t        j(                  |dd      r,t        j2                  |      }t        j4                  d||      t        j(                  |dd      r,t        j2                  |      }t        j4                  d||      t        j4                  d|      )o  OCR

        :param model:
        :param document: Document to run OCR on
        :param id:
        :param pages: Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0
        :param include_image_base64: Include image URLs in response
        :param image_limit: Max images to extract
        :param image_min_size: Minimum height and width of image to extract
        :param bbox_annotation_format: Structured output class for extracting useful information from each extracted bounding box / image from document. Only json_schema is valid for this field
        :param document_annotation_format: Structured output class for extracting useful information from the entire document. Only json_schema is valid for this field
        :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    r   r   r   r   r   r   POST/v1/ocrTF
user-agentapplication/jsonc                  R    t        j                   dddt        j                        S NFjsonr   serialize_request_bodyr   
OCRRequestrequests   K/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/mistralai/ocr.py<lambda>zOcr.process.<locals>.<lambda>[   #    (D(Dvv/@/@)     methodpathbase_urlurl_variablesr0   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 ocr_v1_ocr_postconfigr8   operation_idoauth2_scopessecurity_source4224XX5XXhook_ctxr0   error_status_codesretry_config200rO   rP   *API error occurredrQ   Unexpected response received)sdk_configurationr   _get_urlr   r.   r   get_pydantic_modelDocumentr	   ResponseFormat_build_requestr?   r
   rU   
isinstanceRetryConfig
do_requestr   r   Securitymatch_responser   OCRResponseHTTPValidationErrorDataHTTPValidationErrorstream_to_textSDKErrorselfr   r    r   r   r   r   r   r   r   r   r   r   r   r8   r9   reqrU   http_resresponse_datahttp_res_textr0   s                        @r1   processzOcr.process   s   J //::J!!H}}X}=H##--hH!5#)#(#;#;&(89N9N(O$ (-'?'?*,<V=R=R,S(
  !!'"&$)%)* 2%++44! "! " 
& e%%22%?00==gu001#%HIL?? --!R.  5**33V__! 4% # 
 "%1CD*6+=+=xHH%1CD3..M ,,]HEE%5!00:M//"6-PP%5!00:M//"6-PPoo<hGGr4   c                  K   d}d}|| j                   j                  }||}n| j                  ||      }t        j                  ||t        j                  |t        j                        ||||t        j                  |t        t        j                           t        j                  |	t        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        j0                  ||      t        j(                  |dd      r4t        j2                  |       d{   }t        j4                  d||      t        j(                  |dd      r4t        j2                  |       d{   }t        j4                  d||      t        j4                  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   r1   r2   z#Ocr.process_async.<locals>.<lambda>   r3   r4   r5   rA   rG   rH   rI   rN   rR   rV   rO   rP   rW   rX   rQ   rY   )rZ   r   r[   r   r.   r   r\   r]   r	   r^   _build_request_asyncr?   r
   rU   r`   ra   do_request_asyncr   r   rc   rd   r   re   rf   rg   stream_to_text_asyncri   rj   s                        @r1   process_asynczOcr.process_async   s    J //::J!!H}}X}=H##--hH!5#)#(#;#;&(89N9N(O$ (-'?'?*,<V=R=R,S(
  '''"&$)%)* 2%++44! "! ( 
& e%%22%?00==gu001#%HIL.. --!R.  5**33V__! 4% / 
 
 "%1CD*6+=+=xHH%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s8   F;K0>K)?B-K0,K,-A
K07K.82K0,K0.K0)__name__
__module____qualname____doc__r
   r   strr   r   r]   DocumentTypedDictr   r	   r   intboolr^   ResponseFormatTypedDictr   ra   r   re   rp   rv    r4   r1   r   r      s    !-27<-205  7<$($(48'xH }xH )A)AAB	xH
 SMxH  S	*xH /t4xH &c*xH )-xH !1&'')G)GGH!
xH %5&'')G)GGH%
xH  "%"3"34!xH" SM#xH$ SM%xH& wsCx01'xH( 
		)xH~ !-27<-205  7<$($(48'xH }xH )A)AAB	xH
 SMxH  S	*xH /t4xH &c*xH )-xH !1&'')G)GGH!
xH %5&'')G)GGH%
xH  "%"3"34!xH" SM#xH$ SM%xH& wsCx01'xH( 
		)xHr4   r   N)rz   basesdkr   	mistralair   r   mistralai._hooksr   mistralai.typesr   r	   r
   mistralai.utilsr   'mistralai.utils.unmarshal_json_responser   typingr   r   r   r   r   r   r   r4   r1   <module>r      s3    G  # ( = = 1 K 6 6uH' uHr4   