a
    !f^T                     @  s0  d dl mZ d dlmZmZ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 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!m"Z"m#Z#m$Z$ ddl%m&Z& ddl'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Z0dS )    )annotations)TYPE_CHECKINGListOptionalN   )Runs	AsyncRunsRunsWithRawResponseAsyncRunsWithRawResponse)MessagesAsyncMessagesMessagesWithRawResponseAsyncMessagesWithRawResponse   )	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transform)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperasync_to_raw_response_wrapper)ThreadThreadDeletedthread_create_paramsthread_update_paramsthread_create_and_run_params)make_request_options)Run)OpenAIAsyncOpenAIThreadsAsyncThreadsc                      s  e Zd ZU ded< ded< ded< ddd	 fd
dZee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Ze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#Z	eeeeeddded$	dd%dd%d&d'ddddd(d)d*d+Z
  ZS ),r#   r   runsr   messagesThreadsWithRawResponsewith_raw_responser!   Noneclientreturnc                   s.   t  | t|| _t|| _t| | _d S N)super__init__r   r%   r   r&   r'   r(   selfr+   	__class__ f/var/www/html/python-backend/venv/lib/python3.9/site-packages/openai/resources/beta/threads/threads.pyr/   )   s    

zThreads.__init__Nr&   metadataextra_headersextra_query
extra_bodytimeout-List[thread_create_params.Message] | NotGivenOptional[object] | NotGivenHeaders | NoneQuery | NoneBody | None'float | httpx.Timeout | None | NotGivenr   r&   r7   r8   r9   r:   r;   r,   c             	   C  s<   ddi|pi }| j dt||dtjt||||dtdS )	  
        Create a thread.

        Args:
          messages: A list of [messages](https://platform.openai.com/docs/api-reference/messages) to
              start the thread with.

          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.

          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/threadsr&   r7   r8   r9   r:   r;   bodyoptionscast_to_postr   r   ZThreadCreateParamsr   r   r1   r&   r7   r8   r9   r:   r;   r4   r4   r5   create/   s     zThreads.createrH   str	thread_idr8   r9   r:   r;   r,   c                C  s2   ddi|pi }| j d| t||||dtdS )G  
        Retrieves a thread.

        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
        rD   rE   	/threads/rH   rK   rL   _getr   r   r1   rS   r8   r9   r:   r;   r4   r4   r5   retrieve_   s    zThreads.retriever7   r8   r9   r:   r;   rS   r7   r8   r9   r:   r;   r,   c             	   C  s@   ddi|pi }| j d| td|itjt||||dtdS )  
        Modifies a thread.

        Args:
          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.

          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
        rD   rE   rU   r7   rH   rI   rN   r   r   ZThreadUpdateParamsr   r   r1   rS   r7   r8   r9   r:   r;   r4   r4   r5   update   s    zThreads.updater   c                C  s2   ddi|pi }| j d| t||||dtdS )D  
        Delete a thread.

        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
        rD   rE   rU   rH   rV   _deleter   r   rY   r4   r4   r5   delete   s    zThreads.delete	instructionsr7   modelthreadtoolsr8   r9   r:   r;   Optional[str] | NotGiven.thread_create_and_run_params.Thread | NotGiven<Optional[List[thread_create_and_run_params.Tool]] | NotGivenr    assistant_idrf   r7   rg   rh   ri   r8   r9   r:   r;   r,   c       
      
   C  sD   ddi|pi }| j dt||||||dtjt|||	|
dtdS )  
        Create a thread and run it in one request.

        Args:
          assistant_id: The ID of the
              [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
              execute this run.

          instructions: Override the default system message of the assistant. This is useful for
              modifying the behavior on a per-run basis.

          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: The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to
              be used to execute this run. If a value is provided here, it will override the
              model associated with the assistant. If not, the model associated with the
              assistant will be used.

          thread: If no thread is provided, an empty thread will be created.

          tools: Override the tools the assistant can use for this run. This is useful for
              modifying the behavior on a per-run basis.

          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
        rD   rE   /threads/runsrn   rf   r7   rg   rh   ri   rH   rI   rN   r   r   ZThreadCreateAndRunParamsr   r    r1   rn   rf   r7   rg   rh   ri   r8   r9   r:   r;   r4   r4   r5   create_and_run   s$    2zThreads.create_and_run__name__
__module____qualname____annotations__r/   r   rP   rZ   r`   rd   rt   __classcell__r4   r4   r2   r5   r#   $   sJ   
	6$-$c                      s  e Zd ZU ded< ded< ded< ddd	 fd
dZee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Ze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#Z	eeeeeddded$	dd%dd%d&d'ddddd(d)d*d+Z
  ZS ),r$   r   r%   r   r&   AsyncThreadsWithRawResponser(   r"   r)   r*   c                   s.   t  | t|| _t|| _t| | _d S r-   )r.   r/   r   r%   r   r&   r{   r(   r0   r2   r4   r5   r/     s    

zAsyncThreads.__init__Nr6   r<   r=   r>   r?   r@   rA   r   rB   c             	     sB   ddi|pi }| j dt||dtjt||||dtdI dH S )rC   rD   rE   rF   rG   rH   rI   NrM   rO   r4   r4   r5   rP     s     zAsyncThreads.createrH   rQ   rR   c                  s8   ddi|pi }| j d| t||||dtdI dH S )rT   rD   rE   rU   rH   rV   NrW   rY   r4   r4   r5   rZ   H  s    zAsyncThreads.retriever[   r\   c             	     sF   ddi|pi }| j d| td|itjt||||dtdI dH S )r]   rD   rE   rU   r7   rH   rI   Nr^   r_   r4   r4   r5   r`   h  s    zAsyncThreads.updater   c                  s8   ddi|pi }| j d| t||||dtdI dH S )ra   rD   rE   rU   rH   rV   Nrb   rY   r4   r4   r5   rd     s    zAsyncThreads.deletere   rj   rk   rl   r    rm   c       
      
     sJ   ddi|pi }| j dt||||||dtjt|||	|
dtdI dH S )ro   rD   rE   rp   rq   rH   rI   Nrr   rs   r4   r4   r5   rt     s$    2zAsyncThreads.create_and_runru   r4   r4   r2   r5   r$     sJ   
	6$-$c                   @  s   e Zd ZdddddZdS )r'   r#   r)   threadsr,   c                 C  sX   t |j| _t|j| _t|j| _t|j| _t|j| _t|j| _t|j	| _	d S r-   )
r	   r%   r   r&   r   rP   rZ   r`   rd   rt   r1   r}   r4   r4   r5   r/     s"    zThreadsWithRawResponse.__init__Nrv   rw   rx   r/   r4   r4   r4   r5   r'     s   r'   c                   @  s   e Zd ZdddddZdS )r{   r$   r)   r|   c                 C  sX   t |j| _t|j| _t|j| _t|j| _t|j| _t|j| _t|j	| _	d S r-   )
r
   r%   r   r&   r   rP   rZ   r`   rd   rt   r~   r4   r4   r5   r/     s"    z$AsyncThreadsWithRawResponse.__init__Nr   r4   r4   r4   r5   r{     s   r{   )1
__future__r   typingr   r   r   Zhttpxr%   r   r   r	   r
   r&   r   r   r   r   _typesr   r   r   r   r   _utilsr   Z	_resourcer   r   	_responser   r   Z
types.betar   r   r   r   r   Z_base_clientr   Ztypes.beta.threadsr    Z_clientr!   r"   __all__r#   r$   r'   r{   r4   r4   r4   r5   <module>   s(    j j