
    _j)~                       S SK Jr  S SKrS SKJrJrJr  S SKJr  S SKrSSK	J
r
  SSKJrJrJrJrJrJrJr  SSKJrJrJr  SS	KJr  SS
KJrJr  SSKJrJr  SSKJ r J!r!  SSK"J#r#J$r$  SSK%J&r&J'r'J(r(  SSK)J*r*  SSK+J,r,  SSK-J.r.  SSK/J0r0  SS/r1 " S S\5      r2 " S S\5      r3 " S S5      r4 " S S5      r5 " S S5      r6 " S S5      r7g)    )annotationsN)UnionIterableOptional)Literal   )_legacy_response)BodyOmitQueryHeadersNotGivenomit	not_given)path_template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_list_paramsmessage_create_paramsmessage_update_params)Message)Metadata)MessageDeleted)MessageContentPartParamMessagesAsyncMessagesc                  <   \ rS rSrSr\SS j5       r\SS j5       r\R                  " S5      \
\
SSS\S.                   SS jj5       r\R                  " S5      SSS\S	.             SS
 jj5       r\R                  " S5      \
SSS\S.               SS jj5       r\R                  " S5      \
\
\
\
\
SSS\S.	                     SS jj5       r\R                  " S5      SSS\S	.             SS jj5       rSrg)r$      4Build Assistants that can call models and use tools.c                    [        U 5      $ z
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
)MessagesWithRawResponseselfs    [/home/rurouni/.local/lib/python3.13/site-packages/openai/resources/beta/threads/messages.pywith_raw_responseMessages.with_raw_response"   s     't,,    c                    [        U 5      $ z
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/openai/openai-python#with_streaming_response
)MessagesWithStreamingResponser,   s    r.   with_streaming_response Messages.with_streaming_response,   s     -T22r1   >The Assistants API is deprecated in favor of the Responses APINattachmentsmetadataextra_headersextra_query
extra_bodytimeoutc                   U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  [        SUS9[        UUUUS.[        R
                  5      [        UUUU	SS0S	9[        S
9$ )  
Create a message.

Args:
  content: The text contents of the message.

  role:
      The role of the entity that is creating the message. Allowed values include:

      - `user`: Indicates the message is sent by an actual user and should be used in
        most cases to represent user-generated messages.
      - `assistant`: Indicates the message is generated by the assistant. Use this
        value to insert messages from the assistant into the conversation.

  attachments: A list of files attached to the message, and the tools they should be added to.

  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, and
      querying for objects via API or the dashboard.

      Keys are strings with a maximum length of 64 characters. Values are strings with
      a maximum length of 512 characters.

  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=v2/threads/{thread_id}/messages	thread_idcontentroler9   r:   bearer_authTr;   r<   r=   r>   securitybodyoptionscast_to)
ValueError_postr   r   r   MessageCreateParamsr   r    
r-   rF   rH   rI   r9   r:   r;   r<   r=   r>   s
             r.   createMessages.create5   s    ^ WXaWdeff&QM<ORQzz9YO & #. (	 &99 )+'%'. %  
 	
r1   r;   r<   r=   r>   c                   U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  [        SX!S9[        UUUUSS0S	9[        S
9$ )  
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
rA   9Expected a non-empty value for `message_id` but received rB   rC   */threads/{thread_id}/messages/{message_id}rF   
message_idrJ   TrK   rO   rP   rQ   _getr   r   r    r-   r]   rF   r;   r<   r=   r>   s          r.   retrieveMessages.retrieve|   s    2 WXaWdeffXYcXfghh&QM<ORQyyFR[s(+'%'.   

 
	
r1   r:   r;   r<   r=   r>   c                  U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  [        SX!S9[        SU0[        R
                  5      [        UUUUSS	0S
9[        S9$ )y  
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, and
      querying for objects via API or the dashboard.

      Keys are strings with a maximum length of 64 characters. Values are strings with
      a maximum length of 512 characters.

  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
rA   rZ   rB   rC   r[   r\   r:   rJ   TrK   rM   )rQ   rR   r   r   r   MessageUpdateParamsr   r    r-   r]   rF   r:   r;   r<   r=   r>   s           r.   updateMessages.update   s    B WXaWdeffXYcXfghh&QM<ORQzzFR[s *h!79N9b9bc(+'%'.   
 	
r1   	afterbeforelimitorderrun_idr;   r<   r=   r>   c       	            U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  [        SUS9[        [           [        UUU	U
[        UUUUUS.[        R                  5      SS0S	9[        S
9$ 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,
      starting 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.

  run_id: Filter messages by the run ID that generated them.

  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
rA   rB   rC   rD   rE   )rl   rm   rn   ro   rp   rJ   T)r;   r<   r=   r>   queryrL   )pagerO   model)	rQ   _get_api_listr   r   r    r   r   r   MessageListParamsr-   rF   rl   rm   rn   ro   rp   r;   r<   r=   r>   s              r.   listMessages.list   s    ^ WXaWdeff&QM<ORQ!!9YO((+'%%!&"(!&!&"( (99	 (." ) " 
 	
r1   c                   U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  [        SX!S9[        UUUUSS0S	9[        S
9$ )  
Deletes 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
rA   rZ   rB   rC   r[   r\   rJ   TrK   r^   rQ   _deleter   r   r"   ra   s          r.   deleteMessages.delete"  s    2 WXaWdeffXYcXfghh&QM<ORQ||FR[s(+'%'. #  

 
	
r1    )returnr+   )r   r4   rF   strrH   z-Union[str, Iterable[MessageContentPartParam]]rI   zLiteral['user', 'assistant']r9   z;Optional[Iterable[message_create_params.Attachment]] | Omitr:   Optional[Metadata] | Omitr;   Headers | Noner<   Query | Noner=   Body | Noner>   'float | httpx.Timeout | None | NotGivenr   r    r]   r   rF   r   r;   r   r<   r   r=   r   r>   r   r   r    r]   r   rF   r   r:   r   r;   r   r<   r   r=   r   r>   r   r   r    )rF   r   rl   
str | Omitrm   r   rn   
int | Omitro   Literal['asc', 'desc'] | Omitrp   r   r;   r   r<   r   r=   r   r>   r   r   zSyncCursorPage[Message]r]   r   rF   r   r;   r   r<   r   r=   r   r>   r   r   r"   __name__
__module____qualname____firstlineno____doc__r   r/   r5   typing_extensions
deprecatedr   r   rU   rb   ri   ry   r   __static_attributes__r   r1   r.   r$   r$      s   >- - 3 3 !!"bc TX.2 )-$("&;DD
D
 ?	D

 +D
 QD
 ,D
 &D
 "D
  D
 9D
 
D
 dD
L !!"bc )-$("&;D'
'
 	'
 &'
 "'
  '
 9'
 
'
 d'
R !!"bc /3 )-$("&;D0
0
 	0

 ,0
 &0
 "0
  0
 90
 
0
 d0
d !!"bc
 !! /3! )-$("&;DF
F
 	F

 F
 F
 -F
 F
 &F
 "F
  F
 9F
 
!F
 dF
P !!"bc )-$("&;D'
'
 	'
 &'
 "'
  '
 9'
 
'
 d'
r1   c                  <   \ rS rSrSr\SS j5       r\SS j5       r\R                  " S5      \
\
SSS\S.                   SS jj5       r\R                  " S5      SSS\S	.             SS
 jj5       r\R                  " S5      \
SSS\S.               SS jj5       r\R                  " S5      \
\
\
\
\
SSS\S.	                     SS jj5       r\R                  " S5      SSS\S	.             SS jj5       rSrg)r%   iM  r(   c                    [        U 5      $ r*   )AsyncMessagesWithRawResponser,   s    r.   r/   AsyncMessages.with_raw_responseP  s     ,D11r1   c                    [        U 5      $ r3   )"AsyncMessagesWithStreamingResponser,   s    r.   r5   %AsyncMessages.with_streaming_responseZ  s     2$77r1   r7   Nr8   c                 #    U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  [        SUS9[        UUUUS.[        R
                  5      I Sh  vN [        UUUU	SS	0S
9[        S9I Sh  vN $  N! N7f)r@   rA   rB   rC   rD   rE   rG   NrJ   TrK   rM   )rQ   rR   r   r   r   rS   r   r    rT   s
             r.   rU   AsyncMessages.createc  s     ^ WXaWdeff&QM<ORQZZ9YO,& #. (	 &99  )+'%'. %   
 
 	

s$   ABB 
B;B<BBrW   c                  #    U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  [        SX!S9[        UUUUSS0S	9[        S
9I Sh  vN $  N7f)rY   rA   rZ   rB   rC   r[   r\   rJ   TrK   r^   Nr_   ra   s          r.   rb   AsyncMessages.retrieve  s     2 WXaWdeffXYcXfghh&QM<ORQYYFR[s(+'%'.   

 

 
	
 

   A)A2+A0,A2rd   c               2  #    U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  [        SX!S9[        SU0[        R
                  5      I Sh  vN [        UUUUS	S
0S9[        S9I Sh  vN $  N! N7f)rf   rA   rZ   rB   rC   r[   r\   r:   NrJ   TrK   rM   )rQ   rR   r   r   r   rg   r   r    rh   s           r.   ri   AsyncMessages.update  s     B WXaWdeffXYcXfghh&QM<ORQZZFR[s,j(-CEZEnEnoo(+'%'.    
 
 	
o
s$   A/B1B
2BBBBrk   c       	            U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  [        SUS9[        [           [        UUU	U
[        UUUUUS.[        R                  5      SS0S	9[        S
9$ rr   )	rQ   rv   r   r   r    r   r   r   rw   rx   s              r.   ry   AsyncMessages.list  s    ^ WXaWdeff&QM<ORQ!!9YO )(+'%%!&"(!&!&"( (99	 (." ) " 
 	
r1   c                  #    U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  [        SX!S9[        UUUUSS0S	9[        S
9I Sh  vN $  N7f)r|   rA   rZ   rB   rC   r[   r\   rJ   TrK   r^   Nr}   ra   s          r.   r   AsyncMessages.deleteP  s     2 WXaWdeffXYcXfghh&QM<ORQ\\FR[s(+'%'. # " 

 

 
	
 

r   r   )r   r   )r   r   r   r   r   )rF   r   rl   r   rm   r   rn   r   ro   r   rp   r   r;   r   r<   r   r=   r   r>   r   r   z1AsyncPaginator[Message, AsyncCursorPage[Message]]r   r   r   r1   r.   r%   r%   M  s   >2 2 8 8 !!"bc TX.2 )-$("&;DD
D
 ?	D

 +D
 QD
 ,D
 &D
 "D
  D
 9D
 
D
 dD
L !!"bc )-$("&;D'
'
 	'
 &'
 "'
  '
 9'
 
'
 d'
R !!"bc /3 )-$("&;D0
0
 	0

 ,0
 &0
 "0
  0
 90
 
0
 d0
d !!"bc
 !! /3! )-$("&;DF
F
 	F

 F
 F
 -F
 F
 &F
 "F
  F
 9F
 
;F
 dF
P !!"bc )-$("&;D'
'
 	'
 &'
 "'
  '
 9'
 
'
 d'
r1   c                      \ rS rSrSS jrSrg)r+   i{  c                   Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        g N)	_messagesr	   to_raw_response_wrapperrU   rb   ri   ry   r   r-   messagess     r.   __init__ MessagesWithRawResponse.__init__|  s    ! 44 	 44!! 	 44 	 44 		 44 	r1   r   rU   r   ry   rb   ri   Nr   r$   r   Noner   r   r   r   r   r   r   r1   r.   r+   r+   {      
r1   r+   c                      \ rS rSrSS jrSrg)r   i  c                   Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        g r   )r   r	   async_to_raw_response_wrapperrU   rb   ri   ry   r   r   s     r.   r   %AsyncMessagesWithRawResponse.__init__  s    ! :: 	 ::!! 	 :: 	 :: 		 :: 	r1   r   Nr   r%   r   r   r   r   r1   r.   r   r     r   r1   r   c                      \ rS rSrSS jrSrg)r4   i  c                   Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR
                  5      U l        [        UR                  5      U l        g r   )r   r   rU   rb   ri   ry   r   r   s     r.   r   &MessagesWithStreamingResponse.__init__  s    ! ) 	 )!! 	 ) 	 ) 		 ) 	r1   r   Nr   r   r   r1   r.   r4   r4     r   r1   r4   c                      \ rS rSrSS jrSrg)r   i  c                   Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR
                  5      U l        [        UR                  5      U l        g r   )r   r   rU   rb   ri   ry   r   r   s     r.   r   +AsyncMessagesWithStreamingResponse.__init__  s    ! / 	 /!! 	 / 	 / 		 / 	r1   r   Nr   r   r   r1   r.   r   r     r   r1   r   )8
__future__r   r   typingr   r   r   r   httpx r	   _typesr
   r   r   r   r   r   r   _utilsr   r   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r   types.beta.threadsr   r   r   types.beta.threads.messager    types.shared_params.metadatar!   "types.beta.threads.message_deletedr"   -types.beta.threads.message_content_part_paramr#   __all__r$   r%   r+   r   r4   r   r   r1   r.   <module>r      s    #  , , %  ! L L L L L ' ; Z : e d 2 5 A U
'k
 k
\	k
$ k
\	
 
>
 
>
 
>
 
r1   