o
    i.                     @   sp   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	 d	eZd
S )zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.   )BaseSDK    )modelsutils)HookContext)NullableOptionalNullableUNSET)AnyListMappingOptionalUnionc                   @   s  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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dZdS )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                   s  d}d}|du r| j j}|dur|}n| ||}tj||t|tj||||t|ttj	 t|	ttj	 d	 | j
dd|| ddddd|| j j fd	d
|d}|
tkra| j jtura| j j}
d}t|
tjro|
g df}| jt| j |pwddg | j jd|g d|d}d}t|ddrt|jttj S t|ddrt|jtj}tj|dt|ddrt|}td|j||t|ddrt|}td|j|||jd}t|}td|j d| d|j||)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                         t  dddtjS NFjsonr   serialize_request_bodyr   
OCRRequest requestr*   Y/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/mistralai_azure/ocr.py<lambda>W       zOcr.process.<locals>.<lambda>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configr3   operation_idoauth2_scopessecurity_source4224XX5XXhook_ctxr,   error_status_codesretry_config200rJ   datarK   *API error occurredrL   Content-Type$Unexpected response received (code: , type: ))sdk_configurationr   _get_urlr   r)   r   get_pydantic_modelDocumentr   ResponseFormat_build_requestr:   r	   rP   
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   r3   r4   reqrP   http_resresponse_datahttp_res_textcontent_typer*   r+   r-   process   s   %







zOcr.processc                   s  d}d}|du r| j j}|dur|}n| ||}tj||t|tj||||t|ttj	 t|	ttj	 d	 | j
dd|| ddddd|| j j fd	d
|d}|
tkrb| j jturb| j j}
d}t|
tjrp|
g df}| jt| j |pxddg | j jd|g d|dI dH }d}t|ddrt|jttj S t|ddrt|jtj}tj|dt|ddrt|I dH }td|j||t|ddrt|I dH }td|j|||jd}t|I dH }td|j d| d|j||)r   Nr   r    r!   TFr"   r#   c                      r$   r%   r'   r*   r+   r*   r-   r.      r/   z#Ocr.process_async.<locals>.<lambda>r0   r<   rB   rC   rD   rI   rM   rQ   rJ   rR   rK   rT   rU   rL   rV   rW   rX   rY   )rZ   r   r[   r   r)   r   r\   r]   r   r^   _build_request_asyncr:   r	   rP   r`   ra   do_request_asyncr   rc   rd   re   r   rf   rg   rh   stream_to_text_asyncrj   rk   rl   rm   rn   r*   r+   r-   process_async   s   %




zOcr.process_async)__name__
__module____qualname__r	   r   strr   r   r]   DocumentTypedDictr   r   r   intboolr^   ResponseFormatTypedDictr   ra   r   rf   ru   ry   r*   r*   r*   r-   r   
   s    
	

 	
	
r   N)__doc__basesdkr   mistralai_azurer   r   mistralai_azure._hooksr   mistralai_azure.typesr   r   r	   typingr
   r   r   r   r   r   r*   r*   r*   r-   <module>   s    