a
    !fxk                     @  s,  d dl mZ d dlmZmZmZ d dlmZ d dlZddl	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 ddlmZmZ ddlm Z m!Z!m"Z"m#Z#m$Z$ ddl%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ListOptional)LiteralN   )Files
AsyncFilesFilesWithRawResponseAsyncFilesWithRawResponse   )	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transform)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperasync_to_raw_response_wrapper)SyncCursorPageAsyncCursorPage)	AssistantAssistantDeletedassistant_list_paramsassistant_create_paramsassistant_update_params)AsyncPaginatormake_request_options)OpenAIAsyncOpenAI
AssistantsAsyncAssistantsc                      s,  e Zd ZU ded< ded< ddd fdd	Zeeeeeed
d
d
ed
d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Zeeeeeeed
d
d
edddddd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)Z	d
d
d
eddddddd*dd+d,Z
  ZS )-r"   r   filesAssistantsWithRawResponsewith_raw_responser    Noneclientreturnc                   s$   t  | t|| _t| | _d S N)super__init__r   r$   r%   r&   selfr)   	__class__ l/var/www/html/python-backend/venv/lib/python3.9/site-packages/openai/resources/beta/assistants/assistants.pyr-   #   s    
zAssistants.__init__N
descriptionfile_idsinstructionsmetadatanametoolsextra_headersextra_query
extra_bodytimeoutstrOptional[str] | NotGivenList[str] | NotGivenOptional[object] | NotGiven-List[assistant_create_params.Tool] | NotGivenHeaders | NoneQuery | NoneBody | None'float | httpx.Timeout | None | NotGivenr   modelr5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r*   c                C  sF   ddi|pi }| j dt|||||||dtjt||	|
|dtdS )  
        Create an assistant with a model and instructions.

        Args:
          model: ID of the model to use. You can use the
              [List models](https://platform.openai.com/docs/api-reference/models/list) API to
              see all of your available models, or see our
              [Model overview](https://platform.openai.com/docs/models/overview) for
              descriptions of them.

          description: The description of the assistant. The maximum length is 512 characters.

          file_ids: A list of [file](https://platform.openai.com/docs/api-reference/files) IDs
              attached to this assistant. There can be a maximum of 20 files attached to the
              assistant. Files are ordered by their creation date in ascending order.

          instructions: The system instructions that the assistant uses. The maximum length is 32768
              characters.

          metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
              for storing additional information about the object in a structured format. Keys
              can be a maximum of 64 characters long and values can be a maxium of 512
              characters long.

          name: The name of the assistant. The maximum length is 256 characters.

          tools: A list of tool enabled on the assistant. There can be a maximum of 128 tools per
              assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.

          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rI   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   bodyoptionscast_to_postr   r   ZAssistantCreateParamsr   r   r/   rI   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r2   r2   r3   create(   s&    6	zAssistants.createrO   assistant_idr;   r<   r=   r>   r*   c                C  s2   ddi|pi }| j d| t||||dtdS )K  
        Retrieves an assistant.

        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
        rK   rL   /assistants/rO   rR   rS   _getr   r   r/   rY   r;   r<   r=   r>   r2   r2   r3   retrieves   s    zAssistants.retriever5   r6   r7   r8   rI   r9   r:   r;   r<   r=   r>   str | NotGiven-List[assistant_update_params.Tool] | NotGivenrY   r5   r6   r7   r8   rI   r9   r:   r;   r<   r=   r>   r*   c                C  sL   ddi|	pi }	| j d| t|||||||dtjt|	|
||dtdS )k  Modifies an assistant.

        Args:
          description: The description of the assistant.

        The maximum length is 512 characters.

          file_ids: A list of [File](https://platform.openai.com/docs/api-reference/files) IDs
              attached to this assistant. There can be a maximum of 20 files attached to the
              assistant. Files are ordered by their creation date in ascending order. If a
              file was previosuly attached to the list but does not show up in the list, it
              will be deleted from the assistant.

          instructions: The system instructions that the assistant uses. The maximum length is 32768
              characters.

          metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
              for storing additional information about the object in a structured format. Keys
              can be a maximum of 64 characters long and values can be a maxium of 512
              characters long.

          model: ID of the model to use. You can use the
              [List models](https://platform.openai.com/docs/api-reference/models/list) API to
              see all of your available models, or see our
              [Model overview](https://platform.openai.com/docs/models/overview) for
              descriptions of them.

          name: The name of the assistant. The maximum length is 256 characters.

          tools: A list of tool enabled on the assistant. There can be a maximum of 128 tools per
              assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.

          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
        rK   rL   r[   r5   r6   r7   r8   rI   r9   r:   rO   rP   rU   r   r   ZAssistantUpdateParamsr   r   r/   rY   r5   r6   r7   r8   rI   r9   r:   r;   r<   r=   r>   r2   r2   r3   update   s&    :	zAssistants.updateafterbeforelimitorderr;   r<   r=   r>   int | NotGiven!Literal['asc', 'desc'] | NotGivenzSyncCursorPage[Assistant]	rk   rl   rm   rn   r;   r<   r=   r>   r*   c          	      C  sF   ddi|pi }| j dtt t||||t||||dtjdtdS a  Returns a list of assistants.

        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
        rK   rL   rM   )rk   rl   rm   rn   )r;   r<   r=   r>   query)pagerR   rI   )_get_api_listr   r   r   r   r   AssistantListParams	r/   rk   rl   rm   rn   r;   r<   r=   r>   r2   r2   r3   list   s(    +zAssistants.listr   c                C  s2   ddi|pi }| j d| t||||dtdS )H  
        Delete an assistant.

        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
        rK   rL   r[   rO   r\   _deleter   r   r_   r2   r2   r3   delete#  s    zAssistants.delete__name__
__module____qualname____annotations__r-   r   rW   r`   ri   rx   r|   __classcell__r2   r2   r0   r3   r"      sZ   
	(Q$*R"Gc                      s,  e Zd ZU ded< ded< ddd fdd	Zeeeeeed
d
d
ed
d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Zeeeeeeed
d
d
edddddd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)Z	d
d
d
eddddddd*dd+d,Z
  ZS )-r#   r	   r$   AsyncAssistantsWithRawResponser&   r!   r'   r(   c                   s$   t  | t|| _t| | _d S r+   )r,   r-   r	   r$   r   r&   r.   r0   r2   r3   r-   H  s    
zAsyncAssistants.__init__Nr4   r?   r@   rA   rB   rC   rD   rE   rF   rG   r   rH   c                  sL   ddi|pi }| j dt|||||||dtjt||	|
|dtdI dH S )rJ   rK   rL   rM   rN   rO   rP   NrT   rV   r2   r2   r3   rW   M  s&    6	zAsyncAssistants.createrO   rX   c                  s8   ddi|pi }| j d| t||||dtdI dH S )rZ   rK   rL   r[   rO   r\   Nr]   r_   r2   r2   r3   r`     s    zAsyncAssistants.retrievera   rb   rc   rd   c                  sR   ddi|	pi }	| j d| t|||||||dtjt|	|
||dtdI dH S )re   rK   rL   r[   rf   rO   rP   Nrg   rh   r2   r2   r3   ri     s&    :	zAsyncAssistants.updaterj   ro   rp   z5AsyncPaginator[Assistant, AsyncCursorPage[Assistant]]rq   c          	      C  sF   ddi|pi }| j dtt t||||t||||dtjdtdS rr   )ru   r   r   r   r   r   rv   rw   r2   r2   r3   rx     s(    +zAsyncAssistants.listr   c                  s8   ddi|pi }| j d| t||||dtdI dH S )ry   rK   rL   r[   rO   r\   Nrz   r_   r2   r2   r3   r|   H  s    zAsyncAssistants.deleter}   r2   r2   r0   r3   r#   D  sZ   
	(Q$*R"Gc                   @  s   e Zd ZdddddZdS )r%   r"   r'   
assistantsr*   c                 C  sL   t |j| _t|j| _t|j| _t|j| _t|j| _t|j| _d S r+   )r
   r$   r   rW   r`   ri   rx   r|   r/   r   r2   r2   r3   r-   j  s     z"AssistantsWithRawResponse.__init__Nr~   r   r   r-   r2   r2   r2   r3   r%   i  s   r%   c                   @  s   e Zd ZdddddZdS )r   r#   r'   r   c                 C  sL   t |j| _t|j| _t|j| _t|j| _t|j| _t|j| _d S r+   )r   r$   r   rW   r`   ri   rx   r|   r   r2   r2   r3   r-     s     z'AsyncAssistantsWithRawResponse.__init__Nr   r2   r2   r2   r3   r   ~  s   r   )0
__future__r   typingr   r   r   Ztyping_extensionsr   Zhttpxr$   r   r	   r
   r   _typesr   r   r   r   r   _utilsr   Z	_resourcer   r   	_responser   r   Z
paginationr   r   Z
types.betar   r   r   r   r   Z_base_clientr   r   Z_clientr    r!   __all__r"   r#   r%   r   r2   r2   r2   r3   <module>   s,     '  '