o
    ?0mhK                     @  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m Z m!Z!m"Z"m#Z#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l0m1Z1 ddgZ2G dd deZ3G dd deZ4G dd dZ5G dd dZ6G dd dZ7G dd dZ8d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)BinaryAPIResponseAsyncBinaryAPIResponseStreamedBinaryAPIResponseAsyncStreamedBinaryAPIResponseto_raw_response_wrapperto_streamed_response_wrapperasync_to_raw_response_wrapperto_custom_raw_response_wrapper"async_to_streamed_response_wrapper#to_custom_streamed_response_wrapper$async_to_custom_raw_response_wrapper)async_to_custom_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/   b/var/www/html/tas-one-backend/ai_backend/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
        )r3   r-   r/   r/   r0   with_streaming_response1      zFiles.with_streaming_responseNextra_headersextra_query
extra_bodytimeoutfiler   purposeLiteral['batch']r8   Headers | Noner9   Query | Noner:   Body | Noner;   '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
        r<   r=   r<   pathsContent-Typemultipart/form-data/openai/v1/filesr7   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   FileCreateParamsr!   r$   	r.   r<   r=   r8   r9   r:   r;   rK   rL   r/   r/   r0   create:   s    "
zFiles.creater#   c                C  s   | j dt||||dtdS )Returns a list of files.rI   r7   rM   rN   _getr!   r#   r.   r8   r9   r:   r;   r/   r/   r0   listq   s   z
Files.listfile_idrO   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/r7   rV   
ValueError_deleter!   r%   r.   r[   r8   r9   r:   r;   r/   r/   r0   delete      zFiles.deleter   c                C  sF   |s	t d|ddi|pi }| 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
        r^   Acceptapplication/octet-streamr_   /contentr7   rV   )ra   rX   r!   r   rc   r/   r/   r0   content   s   
zFiles.contentr"   c                C  r\   )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
        r^   r_   r7   rV   ra   rX   r!   r"   rc   r/   r/   r0   info   re   z
Files.info)r)   r*   )r)   r3   r<   r   r=   r>   r8   r?   r9   r@   r:   rA   r;   rB   r)   r$   
r8   r?   r9   r@   r:   rA   r;   rB   r)   r#   r[   rO   r8   r?   r9   r@   r:   rA   r;   rB   r)   r%   )r[   rO   r8   r?   r9   r@   r:   rA   r;   rB   r)   r   r[   rO   r8   r?   r9   r@   r:   rA   r;   rB   r)   r"   __name__
__module____qualname__r   r1   r5   r   rT   rZ   rd   rj   rm   r/   r/   r/   r0   r&   &   <    	<'(c                   @  r(   ).r'   r)   AsyncFilesWithRawResponsec                 C  r+   r,   )rw   r-   r/   r/   r0   r1      r2   zAsyncFiles.with_raw_responseAsyncFilesWithStreamingResponsec                 C  r+   r4   )rx   r-   r/   r/   r0   r5      r6   z"AsyncFiles.with_streaming_responseNr7   r<   r   r=   r>   r8   r?   r9   r@   r:   rA   r;   rB   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 )
rC   rD   r<   rE   rG   rH   rI   Nr7   rJ   )r   r   r   r   rO   rP   rQ   r   r   rR   r!   r$   rS   r/   r/   r0   rT      s"   "zAsyncFiles.creater#   c                  s$   | j dt||||dtdI dH S )rU   rI   r7   rV   NrW   rY   r/   r/   r0   rZ   4  s   zAsyncFiles.listr[   rO   r%   c                  <   |s
t d|| jd| t||||dtdI dH S )r]   r^   r_   r7   rV   Nr`   rc   r/   r/   r0   rd   G     zAsyncFiles.deleter   c                  sN   |s
t d|ddi|pi }| jd| dt||||dtdI dH S )	rf   r^   rg   rh   r_   ri   r7   rV   N)ra   rX   r!   r   rc   r/   r/   r0   rj   h  s   
zAsyncFiles.contentr"   c                  ry   )rk   r^   r_   r7   rV   Nrl   rc   r/   r/   r0   rm     rz   zAsyncFiles.info)r)   rw   )r)   rx   rn   ro   rp   )r[   rO   r8   r?   r9   r@   r:   rA   r;   rB   r)   r   rq   rr   r/   r/   r/   r0   r'      rv   c                   @     e Zd ZdddZdS )	r*   rL   r&   r)   Nonec                 C  H   || _ t|j| _t|j| _t|j| _t|jt| _t|j| _d S N)	_filesr   rT   rZ   rd   r   rj   r   rm   r.   rL   r/   r/   r0   __init__  "   
zFilesWithRawResponse.__init__NrL   r&   r)   r|   rs   rt   ru   r   r/   r/   r/   r0   r*         r*   c                   @  r{   )	rw   rL   r'   r)   r|   c                 C  r}   r~   )	r   r   rT   rZ   rd   r   rj   r   rm   r   r/   r/   r0   r     r   z"AsyncFilesWithRawResponse.__init__NrL   r'   r)   r|   r   r/   r/   r/   r0   rw     r   rw   c                   @  r{   )	r3   rL   r&   r)   r|   c                 C  r}   r~   )	r   r   rT   rZ   rd   r   rj   r   rm   r   r/   r/   r0   r     r   z#FilesWithStreamingResponse.__init__Nr   r   r/   r/   r/   r0   r3     r   r3   c                   @  r{   )	rx   rL   r'   r)   r|   c                 C  r}   r~   )	r   r   rT   rZ   rd   r    rj   r   rm   r   r/   r/   r0   r     r   z(AsyncFilesWithStreamingResponse.__init__Nr   r   r/   r/   r/   r0   rx     r   rx   )9
__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   r   r   r   r   r   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*   rw   r3   rx   r/   r/   r/   r0   <module>   s0    8 D D