U
    &JjK                     @  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)BodyQueryHeadersNotGiven	FileTypes	not_given)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                	   @  s   e Zd ZeddddZeddddZddded	d
dddddddddZddded	ddddddddZddded	dddddddddZ	ddded	dddddddddZ
ddded	dddddd dd!d"ZdS )#r&   FilesWithRawResponsereturnc                 C  s   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.   u/var/www/api.dyntland.com/public_html/python_social_comments/venv/lib/python3.8/site-packages/groq/resources/files.pywith_raw_response'   s    zFiles.with_raw_responseFilesWithStreamingResponsec                 C  s   t | S 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
        )r1   r,   r.   r.   r/   with_streaming_response1   s    zFiles.with_streaming_responseNextra_headersextra_query
extra_bodytimeoutr   Literal['batch']Headers | NoneQuery | NoneBody | None'float | httpx.Timeout | None | NotGivenr$   filepurposer5   r6   r7   r8   r*   c          	   
   C  sd   t ||d}tttttf |dggd}ddi|p8i }| 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/filesr4   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   FileCreateParamsr!   r$   	r-   r?   r@   r5   r6   r7   r8   rI   rJ   r.   r.   r/   create:   s&    "
   zFiles.creater#   r5   r6   r7   r8   r*   c                C  s   | j dt||||dtdS )Returns a list of files.rG   r4   rK   rL   _getr!   r#   r-   r5   r6   r7   r8   r.   r.   r/   listq   s       z
Files.listrM   r%   file_idr5   r6   r7   r8   r*   c                C  s4   |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/r4   rU   
ValueError_deleter!   r%   r-   r[   r5   r6   r7   r8   r.   r.   r/   delete   s       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^   /contentr4   rU   )r`   rW   r!   r   rb   r.   r.   r/   content   s    
   zFiles.contentr"   c                C  s4   |st d|| jd| t||||dtdS )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^   r4   rU   r`   rW   r!   r"   rb   r.   r.   r/   info   s       z
Files.info__name__
__module____qualname__r   r0   r3   r   rR   rY   rc   rh   rk   r.   r.   r.   r/   r&   &   s:   	<'(c                	   @  s   e Zd ZeddddZeddddZddded	d
dddddddddZddded	ddddddddZddded	dddddddddZ	ddded	dddddddddZ
ddded	dddddd dd!d"ZdS )#r'   AsyncFilesWithRawResponser)   c                 C  s   t | S r+   )rp   r,   r.   r.   r/   r0      s    zAsyncFiles.with_raw_responseAsyncFilesWithStreamingResponsec                 C  s   t | S r2   )rq   r,   r.   r.   r/   r3      s    z"AsyncFiles.with_streaming_responseNr4   r   r9   r:   r;   r<   r=   r$   r>   c          	   
     sp   t ||d}tttttf |dggd}ddi|p8i }| jdt|tj	I dH |t
||||dtd	I dH S )
rA   rB   r?   rC   rE   rF   rG   Nr4   rH   )r   r   r   r   rM   rN   rO   r   r   rP   r!   r$   rQ   r.   r.   r/   rR      s&    "   zAsyncFiles.creater#   rS   c                  s"   | j dt||||dtdI dH S )rT   rG   r4   rU   NrV   rX   r.   r.   r/   rY   4  s       zAsyncFiles.listrM   r%   rZ   c                  s:   |st d|| jd| t||||dtdI dH S )r\   r]   r^   r4   rU   Nr_   rb   r.   r.   r/   rc   G  s       zAsyncFiles.deleter   c                  sL   |st d|ddi|pi }| jd| dt||||dtdI dH S )	rd   r]   re   rf   r^   rg   r4   rU   N)r`   rW   r!   r   rb   r.   r.   r/   rh   h  s    
   zAsyncFiles.contentr"   c                  s:   |st d|| jd| t||||dtdI dH S )ri   r]   r^   r4   rU   Nrj   rb   r.   r.   r/   rk     s       zAsyncFiles.inforl   r.   r.   r.   r/   r'      s:   	<'(c                   @  s   e Zd ZdddddZdS )r(   r&   NonerJ   r*   c                 C  sH   || _ t|j| _t|j| _t|j| _t|jt| _t|j| _d S N)	_filesr   rR   rY   rc   r   rh   r   rk   r-   rJ   r.   r.   r/   __init__  s"    zFilesWithRawResponse.__init__Nrm   rn   ro   rw   r.   r.   r.   r/   r(     s   r(   c                   @  s   e Zd ZdddddZdS )rp   r'   rr   rs   c                 C  sH   || _ t|j| _t|j| _t|j| _t|jt| _t|j| _d S rt   )	ru   r   rR   rY   rc   r   rh   r   rk   rv   r.   r.   r/   rw     s"    z"AsyncFilesWithRawResponse.__init__Nrx   r.   r.   r.   r/   rp     s   rp   c                   @  s   e Zd ZdddddZdS )r1   r&   rr   rs   c                 C  sH   || _ t|j| _t|j| _t|j| _t|jt| _t|j| _d S rt   )	ru   r   rR   rY   rc   r   rh   r   rk   rv   r.   r.   r/   rw     s"    z#FilesWithStreamingResponse.__init__Nrx   r.   r.   r.   r/   r1     s   r1   c                   @  s   e Zd ZdddddZdS )rq   r'   rr   rs   c                 C  sH   || _ t|j| _t|j| _t|j| _t|jt| _t|j| _d S rt   )	ru   r   rR   rY   rc   r    rh   r   rk   rv   r.   r.   r/   rw     s"    z(AsyncFilesWithStreamingResponse.__init__Nrx   r.   r.   r.   r/   rq     s   rq   )9
__future__r   typingr   r   typing_extensionsr   Zhttpxtypesr   _typesr   r	   r
   r   r   r   Z_utilsr   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(   rp   r1   rq   r.   r.   r.   r/   <module>   s.    8 D D