a
    !fpK                     @  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! 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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)AsyncPaginatormake_request_options)ThreadMessagemessage_list_paramsmessage_create_paramsmessage_update_params)OpenAIAsyncOpenAIMessagesAsyncMessagesc                      s   e Zd ZU 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d
ddZd
d
d
ed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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	  Z
S )(r!   r   filesMessagesWithRawResponsewith_raw_responser   Noneclientreturnc                   s$   t  | t|| _t| | _d S N)super__init__r   r#   r$   r%   selfr(   	__class__ p/var/www/html/python-backend/venv/lib/python3.9/site-packages/openai/resources/beta/threads/messages/messages.pyr,   "   s    
zMessages.__init__Nfile_idsmetadataextra_headersextra_query
extra_bodytimeoutstrLiteral['user']List[str] | NotGivenOptional[object] | NotGivenHeaders | NoneQuery | NoneBody | None'float | httpx.Timeout | None | NotGivenr   
	thread_idcontentroler4   r5   r6   r7   r8   r9   r)   c          
   	   C  sH   ddi|pi }| j d| dt||||dtjt||||	dtdS )`  
        Create a message.

        Args:
          content: The content of the message.

          role: The role of the entity that is creating the message. Currently only `user` is
              supported.

          file_ids: A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
              the message should use. There can be a maximum of 10 files attached to a
              message. Useful for tools like `retrieval` and `code_interpreter` that can
              access and use files.

          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/	/messagesrD   rE   r4   r5   r6   r7   r8   r9   bodyoptionscast_to_postr   r   ZMessageCreateParamsr   r   
r.   rC   rD   rE   r4   r5   r6   r7   r8   r9   r1   r1   r2   create'   s     *
	zMessages.createrL   
message_idrC   r6   r7   r8   r9   r)   c                C  s8   ddi|pi }| j d| d| t||||dtdS )G  
        Retrieve a message.

        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
        rG   rH   rI   
/messages/rL   rO   rP   _getr   r   r.   rV   rC   r6   r7   r8   r9   r1   r1   r2   retrievec   s    zMessages.retriever5   r6   r7   r8   r9   rV   rC   r5   r6   r7   r8   r9   r)   c             	   C  sF   ddi|pi }| j d| d| td|itjt||||dtdS )  
        Modifies a message.

        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
        rG   rH   rI   rX   r5   rL   rM   rR   r   r   ZMessageUpdateParamsr   r   r.   rV   rC   r5   r6   r7   r8   r9   r1   r1   r2   update   s    zMessages.updateafterbeforelimitorderr6   r7   r8   r9   str | NotGivenint | NotGiven!Literal['asc', 'desc'] | NotGivenzSyncCursorPage[ThreadMessage]
rC   re   rf   rg   rh   r6   r7   r8   r9   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 messages for a given thread.

        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
        rG   rH   rI   rJ   )re   rf   rg   rh   )r6   r7   r8   r9   query)pagerO   model)_get_api_listr   r   r   r   r   MessageListParams
r.   rC   re   rf   rg   rh   r6   r7   r8   r9   r1   r1   r2   list   s(    +
zMessages.list__name__
__module____qualname____annotations__r,   r   rT   r]   rc   rt   __classcell__r1   r1   r/   r2   r!      s<   
$C& ,c                      s   e Zd ZU 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d
ddZd
d
d
ed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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	  Z
S )(r"   r	   r#   AsyncMessagesWithRawResponser%   r    r&   r'   c                   s$   t  | t|| _t| | _d S r*   )r+   r,   r	   r#   r{   r%   r-   r/   r1   r2   r,      s    
zAsyncMessages.__init__Nr3   r:   r;   r<   r=   r>   r?   r@   rA   r   rB   c          
   	     sN   ddi|pi }| j d| dt||||dtjt||||	dtdI dH S )	rF   rG   rH   rI   rJ   rK   rL   rM   NrQ   rS   r1   r1   r2   rT      s     *
	zAsyncMessages.createrL   rU   c                  s>   ddi|pi }| j d| d| t||||dtdI dH S )rW   rG   rH   rI   rX   rL   rY   NrZ   r\   r1   r1   r2   r]   3  s    zAsyncMessages.retriever^   r_   c             	     sL   ddi|pi }| j d| d| td|itjt||||dtdI dH S )	r`   rG   rH   rI   rX   r5   rL   rM   Nra   rb   r1   r1   r2   rc   T  s    zAsyncMessages.updaterd   ri   rj   rk   z=AsyncPaginator[ThreadMessage, AsyncCursorPage[ThreadMessage]]rl   c          
      C  sN   ddi|pi }| j d| dtt t||||	t||||dtjdtdS rm   )rq   r   r   r   r   r   rr   rs   r1   r1   r2   rt   |  s(    +
zAsyncMessages.listru   r1   r1   r/   r2   r"      s<   
$C& ,c                   @  s   e Zd ZdddddZdS )r$   r!   r&   messagesr)   c                 C  s@   t |j| _t|j| _t|j| _t|j| _t|j| _d S r*   )r
   r#   r   rT   r]   rc   rt   r.   r}   r1   r1   r2   r,     s    z MessagesWithRawResponse.__init__Nrv   rw   rx   r,   r1   r1   r1   r2   r$     s   r$   c                   @  s   e Zd ZdddddZdS )r{   r"   r&   r|   c                 C  s@   t |j| _t|j| _t|j| _t|j| _t|j| _d S r*   )r   r#   r   rT   r]   rc   rt   r~   r1   r1   r2   r,     s    z%AsyncMessagesWithRawResponse.__init__Nr   r1   r1   r1   r2   r{     s   r{   )/
__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_base_clientr   r   Ztypes.beta.threadsr   r   r   r   Z_clientr   r    __all__r!   r"   r$   r{   r1   r1   r1   r2   <module>   s(    Q Q