o
    jL                     @  s   d dl 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 ddl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" 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Z)dS )    )annotations)LiteralN   )_legacy_response)	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncCursorPageAsyncCursorPage)AsyncPaginatormake_request_options)AssistantFileFileDeleteResponsefile_list_paramsfile_create_params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eeee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 N)r   self r#   l/var/www/html/fyndo/pharma/fyndo/venv/lib/python3.10/site-packages/openai/resources/beta/assistants/files.pywith_raw_response      zFiles.with_raw_responseFilesWithStreamingResponsec                 C  r   r    )r'   r!   r#   r#   r$   with_streaming_response!   r&   zFiles.with_streaming_responseNextra_headersextra_query
extra_bodytimeoutassistant_idstrfile_idr*   Headers | Noner+   Query | Noner,   Body | Noner-   'float | httpx.Timeout | None | NotGivenr   c             	   C  sT   |s	t d|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
        ;Expected a non-empty value for `assistant_id` but received OpenAI-Betaassistants=v1/assistants//filesr0   r)   bodyoptionscast_to)
ValueError_postr   r   FileCreateParamsr   r   r"   r.   r0   r*   r+   r,   r-   r#   r#   r$   create%   s   
zFiles.createc                C  \   |s	t d||st d|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
        r6   6Expected a non-empty value for `file_id` but received r7   r8   r9   /files/r)   r=   r>   r?   _getr   r   r"   r0   r.   r*   r+   r,   r-   r#   r#   r$   retrieveO      zFiles.retrieveafterbeforelimitorderr*   r+   r,   r-   rO   str | NotGivenrP   rQ   int | NotGivenrR   !Literal['asc', 'desc'] | NotGivenSyncCursorPage[AssistantFile]c          
      C  `   |s	t d|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
        r6   r7   r8   r9   r:   )rO   rP   rQ   rR   )r*   r+   r,   r-   query)pager=   model)r?   _get_api_listr   r   r   r   r   FileListParams
r"   r.   rO   rP   rQ   rR   r*   r+   r,   r-   r#   r#   r$   listt   ,   +
z
Files.listr   c                C  rD   )	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
        r6   rF   r7   r8   r9   rG   r)   rH   r?   _deleter   r   rK   r#   r#   r$   delete   rM   zFiles.delete)r   r   )r   r'   r.   r/   r0   r/   r*   r1   r+   r2   r,   r3   r-   r4   r   r   r0   r/   r.   r/   r*   r1   r+   r2   r,   r3   r-   r4   r   r   )r.   r/   rO   rS   rP   rS   rQ   rT   rR   rU   r*   r1   r+   r2   r,   r3   r-   r4   r   rV   r0   r/   r.   r/   r*   r1   r+   r2   r,   r3   r-   r4   r   r   __name__
__module____qualname__r   r%   r(   r   rC   rL   r_   rd   r#   r#   r#   r$   r      :    
1)Jc                	   @  r   ).r   r   AsyncFilesWithRawResponsec                 C  r   r    )rm   r!   r#   r#   r$   r%      r&   zAsyncFiles.with_raw_responseAsyncFilesWithStreamingResponsec                 C  r   r    )rn   r!   r#   r#   r$   r(      r&   z"AsyncFiles.with_streaming_responseNr)   r.   r/   r0   r*   r1   r+   r2   r,   r3   r-   r4   r   c             	     sb   |s
t d|ddi|pi }| jd| dtd|itjI dH t||||dtd	I dH S )
r5   r6   r7   r8   r9   r:   r0   Nr)   r;   )r?   r@   r   r   rA   r   r   rB   r#   r#   r$   rC      s   
zAsyncFiles.createc                  d   |s
t d||st d|ddi|pi }| jd| d| t||||dtdI d	H S )
rE   r6   rF   r7   r8   r9   rG   r)   rH   NrI   rK   r#   r#   r$   rL        zAsyncFiles.retrieverN   rO   rS   rP   rQ   rT   rR   rU   =AsyncPaginator[AssistantFile, AsyncCursorPage[AssistantFile]]c          
      C  rW   rX   )r?   r\   r   r   r   r   r   r]   r^   r#   r#   r$   r_   5  r`   zAsyncFiles.listr   c                  ro   )
ra   r6   rF   r7   r8   r9   rG   r)   rH   Nrb   rK   r#   r#   r$   rd   x  rp   zAsyncFiles.delete)r   rm   )r   rn   re   rf   )r.   r/   rO   rS   rP   rS   rQ   rT   rR   rU   r*   r1   r+   r2   r,   r3   r-   r4   r   rq   rg   rh   r#   r#   r#   r$   r      rl   c                   @     e Zd ZdddZdS )	r   filesr   r   Nonec                 C  B   || _ t|j| _t|j| _t|j| _t|j| _d S r    )_filesr   to_raw_response_wrapperrC   rL   r_   rd   r"   rs   r#   r#   r$   __init__     
zFilesWithRawResponse.__init__Nrs   r   r   rt   ri   rj   rk   ry   r#   r#   r#   r$   r         r   c                   @  rr   )	rm   rs   r   r   rt   c                 C  ru   r    )rv   r   async_to_raw_response_wrapperrC   rL   r_   rd   rx   r#   r#   r$   ry     rz   z"AsyncFilesWithRawResponse.__init__Nrs   r   r   rt   r|   r#   r#   r#   r$   rm     r}   rm   c                   @  rr   )	r'   rs   r   r   rt   c                 C  :   || _ t|j| _t|j| _t|j| _t|j| _d S r    )rv   r   rC   rL   r_   rd   rx   r#   r#   r$   ry        
z#FilesWithStreamingResponse.__init__Nr{   r|   r#   r#   r#   r$   r'     r}   r'   c                   @  rr   )	rn   rs   r   r   rt   c                 C  r   r    )rv   r   rC   rL   r_   rd   rx   r#   r#   r$   ry     r   z(AsyncFilesWithStreamingResponse.__init__Nr   r|   r#   r#   r#   r$   rn     r}   rn   )*
__future__r   typing_extensionsr   httpx r   _typesr   r   r   r	   r
   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r   types.beta.assistantsr   r   r   r   __all__r   r   r   rm   r'   rn   r#   r#   r#   r$   <module>   s*    B B