
    i.                     v    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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)AnyListMappingOptionalUnionc                      e 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
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
ej(                     fdZy)OcrN)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 | j                   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        j0                  |      t        j$                  |dd      r7t        j2                  |      }t        j4                  d|j6                  ||      t        j$                  |dd      r7t        j2                  |      }t        j4                  d|j6                  ||      |j8                  j;                  d      }t        j2                  |      }t        j4                  d|j6                   d| d|j6                  ||      )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/ocrTF
user-agentapplication/jsonc                  R    t        j                   dddt        j                        S NFjsonr   serialize_request_bodyr   
OCRRequestrequests   Q/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/mistralai_azure/ocr.py<lambda>zOcr.process.<locals>.<lambda>W   #    (D(Dvv/@/@)     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 ocr_v1_ocr_postconfigr6   operation_idoauth2_scopessecurity_source4224XX5XXhook_ctxr.   error_status_codesretry_config200rM   datarN   *API error occurredrO   Content-Type$Unexpected response received (code: , type: ))sdk_configurationr   _get_urlr   r,   r   get_pydantic_modelDocumentr	   ResponseFormat_build_requestr=   r
   rS   
isinstanceRetryConfig
do_requestr   match_responseunmarshal_jsontextr   OCRResponseHTTPValidationErrorDataHTTPValidationErrorstream_to_textSDKErrorstatus_codeheadersgetselfr   r   r   r   r   r   r   r   r   r   r   r   r   r6   r7   reqrS   http_resresponse_datahttp_res_textcontent_typer.   s                         @r/   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.  $ 6 6 ? ? 4% # 
 "%1CD''x@R@R7STT%1CD!00v==M ,,-@@%5!00:M//$h&:&:M8  %5!00:M//$h&:&:M8   ''++N;,,X6oo283G3G2HQ]P^^_`  	
 	
r2   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 | j                   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        j0                  |      t        j$                  |dd      r?t        j2                  |       d{   }t        j4                  d|j6                  ||      t        j$                  |dd      r?t        j2                  |       d{   }t        j4                  d|j6                  ||      |j8                  j;                  d      }t        j2                  |       d{   }t        j4                  d|j6                   d| d|j6                  ||      7 7 7 7 >w)r!   Nr"   r#   r$   TFr%   r&   c                  R    t        j                   dddt        j                        S r(   r*   r-   s   r/   r0   z#Ocr.process_async.<locals>.<lambda>   r1   r2   r3   r?   rE   rF   rG   rL   rP   rT   rM   rU   rN   rW   rX   rO   rY   rZ   r[   r\   )r]   r   r^   r   r,   r   r_   r`   r	   ra   _build_request_asyncr=   r
   rS   rc   rd   do_request_asyncr   rf   rg   rh   r   ri   rj   rk   stream_to_text_asyncrm   rn   ro   rp   rq   s                         @r/   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.  $ 6 6 ? ? 4% / 
 
 "%1CD''x@R@R7STT%1CD!00v==M ,,-@@%5"'"<"<X"FFM//$h&:&:M8  %5"'"<"<X"FFM//$h&:&:M8   ''++N;#88BBoo283G3G2HQ]P^^_`  	
 	
E
, G
 G CsK   F#M4&M+'CM4M.AM4M0AM43M248M4.M40M42M4)__name__
__module____qualname__r
   r   strr   r   r`   DocumentTypedDictr   r	   r   intboolra   ResponseFormatTypedDictr   rd   r   ri   rx   r~    r2   r/   r   r   
   s    !-27<-205  7<$($(48'A
 }A
 )A)AAB	A

 SMA
  S	*A
 /t4A
 &c*A
 )-A
 !1&'')G)GGH!
A
 %5&'')G)GGH%
A
  "%"3"34!A
" SM#A
$ SM%A
& wsCx01'A
( 
&$$	%)A
P !-27<-205  7<$($(48'A
 }A
 )A)AAB	A

 SMA
  S	*A
 /t4A
 &c*A
 )-A
 !1&'')G)GGH!
A
 %5&'')G)GGH%
A
  "%"3"34!A
" SM#A
$ SM%A
& wsCx01'A
( 
&$$	%)A
r2   r   N)__doc__basesdkr   mistralai_azurer   r   mistralai_azure._hooksr   mistralai_azure.typesr   r	   r
   typingr   r   r   r   r   r   r   r2   r/   <module>r      s+    G  ) . C C 6 6E
' E
r2   