o
    iL                     @  sl  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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/m0Z0 ddl1m2Z2 ddgZ3G dd deZ4G dd deZ5G dd dZ6G dd dZ7G dd dZ8G dd dZ9dS )    )annotations)Mappingcast)LiteralN   )file_create_params)BodyQueryHeadersNotGiven	FileTypes	not_given)extract_filespath_template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 r0   N/home/kim/smarthome/.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
        )r4   r.   r0   r0   r1   with_streaming_response1      zFiles.with_streaming_responseNextra_headersextra_query
extra_bodytimeoutfiler   purposeLiteral['batch']r9   Headers | Noner:   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/filesr8   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   FileCreateParamsr"   r%   	r/   r=   r>   r9   r:   r;   r<   rL   rM   r0   r0   r1   create:   s    "
zFiles.creater$   c                C  s   | j dt||||dtdS )Returns a list of files.rJ   r8   rN   rO   _getr"   r$   r/   r9   r:   r;   r<   r0   r0   r1   listq   s   z
Files.listfile_idrP   r&   c                C  6   |s	t d|| jtd|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/{file_id}r\   r8   rW   
ValueError_deleter   r"   r&   r/   r\   r9   r:   r;   r<   r0   r0   r1   delete      
zFiles.deleter   c                C  sF   |s	t d|ddi|pi }| jt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-stream"/openai/v1/files/{file_id}/contentra   r8   rW   )rc   rY   r   r"   r   re   r0   r0   r1   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`   ra   r8   rW   rc   rY   r   r"   r#   re   r0   r0   r1   info   rg   z
Files.info)r*   r+   )r*   r4   r=   r   r>   r?   r9   r@   r:   rA   r;   rB   r<   rC   r*   r%   
r9   r@   r:   rA   r;   rB   r<   rC   r*   r$   r\   rP   r9   r@   r:   rA   r;   rB   r<   rC   r*   r&   )r\   rP   r9   r@   r:   rA   r;   rB   r<   rC   r*   r   r\   rP   r9   r@   r:   rA   r;   rB   r<   rC   r*   r#   __name__
__module____qualname__r   r2   r6   r   rU   r[   rf   rl   ro   r0   r0   r0   r1   r'   &   <    	<'(c                   @  r)   ).r(   r*   AsyncFilesWithRawResponsec                 C  r,   r-   )ry   r.   r0   r0   r1   r2      r3   zAsyncFiles.with_raw_responseAsyncFilesWithStreamingResponsec                 C  r,   r5   )rz   r.   r0   r0   r1   r6      r7   z"AsyncFiles.with_streaming_responseNr8   r=   r   r>   r?   r9   r@   r:   rA   r;   rB   r<   rC   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 )
rD   rE   r=   rF   rH   rI   rJ   Nr8   rK   )r   r   r   r   rP   rQ   rR   r   r   rS   r"   r%   rT   r0   r0   r1   rU      s"   "zAsyncFiles.creater$   c                  s$   | j dt||||dtdI dH S )rV   rJ   r8   rW   NrX   rZ   r0   r0   r1   r[   4  s   zAsyncFiles.listr\   rP   r&   c                  >   |s
t d|| jtd|dt||||dtdI dH S )r^   r_   r`   ra   r8   rW   Nrb   re   r0   r0   r1   rf   G     
zAsyncFiles.deleter   c                  sN   |s
t d|ddi|pi }| jtd|dt||||dtdI dH S )	rh   r_   ri   rj   rk   ra   r8   rW   N)rc   rY   r   r"   r   re   r0   r0   r1   rl   h  s   
zAsyncFiles.contentr#   c                  r{   )rm   r_   r`   ra   r8   rW   Nrn   re   r0   r0   r1   ro     r|   zAsyncFiles.info)r*   ry   )r*   rz   rp   rq   rr   )r\   rP   r9   r@   r:   rA   r;   rB   r<   rC   r*   r   rs   rt   r0   r0   r0   r1   r(      rx   c                   @     e Zd ZdddZdS )	r+   rM   r'   r*   Nonec                 C  H   || _ t|j| _t|j| _t|j| _t|jt| _t|j| _d S N)	_filesr   rU   r[   rf   r   rl   r   ro   r/   rM   r0   r0   r1   __init__  "   
zFilesWithRawResponse.__init__NrM   r'   r*   r~   ru   rv   rw   r   r0   r0   r0   r1   r+         r+   c                   @  r}   )	ry   rM   r(   r*   r~   c                 C  r   r   )	r   r   rU   r[   rf   r    rl   r   ro   r   r0   r0   r1   r     r   z"AsyncFilesWithRawResponse.__init__NrM   r(   r*   r~   r   r0   r0   r0   r1   ry     r   ry   c                   @  r}   )	r4   rM   r'   r*   r~   c                 C  r   r   )	r   r   rU   r[   rf   r   rl   r   ro   r   r0   r0   r1   r     r   z#FilesWithStreamingResponse.__init__Nr   r   r0   r0   r0   r1   r4     r   r4   c                   @  r}   )	rz   rM   r(   r*   r~   c                 C  r   r   )	r   r   rU   r[   rf   r!   rl   r   ro   r   r0   r0   r1   r     r   z(AsyncFilesWithStreamingResponse.__init__Nr   r   r0   r0   r0   r1   rz     r   rz   ):
__future__r   typingr   r   Ztyping_extensionsr   Zhttpxtypesr   _typesr   r	   r
   r   r   r   Z_utilsr   r   r   r   r   Z_compatr   Z	_resourcer   r   	_responser   r   r   r   r   r   r   r   r   r   r    r!   Z_base_clientr"   Ztypes.file_info_responser#   Ztypes.file_list_responser$   Ztypes.file_create_responser%   Ztypes.file_delete_responser&   __all__r'   r(   r+   ry   r4   rz   r0   r0   r0   r1   <module>   s0    8 D D