o
    jX                     @  sP  d dl mZ d dlmZ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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Z0G dd dZ1G dd dZ2G dd dZ3dS )    )annotations)ListOptional)LiteralN   )_legacy_response   )Files
AsyncFilesFilesWithRawResponseAsyncFilesWithRawResponseFilesWithStreamingResponseAsyncFilesWithStreamingResponse)	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)Messagemessage_list_paramsmessage_create_paramsmessage_update_paramsMessagesAsyncMessagesc                	   @     e Zd Zed3ddZed4ddZed5d	d
Zeedddedd6dd Zddded!d7d#d$Z	eddded%d8d&d'Z
eeeeddded(d9d1d2ZdS ):r#   returnr	   c                 C  
   t | jS N)r	   _clientself r,   u/var/www/html/fyndo/pharma/fyndo/venv/lib/python3.10/site-packages/openai/resources/beta/threads/messages/messages.pyfiles&      
zMessages.filesMessagesWithRawResponsec                 C     t | S r(   )r0   r*   r,   r,   r-   with_raw_response*      zMessages.with_raw_responseMessagesWithStreamingResponsec                 C  r1   r(   )r4   r*   r,   r,   r-   with_streaming_response.   r3   z Messages.with_streaming_responseNfile_idsmetadataextra_headersextra_query
extra_bodytimeout	thread_idstrcontentroleLiteral['user']r7   List[str] | NotGivenr8   Optional[object] | NotGivenr9   Headers | Noner:   Query | Noner;   Body | Noner<   'float | httpx.Timeout | None | NotGivenr   c          
   	   C  sZ   |s	t d|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
        8Expected a non-empty value for `thread_id` but received OpenAI-Betaassistants=v1	/threads/	/messagesr?   r@   r7   r8   r9   r:   r;   r<   bodyoptionscast_to)
ValueError_postr   r!   MessageCreateParamsr   r   
r+   r=   r?   r@   r7   r8   r9   r:   r;   r<   r,   r,   r-   create2   s$   *
	zMessages.createrO   
message_idc                C  s\   |s	t d||st d|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
        rI   9Expected a non-empty value for `message_id` but received rJ   rK   rL   
/messages/rO   rR   rS   rT   _getr   r   r+   rY   r=   r9   r:   r;   r<   r,   r,   r-   retrievep   s   zMessages.retriever8   r9   r:   r;   r<   c             	   C  sj   |s	t d||st d|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
        rI   r[   rJ   rK   rL   r\   r8   rO   rP   )rT   rU   r   r"   MessageUpdateParamsr   r   r+   rY   r=   r8   r9   r:   r;   r<   r,   r,   r-   update   s   zMessages.updateafterbeforelimitorderr9   r:   r;   r<   rh   str | NotGivenri   rj   int | NotGivenrk   !Literal['asc', 'desc'] | NotGivenSyncCursorPage[Message]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 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
        rI   rJ   rK   rL   rM   )rh   ri   rj   rk   )r9   r:   r;   r<   query)pagerR   model)rT   _get_api_listr   r   r   r   r    MessageListParams
r+   r=   rh   ri   rj   rk   r9   r:   r;   r<   r,   r,   r-   list   ,   +
zMessages.list)r&   r	   )r&   r0   )r&   r4   r=   r>   r?   r>   r@   rA   r7   rB   r8   rC   r9   rD   r:   rE   r;   rF   r<   rG   r&   r   rY   r>   r=   r>   r9   rD   r:   rE   r;   rF   r<   rG   r&   r   rY   r>   r=   r>   r8   rC   r9   rD   r:   rE   r;   rF   r<   rG   r&   r   )r=   r>   rh   rl   ri   rl   rj   rm   rk   rn   r9   rD   r:   rE   r;   rF   r<   rG   r&   ro   __name__
__module____qualname__r   r.   r2   r5   r   rX   ra   rf   rx   r,   r,   r,   r-   r#   %   D    	E*0c                	   @  r%   ):r$   r&   r
   c                 C  r'   r(   )r
   r)   r*   r,   r,   r-   r.     r/   zAsyncMessages.filesAsyncMessagesWithRawResponsec                 C  r1   r(   )r   r*   r,   r,   r-   r2   
  r3   zAsyncMessages.with_raw_response"AsyncMessagesWithStreamingResponsec                 C  r1   r(   )r   r*   r,   r,   r-   r5     r3   z%AsyncMessages.with_streaming_responseNr6   r=   r>   r?   r@   rA   r7   rB   r8   rC   r9   rD   r:   rE   r;   rF   r<   rG   r   c          
   	     sh   |s
t d|ddi|pi }| jd| dt||||dtjI dH t||||	dtd	I dH S )
rH   rI   rJ   rK   rL   rM   rN   NrO   rP   )rT   rU   r   r!   rV   r   r   rW   r,   r,   r-   rX     s&   *
	zAsyncMessages.createrO   rY   c                  sd   |s
t d||st d|ddi|pi }| jd| d| t||||dtdI d	H S )
rZ   rI   r[   rJ   rK   rL   r\   rO   r]   Nr^   r`   r,   r,   r-   ra   P  s   zAsyncMessages.retrieverb   c             	     sx   |s
t d||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 )rc   rI   r[   rJ   rK   rL   r\   r8   NrO   rP   )rT   rU   r   r"   rd   r   r   re   r,   r,   r-   rf   u  s   zAsyncMessages.updaterg   rh   rl   ri   rj   rm   rk   rn   1AsyncPaginator[Message, AsyncCursorPage[Message]]c          
      C  rp   rq   )rT   ru   r   r   r   r   r    rv   rw   r,   r,   r-   rx     ry   zAsyncMessages.list)r&   r
   )r&   r   )r&   r   rz   r{   r|   )r=   r>   rh   rl   ri   rl   rj   rm   rk   rn   r9   rD   r:   rE   r;   rF   r<   rG   r&   r   r}   r,   r,   r,   r-   r$     r   c                   @  $   e Zd ZdddZeddd	Zd
S )r0   messagesr#   r&   Nonec                 C  B   || _ t|j| _t|j| _t|j| _t|j| _d S r(   )	_messagesr   to_raw_response_wrapperrX   ra   rf   rx   r+   r   r,   r,   r-   __init__     
z MessagesWithRawResponse.__init__r   c                 C     t | jjS r(   )r   r   r.   r*   r,   r,   r-   r.        zMessagesWithRawResponse.filesNr   r#   r&   r   )r&   r   r~   r   r   r   r   r.   r,   r,   r,   r-   r0         
r0   c                   @  r   )r   r   r$   r&   r   c                 C  r   r(   )r   r   async_to_raw_response_wrapperrX   ra   rf   rx   r   r,   r,   r-   r     r   z%AsyncMessagesWithRawResponse.__init__r   c                 C  r   r(   )r   r   r.   r*   r,   r,   r-   r.     r   z"AsyncMessagesWithRawResponse.filesNr   r$   r&   r   )r&   r   r   r,   r,   r,   r-   r     r   r   c                   @  r   )r4   r   r#   r&   r   c                 C  :   || _ t|j| _t|j| _t|j| _t|j| _d S r(   )r   r   rX   ra   rf   rx   r   r,   r,   r-   r        
z&MessagesWithStreamingResponse.__init__r   c                 C  r   r(   )r   r   r.   r*   r,   r,   r-   r.   "  r   z#MessagesWithStreamingResponse.filesNr   )r&   r   r   r,   r,   r,   r-   r4     r   r4   c                   @  r   )r   r   r$   r&   r   c                 C  r   r(   )r   r   rX   ra   rf   rx   r   r,   r,   r-   r   (  r   z+AsyncMessagesWithStreamingResponse.__init__r   c                 C  r   r(   )r   r   r.   r*   r,   r,   r-   r.   8  r   z(AsyncMessagesWithStreamingResponse.filesNr   )r&   r   r   r,   r,   r,   r-   r   '  r   r   )4
__future__r   typingr   r   typing_extensionsr   httpx r   r.   r	   r
   r   r   r   r   _typesr   r   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r   types.beta.threadsr   r    r!   r"   __all__r#   r$   r0   r   r4   r   r,   r,   r,   r-   <module>   s.     a a