
    4RjJ                       d dl mZ d dl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mZmZ dd
l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, ddl-m.Z. ddl/m0Z0 ddgZ1 G d de       Z2 G d de!      Z3 G d d      Z4 G d d      Z5 G d d      Z6 G d d      Z7y)    )annotations)List)chainN   )_legacy_response   )EventsAsyncEventsEventsWithRawResponseAsyncEventsWithRawResponseEventsWithStreamingResponse AsyncEventsWithStreamingResponse)BodyOmitQueryHeadersNotGivenomit	not_given)is_givenpath_templatemaybe_transformstrip_not_given)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncPageCursorAsyncPageCursor)AsyncPaginatormake_request_options)thread_list_params)AnthropicBetaParam)BetaManagedAgentsSessionThreadThreadsAsyncThreadsc                      e Zd Zed
d       Zedd       Zedd       Zeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	eeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ
eddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Zy)r&   c                ,    t        | j                        S N)r	   _clientselfs    y/var/www/html/meridian/meridian-ai/venv/lib/python3.12/site-packages/anthropic/resources/beta/sessions/threads/threads.pyeventszThreads.events"   s    dll##    c                    t        |       S a  
        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/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
        )ThreadsWithRawResponser,   s    r.   with_raw_responsezThreads.with_raw_response&   s     &d++r0   c                    t        |       S z
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
        )ThreadsWithStreamingResponser,   s    r.   with_streaming_responsezThreads.with_streaming_response0   s     ,D11r0   Nbetasextra_headersextra_query
extra_bodytimeoutc          
     F   |st        d|      |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d||      t        ||||	      t        
      S )  
        Get Session Thread

        Args:
          betas: Optional header to specify the beta version(s) you want to use.

          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
        9Expected a non-empty value for `session_id` but received 8Expected a non-empty value for `thread_id` but received anthropic-beta,c              3  2   K   | ]  }t        |        y wr*   str.0es     r.   	<genexpr>z#Threads.retrieve.<locals>.<genexpr>[        5Lc!f5L   managed-agents-2026-04-017/v1/sessions/{session_id}/threads/{thread_id}?beta=true
session_id	thread_idr;   r<   r=   r>   optionscast_to

ValueErrorr   r   joinr   r   _getr   r"   r%   r-   rR   rQ   r:   r;   r<   r=   r>   s           r.   retrievezThreads.retrieve9   s    6 XYcXfghhWXaWdeff	
$ '*hhu5Le5LOjNk/l&m"	
 "	
 *+F`=K^\^`yyIV`lu )+Q[el 3  
 	
r0   limitpager:   r;   r<   r=   r>   c               t   |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d|      t        t           t        ||||t        ||dt        j                        	      t        
      S )6  List Session Threads

        Args:
          limit: Maximum results per page.

        Defaults to 1000.

          page: Opaque pagination cursor from a previous response's next_page. Forward-only.

          betas: Optional header to specify the beta version(s) you want to use.

          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   rC   rD   c              3  2   K   | ]  }t        |        y wr*   rF   rH   s     r.   rK   zThreads.list.<locals>.<genexpr>   rL   rM   rN   +/v1/sessions/{session_id}/threads?beta=truerQ   r^   r_   r;   r<   r=   r>   queryr_   rU   model)rX   r   r   rY   r   r   _get_api_listr   r   r%   r"   r   r#   ThreadListParams	r-   rQ   r^   r_   r:   r;   r<   r=   r>   s	            r.   listzThreads.listm   s    B XYcXfghh	
$ '*hhu5Le5LOjNk/l&m"	
 "	
 *+F`=K^\^`!!GT^_ >?(+'%%!& $ '77 1! " 
 	
r0   c          
     F   |st        d|      |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d||      t        ||||	      t        
      S )  
        Archive Session Thread

        Args:
          betas: Optional header to specify the beta version(s) you want to use.

          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   c              3  2   K   | ]  }t        |        y wr*   rF   rH   s     r.   rK   z"Threads.archive.<locals>.<genexpr>   rL   rM   rN   ?/v1/sessions/{session_id}/threads/{thread_id}/archive?beta=truerP   rS   rT   
rX   r   r   rY   r   r   _postr   r"   r%   r[   s           r.   archivezThreads.archive   s    6 XYcXfghhWXaWdeff	
$ '*hhu5Le5LOjNk/l&m"	
 "	
 *+F`=K^\^`zzQ%#
 )+Q[el 3  

 
	
r0   )returnr	   )ru   r3   )ru   r7   rR   rG   rQ   rG   r:   List[AnthropicBetaParam] | Omitr;   Headers | Noner<   Query | Noner=   Body | Noner>   'float | httpx.Timeout | None | NotGivenru   r%   )rQ   rG   r^   
int | Omitr_   
str | Omitr:   rw   r;   rx   r<   ry   r=   rz   r>   r{   ru   z.SyncPageCursor[BetaManagedAgentsSessionThread]__name__
__module____qualname__r   r/   r4   r8   r   r   r\   rm   rt    r0   r.   r&   r&   !   s   $ $ , , 2 2 26 )-$("&;D2
2
 	2

 /2
 &2
 "2
  2
 92
 
(2
p !15 )-$("&;D?
?
 	?

 ?
 /?
 &?
 "?
  ?
 9?
 
8?
L 26 )-$("&;D4
4
 	4

 /4
 &4
 "4
  4
 94
 
(4
r0   c                      e Zd Zed
d       Zedd       Zedd       Zeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	eeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ
eddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Zy)r'   c                ,    t        | j                        S r*   )r
   r+   r,   s    r.   r/   zAsyncThreads.events   s    4<<((r0   c                    t        |       S r2   )AsyncThreadsWithRawResponser,   s    r.   r4   zAsyncThreads.with_raw_response   s     +400r0   c                    t        |       S r6   )!AsyncThreadsWithStreamingResponser,   s    r.   r8   z$AsyncThreads.with_streaming_response   s     166r0   Nr9   c          
     b  K   |st        d|      |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d||      t        ||||	      t        
       d{   S 7 w)r@   rA   rB   rC   rD   c              3  2   K   | ]  }t        |        y wr*   rF   rH   s     r.   rK   z(AsyncThreads.retrieve.<locals>.<genexpr>  rL   rM   rN   rO   rP   rS   rT   NrW   r[   s           r.   r\   zAsyncThreads.retrieve   s     6 XYcXfghhWXaWdeff	
$ '*hhu5Le5LOjNk/l&m"	
 "	
 *+F`=K^\^`YYIV`lu )+Q[el 3  
 
 	
 
   B&B/(B-)B/r]   c               t   |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d|      t        t           t        ||||t        ||dt        j                        	      t        
      S )ra   rA   rC   rD   c              3  2   K   | ]  }t        |        y wr*   rF   rH   s     r.   rK   z$AsyncThreads.list.<locals>.<genexpr>W  rL   rM   rN   rc   rd   re   rf   rh   )rX   r   r   rY   r   r   rj   r   r    r%   r"   r   r#   rk   rl   s	            r.   rm   zAsyncThreads.list1  s    B XYcXfghh	
$ '*hhu5Le5LOjNk/l&m"	
 "	
 *+F`=K^\^`!!GT^_ !?@(+'%%!& $ '77 1! " 
 	
r0   c          
     b  K   |st        d|      |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d||      t        ||||	      t        
       d{   S 7 w)ro   rA   rB   rC   rD   c              3  2   K   | ]  }t        |        y wr*   rF   rH   s     r.   rK   z'AsyncThreads.archive.<locals>.<genexpr>  rL   rM   rN   rq   rP   rS   rT   Nrr   r[   s           r.   rt   zAsyncThreads.archiver  s     6 XYcXfghhWXaWdeff	
$ '*hhu5Le5LOjNk/l&m"	
 "	
 *+F`=K^\^`ZZQ%#
 )+Q[el 3   

 

 
	
 

r   )ru   r
   )ru   r   )ru   r   rv   )rQ   rG   r^   r|   r_   r}   r:   rw   r;   rx   r<   ry   r=   rz   r>   r{   ru   z_AsyncPaginator[BetaManagedAgentsSessionThread, AsyncPageCursor[BetaManagedAgentsSessionThread]]r~   r   r0   r.   r'   r'      s   ) ) 1 1 7 7 26 )-$("&;D2
2
 	2

 /2
 &2
 "2
  2
 92
 
(2
p !15 )-$("&;D?
?
 	?

 ?
 /?
 &?
 "?
  ?
 9?
 
i?
L 26 )-$("&;D4
4
 	4

 /4
 &4
 "4
  4
 94
 
(4
r0   c                  &    e Zd ZddZedd       Zy)r3   c                    || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        y r*   )_threadsr   to_raw_response_wrapperr\   rm   rt   r-   threadss     r.   __init__zThreadsWithRawResponse.__init__  sZ    (@@
 %<<LL
	 (??OO
r0   c                @    t        | j                  j                        S r*   )r   r   r/   r,   s    r.   r/   zThreadsWithRawResponse.events  s    $T]]%9%9::r0   Nr   r&   ru   None)ru   r   r   r   r   r   r   r/   r   r0   r.   r3   r3     s    
 ; ;r0   r3   c                  &    e Zd ZddZedd       Zy)r   c                    || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        y r*   )r   r   async_to_raw_response_wrapperr\   rm   rt   r   s     r.   r   z$AsyncThreadsWithRawResponse.__init__  sZ    (FF
 %BBLL
	 (EEOO
r0   c                @    t        | j                  j                        S r*   )r   r   r/   r,   s    r.   r/   z"AsyncThreadsWithRawResponse.events  s    )$--*>*>??r0   Nr   r'   ru   r   )ru   r   r   r   r0   r.   r   r     s    
 @ @r0   r   c                  &    e Zd ZddZedd       Zy)r7   c                    || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        y r*   )r   r   r\   rm   rt   r   s     r.   r   z%ThreadsWithStreamingResponse.__init__  sH    4
 1LL
	 4OO
r0   c                @    t        | j                  j                        S r*   )r   r   r/   r,   s    r.   r/   z#ThreadsWithStreamingResponse.events  s    *4==+?+?@@r0   Nr   )ru   r   r   r   r0   r.   r7   r7     s    
 A Ar0   r7   c                  &    e Zd ZddZedd       Zy)r   c                    || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        y r*   )r   r   r\   rm   rt   r   s     r.   r   z*AsyncThreadsWithStreamingResponse.__init__  sH    :
 7LL
	 :OO
r0   c                @    t        | j                  j                        S r*   )r   r   r/   r,   s    r.   r/   z(AsyncThreadsWithStreamingResponse.events  s    /0D0DEEr0   Nr   )ru   r   r   r   r0   r.   r   r     s    
 F Fr0   r   )8
__future__r   typingr   	itertoolsr   httpx r   r/   r	   r
   r   r   r   r   _typesr   r   r   r   r   r   r   _utilsr   r   r   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r    _base_clientr!   r"   types.beta.sessionsr#   types.anthropic_beta_paramr$   6types.beta.sessions.beta_managed_agents_session_threadr%   __all__r&   r'   r3   r   r7   r   r   r0   r.   <module>r      s    #    "  N M M Q Q ( < [ ; B 7 > fn
%A
o A
HA
# A
H; ;&@ @&A A&F Fr0   