a
    !f@                     @  s  d dl mZ d dlmZ d dlmZ d dl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 dd
lmZmZ ddlmZmZ ddlmZmZmZmZ erddl m!Z!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'dS )    )annotations)TYPE_CHECKING)LiteralN   )	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transform)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperasync_to_raw_response_wrapper)SyncCursorPageAsyncCursorPage)AsyncPaginatormake_request_options)AssistantFileFileDeleteResponsefile_list_paramsfile_create_params)OpenAIAsyncOpenAIFiles
AsyncFilesc                      s   e Zd ZU ded< ddd f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ddZeeeedddedd
d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dd Z	  Z
S )!r   FilesWithRawResponsewith_raw_responser   Noneclientreturnc                   s   t  | t| | _d S N)super__init__r   r   selfr    	__class__ g/var/www/html/python-backend/venv/lib/python3.9/site-packages/openai/resources/beta/assistants/files.pyr$       s    zFiles.__init__Nextra_headersextra_query
extra_bodytimeoutstrHeaders | NoneQuery | NoneBody | None'float | httpx.Timeout | None | NotGivenr   assistant_idfile_idr,   r-   r.   r/   r!   c             	   C  sB   ddi|pi }| j d| dtd|itjt||||dtdS )  
        Create an assistant file by attaching a
        [File](https://platform.openai.com/docs/api-reference/files) to an
        [assistant](https://platform.openai.com/docs/api-reference/assistants).

        Args:
          file_id: A [File](https://platform.openai.com/docs/api-reference/files) ID (with
              `purpose="assistants"`) that the assistant should use. Useful for tools like
              `retrieval` and `code_interpreter` that can access files.

          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
        OpenAI-Betaassistants=v1/assistants//filesr7   r+   bodyoptionscast_to_postr   r   ZFileCreateParamsr   r   r&   r6   r7   r,   r-   r.   r/   r)   r)   r*   create$   s    
zFiles.creater7   r6   r,   r-   r.   r/   r!   c                C  s8   ddi|pi }| j d| d| t||||dtdS )O  
        Retrieves an AssistantFile.

        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
        r9   r:   r;   /files/r+   r?   r@   _getr   r   r&   r7   r6   r,   r-   r.   r/   r)   r)   r*   retrieveL   s    zFiles.retrieveafterbeforelimitorderr,   r-   r.   r/   str | NotGivenint | NotGiven!Literal['asc', 'desc'] | NotGivenzSyncCursorPage[AssistantFile]
r6   rN   rO   rP   rQ   r,   r-   r.   r/   r!   c          
      C  sN   ddi|pi }| j d| dtt t||||	t||||dtjdtdS a  
        Returns a list of assistant files.

        Args:
          after: A cursor for use in pagination. `after` is an object ID that defines your place
              in the list. For instance, if you make a list request and receive 100 objects,
              ending with obj_foo, your subsequent call can include after=obj_foo in order to
              fetch the next page of the list.

          before: A cursor for use in pagination. `before` is an object ID that defines your place
              in the list. For instance, if you make a list request and receive 100 objects,
              ending with obj_foo, your subsequent call can include before=obj_foo in order to
              fetch the previous page of the list.

          limit: A limit on the number of objects to be returned. Limit can range between 1 and
              100, and the default is 20.

          order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending
              order and `desc` for descending order.

          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
        r9   r:   r;   r<   )rN   rO   rP   rQ   )r,   r-   r.   r/   query)pager?   model)_get_api_listr   r   r   r   r   FileListParams
r&   r6   rN   rO   rP   rQ   r,   r-   r.   r/   r)   r)   r*   listm   s(    +
z
Files.listr   c                C  s8   ddi|pi }| j d| d| t||||dtdS )M  
        Delete an assistant 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
        r9   r:   r;   rG   r+   rH   _deleter   r   rK   r)   r)   r*   delete   s    zFiles.delete__name__
__module____qualname____annotations__r$   r   rD   rL   r]   ra   __classcell__r)   r)   r'   r*   r      s4   
/%$Hc                      s   e Zd ZU ded< ddd f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ddZeeeedddedd
d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dd Z	  Z
S )!r   AsyncFilesWithRawResponser   r   r   r   c                   s   t  | t| | _d S r"   )r#   r$   rh   r   r%   r'   r)   r*   r$      s    zAsyncFiles.__init__Nr+   r0   r1   r2   r3   r4   r   r5   c             	     sH   ddi|pi }| j d| dtd|itjt||||dtdI dH S )	r8   r9   r:   r;   r<   r7   r+   r=   NrA   rC   r)   r)   r*   rD      s    
zAsyncFiles.createrE   c                  s>   ddi|pi }| j d| d| t||||dtdI dH S )rF   r9   r:   r;   rG   r+   rH   NrI   rK   r)   r)   r*   rL      s    zAsyncFiles.retrieverM   rR   rS   rT   z=AsyncPaginator[AssistantFile, AsyncCursorPage[AssistantFile]]rU   c          
      C  sN   ddi|pi }| j d| dtt t||||	t||||dtjdtdS rV   )rZ   r   r   r   r   r   r[   r\   r)   r)   r*   r]      s(    +
zAsyncFiles.listr   c                  s>   ddi|pi }| j d| d| t||||dtdI dH S )r^   r9   r:   r;   rG   r+   rH   Nr_   rK   r)   r)   r*   ra   a  s    zAsyncFiles.deleterb   r)   r)   r'   r*   r      s4   
/%$Hc                   @  s   e Zd ZdddddZdS )r   r   r   filesr!   c                 C  s4   t |j| _t |j| _t |j| _t |j| _d S r"   )r   rD   rL   r]   ra   r&   rj   r)   r)   r*   r$     s    zFilesWithRawResponse.__init__Nrc   rd   re   r$   r)   r)   r)   r*   r     s   r   c                   @  s   e Zd ZdddddZdS )rh   r   r   ri   c                 C  s4   t |j| _t |j| _t |j| _t |j| _d S r"   )r   rD   rL   r]   ra   rk   r)   r)   r*   r$     s    z"AsyncFilesWithRawResponse.__init__Nrl   r)   r)   r)   r*   rh     s   rh   )(
__future__r   typingr   Ztyping_extensionsr   Zhttpx_typesr   r   r   r	   r
   _utilsr   Z	_resourcer   r   	_responser   r   Z
paginationr   r   Z_base_clientr   r   Ztypes.beta.assistantsr   r   r   r   Z_clientr   r   __all__r   r   r   rh   r)   r)   r)   r*   <module>   s&    4 4