o
    hI                     @  sH  d dl mZ d dlmZmZ d dlmZ d dlZddlm	Z	 ddl
mZmZmZmZmZmZ ddlmZmZmZmZ dd	lmZ dd
lmZmZ ddlmZmZmZmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z' ddl(m)Z) ddgZ*G dd deZ+G dd deZ,G dd dZ-G dd dZ.G dd dZ/G dd dZ0dS )    )annotations)Mappingcast)LiteralN   )file_create_params)	NOT_GIVENBodyQueryHeadersNotGiven	FileTypes)extract_filesmaybe_transformdeepcopy_minimalasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperto_streamed_response_wrapperasync_to_raw_response_wrapper"async_to_streamed_response_wrapper)make_request_options)FileInfoResponse)FileListResponse)FileCreateResponse)FileDeleteResponseFiles
AsyncFilesc                   @     e Zd Zed&ddZed'ddZddded	d(ddZddded	d)ddZddded	d*dd Z	ddded	d+d!d"Z
ddded	d,d$d%ZdS )-r   returnFilesWithRawResponsec                 C     t | S a  
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/groq/groq-python#accessing-raw-response-data-eg-headers
        )r"   self r'   h/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/groq/resources/files.pywith_raw_response$      zFiles.with_raw_responseFilesWithStreamingResponsec                 C  r#   z
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/groq/groq-python#with_streaming_response
        )r+   r%   r'   r'   r(   with_streaming_response.      zFiles.with_streaming_responseNextra_headersextra_query
extra_bodytimeoutfiler   purposeLiteral['batch']r0   Headers | Noner1   Query | Noner2   Body | Noner3   'float | httpx.Timeout | None | NotGivenr   c          	   
   C  sd   t ||d}tttttf |dggd}ddi|pi }| jdt|tj	|t
||||dtdS )	  
        Upload a file that can be used across various endpoints.

        The Batch API only supports `.jsonl` files up to 100 MB in size. The input also
        has a specific required [format](/docs/batch).

        Please contact us if you need to increase these storage limits.

        Args:
          file: The File object (not file name) to be uploaded.

          purpose: The intended purpose of the uploaded file. Use "batch" for
              [Batch API](/docs/api-reference#batches).

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        r4   r5   r4   pathsContent-Typemultipart/form-data/openai/v1/filesr/   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   FileCreateParamsr   r   	r&   r4   r5   r0   r1   r2   r3   rC   rD   r'   r'   r(   create7   s    "
zFiles.creater   c                C  s   | j dt||||dtdS )Returns a list of files.rA   r/   rE   rF   _getr   r   r&   r0   r1   r2   r3   r'   r'   r(   listn   s   z
Files.listfile_idrG   r   c                C  4   |s	t d|| jd| t||||dtdS )B  
        Delete a file.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        6Expected a non-empty value for `file_id` but received /openai/v1/files/r/   rN   
ValueError_deleter   r   r&   rS   r0   r1   r2   r3   r'   r'   r(   delete      zFiles.deletec                C  s6   |s	t d|| jd| dt||||dtdS )_  
        Returns the contents of the specified file.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        rV   rW   /contentr/   rN   rY   rP   r   rG   r[   r'   r'   r(   content   s   
zFiles.contentr   c                C  rT   )U  
        Returns information about a file.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        rV   rW   r/   rN   rY   rP   r   r   r[   r'   r'   r(   info   r]   z
Files.info)r!   r"   )r!   r+   r4   r   r5   r6   r0   r7   r1   r8   r2   r9   r3   r:   r!   r   
r0   r7   r1   r8   r2   r9   r3   r:   r!   r   rS   rG   r0   r7   r1   r8   r2   r9   r3   r:   r!   r   rS   rG   r0   r7   r1   r8   r2   r9   r3   r:   r!   rG   rS   rG   r0   r7   r1   r8   r2   r9   r3   r:   r!   r   __name__
__module____qualname__r   r)   r-   r   rL   rR   r\   ra   rd   r'   r'   r'   r(   r   #   <    	<''c                   @  r    )-r   r!   AsyncFilesWithRawResponsec                 C  r#   r$   )ro   r%   r'   r'   r(   r)      r*   zAsyncFiles.with_raw_responseAsyncFilesWithStreamingResponsec                 C  r#   r,   )rp   r%   r'   r'   r(   r-      r.   z"AsyncFiles.with_streaming_responseNr/   r4   r   r5   r6   r0   r7   r1   r8   r2   r9   r3   r:   r   c          	   
     sr   t ||d}tttttf |dggd}ddi|pi }| jdt|tj	I dH |t
||||dtd	I dH S )
r;   r<   r4   r=   r?   r@   rA   Nr/   rB   )r   r   r   r   rG   rH   rI   r   r   rJ   r   r   rK   r'   r'   r(   rL      s"   "zAsyncFiles.creater   c                  s$   | j dt||||dtdI dH S )rM   rA   r/   rN   NrO   rQ   r'   r'   r(   rR   0  s   zAsyncFiles.listrS   rG   r   c                  <   |s
t d|| jd| t||||dtdI dH S )rU   rV   rW   r/   rN   NrX   r[   r'   r'   r(   r\   C     zAsyncFiles.deletec                  s>   |s
t d|| jd| dt||||dtdI dH S )r^   rV   rW   r_   r/   rN   Nr`   r[   r'   r'   r(   ra   d  s   
zAsyncFiles.contentr   c                  rq   )rb   rV   rW   r/   rN   Nrc   r[   r'   r'   r(   rd     rr   zAsyncFiles.info)r!   ro   )r!   rp   re   rf   rg   rh   ri   rj   r'   r'   r'   r(   r      rn   c                   @     e Zd ZdddZdS )	r"   rD   r   r!   Nonec                 C  F   || _ t|j| _t|j| _t|j| _t|j| _t|j| _d S N)_filesr   rL   rR   r\   ra   rd   r&   rD   r'   r'   r(   __init__      
zFilesWithRawResponse.__init__NrD   r   r!   rt   rk   rl   rm   ry   r'   r'   r'   r(   r"         r"   c                   @  rs   )	ro   rD   r   r!   rt   c                 C  ru   rv   )rw   r   rL   rR   r\   ra   rd   rx   r'   r'   r(   ry     rz   z"AsyncFilesWithRawResponse.__init__NrD   r   r!   rt   r|   r'   r'   r'   r(   ro     r}   ro   c                   @  rs   )	r+   rD   r   r!   rt   c                 C  ru   rv   )rw   r   rL   rR   r\   ra   rd   rx   r'   r'   r(   ry     rz   z#FilesWithStreamingResponse.__init__Nr{   r|   r'   r'   r'   r(   r+     r}   r+   c                   @  rs   )	rp   rD   r   r!   rt   c                 C  ru   rv   )rw   r   rL   rR   r\   ra   rd   rx   r'   r'   r(   ry     rz   z(AsyncFilesWithStreamingResponse.__init__Nr~   r|   r'   r'   r'   r(   rp     r}   rp   )1
__future__r   typingr   r   typing_extensionsr   httpxtypesr   _typesr   r	   r
   r   r   r   _utilsr   r   r   r   _compatr   	_resourcer   r   	_responser   r   r   r   _base_clientr   types.file_info_responser   types.file_list_responser   types.file_create_responser   types.file_delete_responser   __all__r   r   r"   ro   r+   rp   r'   r'   r'   r(   <module>   s0     C C