
    _j}                       S SK Jr  S SK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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$  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/  SSK0J1r1  SSK2J3r3  SSK4J5r5  SS/r6 " S S\5      r7 " S S\5      r8 " S S5      r9 " S S5      r: " S S5      r; " S S 5      r<g)!    )annotations)ListIterable)chainN   )_legacy_response)BodyOmitQueryHeadersNotGivenomit	not_given)is_givenpath_templatemaybe_transformstrip_not_givenasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncPage	AsyncPage)AnthropicError)AsyncPaginatormake_request_options)JSONLDecoderAsyncJSONLDecoder)batch_list_paramsbatch_create_params)AnthropicBetaParam)BetaMessageBatch)BetaDeletedMessageBatch)"BetaMessageBatchIndividualResponseBatchesAsyncBatchesc            	         \ rS rSr\SS j5       r\SS j5       r\SSS\S.             SS jjr	\SSS\S.             SS jjr
\\\\SSS\S.                 SS	 jjr\SSS\S.             SS
 jjr\SSS\S.             SS jjr\SSS\S.             SS jjrSrg)r'      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/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
)BatchesWithRawResponseselfs    ^/home/rurouni/.local/lib/python3.13/site-packages/anthropic/resources/beta/messages/batches.pywith_raw_responseBatches.with_raw_response   s     &d++    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/anthropics/anthropic-sdk-python#with_streaming_response
)BatchesWithStreamingResponser.   s    r0   with_streaming_responseBatches.with_streaming_response(   s     ,D11r3   Nbetasextra_headersextra_query
extra_bodytimeoutc               2   0 [        S[        U5      (       a#  SR                  [        S U 5       S/5      5      O[        05      EU=(       d    0 EnSS0U=(       d    0 EnU R                  S[        SU0[        R                  5      [        X4XVS9[        S9$ )	(  
Send a batch of Message creation requests.

The Message Batches API can be used to process multiple Messages API requests at
once. Once a Message Batch is created, it begins processing immediately. Batches
can take up to 24 hours to complete.

Learn more about the Message Batches API in our
[user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

Args:
  requests: List of requests for prompt completion. Each is an individual request to create
      a Message.

  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
anthropic-beta,c              3  8   #    U  H  n[        U5      v   M     g 7fNstr.0es     r0   	<genexpr>!Batches.create.<locals>.<genexpr>X        5Lec!ffe   message-batches-2024-09-24/v1/messages/batches?beta=truerequestsr;   r<   r=   r>   bodyoptionscast_to)r   r   joinr   r   _postr   r"   BatchCreateParamsr   r$   r/   rP   r:   r;   r<   r=   r>   s          r0   createBatches.create1   s    H	
$ '*hhu5Le5LOkNl/m&n"	
 "	
 *+GaML_]_azz, *h!79L9^9^_(+Q[ %  
 	
r3   c          
     8   U(       d  [        SU< 35      e0 [        S[        U5      (       a#  SR                  [	        S U 5       S/5      5      O[
        05      EU=(       d    0 EnSS0U=(       d    0 EnU R                  [        SUS9[        X4XVS9[        S	9$ )
  This endpoint is idempotent and can be used to poll for Message Batch
completion.

To access the results of a Message Batch, make a request to the
`results_url` field in the response.

Learn more about the Message Batches API in our
[user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

Args:
  message_batch_id: ID of the Message Batch.

  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
?Expected a non-empty value for `message_batch_id` but received rA   rB   c              3  8   #    U  H  n[        U5      v   M     g 7frD   rE   rG   s     r0   rJ   #Batches.retrieve.<locals>.<genexpr>   rL   rM   rN   1/v1/messages/batches/{message_batch_id}?beta=truemessage_batch_idrQ   rT   rU   

ValueErrorr   r   rV   r   r   _getr   r   r$   r/   rc   r:   r;   r<   r=   r>   s          r0   retrieveBatches.retrievei   s    D  ^_o^rstt	
$ '*hhu5Le5LOkNl/m&n"	
 "	
 *+GaML_]_ayyM`pq(+Q[ %  
 	
r3   after_id	before_idlimitr:   r;   r<   r=   r>   c               R   0 [        S[        U5      (       a#  SR                  [        S U 5       S/5      5      O[        05      EU=(       d    0 EnSS0U=(       d    0 EnU R                  S[        [           [        UUUU[        UUUS.[        R                  5      S9[        S9$ )	  List all Message Batches within a Workspace.

Most recently created batches are
returned first.

Learn more about the Message Batches API in our
[user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

Args:
  after_id: ID of the object to use as a cursor for pagination. When provided, returns the
      page of results immediately after this object.

  before_id: ID of the object to use as a cursor for pagination. When provided, returns the
      page of results immediately before this object.

  limit: Number of items to return per page.

      Defaults to `20`. Ranges from `1` to `1000`.

  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   c              3  8   #    U  H  n[        U5      v   M     g 7frD   rE   rG   s     r0   rJ   Batches.list.<locals>.<genexpr>   rL   rM   rN   rO   rl   rm   rn   r;   r<   r=   r>   querypagerT   model)r   r   rV   r   r   _get_api_listr   r$   r   r   r!   BatchListParams	r/   rl   rm   rn   r:   r;   r<   r=   r>   s	            r0   listBatches.list   s    V	
$ '*hhu5Le5LOkNl/m&n"	
 "	
 *+GaML_]_a!!,*+(+'%%$,%.!&
 &55 ## " 
 	
r3   c          
     8   U(       d  [        SU< 35      e0 [        S[        U5      (       a#  SR                  [	        S U 5       S/5      5      O[
        05      EU=(       d    0 EnSS0U=(       d    0 EnU R                  [        SUS9[        X4XVS9[        S	9$ )
  
Delete a Message Batch.

Message Batches can only be deleted once they've finished processing. If you'd
like to delete an in-progress batch, you must first cancel it.

Learn more about the Message Batches API in our
[user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

Args:
  message_batch_id: ID of the Message Batch.

  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
r^   rA   rB   c              3  8   #    U  H  n[        U5      v   M     g 7frD   rE   rG   s     r0   rJ   !Batches.delete.<locals>.<genexpr>  rL   rM   rN   ra   rb   rQ   rd   
rf   r   r   rV   r   r   _deleter   r   r%   rh   s          r0   deleteBatches.delete   s    D  ^_o^rstt	
$ '*hhu5Le5LOkNl/m&n"	
 "	
 *+GaML_]_a||M`pq(+Q[ ,  
 	
r3   c          
     8   U(       d  [        SU< 35      e0 [        S[        U5      (       a#  SR                  [	        S U 5       S/5      5      O[
        05      EU=(       d    0 EnSS0U=(       d    0 EnU R                  [        SUS9[        X4XVS9[        S	9$ )
  Batches may be canceled any time before processing ends.

Once cancellation is
initiated, the batch enters a `canceling` state, at which time the system may
complete any in-progress, non-interruptible requests before finalizing
cancellation.

The number of canceled requests is specified in `request_counts`. To determine
which requests were canceled, check the individual results within the batch.
Note that cancellation may not result in any canceled requests if they were
non-interruptible.

Learn more about the Message Batches API in our
[user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

Args:
  message_batch_id: ID of the Message Batch.

  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
r^   rA   rB   c              3  8   #    U  H  n[        U5      v   M     g 7frD   rE   rG   s     r0   rJ   !Batches.cancel.<locals>.<genexpr>N  rL   rM   rN   8/v1/messages/batches/{message_batch_id}/cancel?beta=truerb   rQ   rd   
rf   r   r   rV   r   r   rW   r   r   r$   rh   s          r0   cancelBatches.cancel!  s    P  ^_o^rstt	
$ '*hhu5Le5LOkNl/m&n"	
 "	
 *+GaML_]_azzJ]m )+Q[ %  
 	
r3   c          
        U(       d  [        SU< 35      eU R                  US9nUR                  (       d  [        SUR                   35      eSS0U=(       d    0 En0 [        S[        U5      (       a#  SR                  [        S U 5       S	/5      5      O[        05      EU=(       d    0 EnSS	0U=(       d    0 EnU R                  [        UR                  US9[        X4XVS
9[        [           SS9$ )  
Streams the results of a Message Batch as a `.jsonl` file.

Each line in the file is a JSON object containing the result of a single request
in the Message Batch. Results are not guaranteed to be in the same order as
requests. Use the `custom_id` field to match results to requests.

Learn more about the Message Batches API in our
[user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

Args:
  message_batch_id: ID of the Message Batch.

  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
r^   rb   BNo `results_url` for the given batch; Has it finished processing? Acceptapplication/binaryrA   rB   c              3  8   #    U  H  n[        U5      v   M     g 7frD   rE   rG   s     r0   rJ   "Batches.results.<locals>.<genexpr>  rL   rM   rN   rQ   TrT   rU   stream)rf   ri   results_urlr   processing_statusr   r   rV   r   r   rg   r   r   r   r&   r/   rc   r:   r;   r<   r=   r>   batchs           r0   resultsBatches.results`  s   F  ^_o^rstt/?@   TUZUlUlTmn  "#7QM<ORQ	
$ '*hhu5Le5LOkNl/m&n"	
 "	
 *+GaML_]_ayy%++>NO(+Q[ !!CD  
 	
r3    )returnr-   )r   r6   rP   z%Iterable[batch_create_params.Request]r:   List[AnthropicBetaParam] | Omitr;   Headers | Noner<   Query | Noner=   Body | Noner>   'float | httpx.Timeout | None | NotGivenr   r$   rc   rF   r:   r   r;   r   r<   r   r=   r   r>   r   r   r$   )rl   
str | Omitrm   r   rn   
int | Omitr:   r   r;   r   r<   r   r=   r   r>   r   r   zSyncPage[BetaMessageBatch]rc   rF   r:   r   r;   r   r<   r   r=   r   r>   r   r   r%   )rc   rF   r:   r   r;   r   r<   r   r=   r   r>   r   r   z0JSONLDecoder[BetaMessageBatchIndividualResponse]__name__
__module____qualname____firstlineno__r   r1   r7   r   r   rZ   ri   r|   r   r   r   __static_attributes__r   r3   r0   r'   r'      s   , , 2 2 26 )-$("&;D6
 86
 /	6
 &6
 "6
  6
 96
 
6
x 26 )-$("&;D5
5
 /	5
 &5
 "5
  5
 95
 
5
t  $ $ 15 )-$("&;DH
 H
 	H

 H
 /H
 &H
 "H
  H
 9H
 
$H
\ 26 )-$("&;D5
5
 /	5
 &5
 "5
  5
 95
 
!5
v 26 )-$("&;D=
=
 /	=
 &=
 "=
  =
 9=
 
=
F 26 )-$("&;D?
?
 /	?
 &?
 "?
  ?
 9?
 
:?
 ?
r3   c            	         \ rS rSr\SS j5       r\SS j5       r\SSS\S.             SS jjr	\SSS\S.             SS jjr
\\\\SSS\S.                 SS	 jjr\SSS\S.             SS
 jjr\SSS\S.             SS jjr\SSS\S.             SS jjrSrg)r(   i  c                    [        U 5      $ r,   )AsyncBatchesWithRawResponser.   s    r0   r1   AsyncBatches.with_raw_response  s     +400r3   c                    [        U 5      $ r5   )!AsyncBatchesWithStreamingResponser.   s    r0   r7   $AsyncBatches.with_streaming_response  s     166r3   Nr9   c               b  #    0 [        S[        U5      (       a#  SR                  [        S U 5       S/5      5      O[        05      EU=(       d    0 EnSS0U=(       d    0 EnU R                  S[        SU0[        R                  5      I Sh  vN [        X4XVS9[        S	9I Sh  vN $  N N7f)
r@   rA   rB   c              3  8   #    U  H  n[        U5      v   M     g 7frD   rE   rG   s     r0   rJ   &AsyncBatches.create.<locals>.<genexpr>  rL   rM   rN   rO   rP   NrQ   rR   )r   r   rV   r   r   rW   r   r"   rX   r   r$   rY   s          r0   rZ   AsyncBatches.create  s     H	
$ '*hhu5Le5LOkNl/m&n"	
 "	
 *+GaML_]_aZZ,,j(-CEXEjEjkk(+Q[ %   
 
 	
k
s$   BB/B+
B/&B-'B/-B/c          
     T  #    U(       d  [        SU< 35      e0 [        S[        U5      (       a#  SR                  [	        S U 5       S/5      5      O[
        05      EU=(       d    0 EnSS0U=(       d    0 EnU R                  [        SUS9[        X4XVS9[        S	9I S
h  vN $  N7f)r]   r^   rA   rB   c              3  8   #    U  H  n[        U5      v   M     g 7frD   rE   rG   s     r0   rJ   (AsyncBatches.retrieve.<locals>.<genexpr>  rL   rM   rN   ra   rb   rQ   rd   Nre   rh   s          r0   ri   AsyncBatches.retrieve  s     D  ^_o^rstt	
$ '*hhu5Le5LOkNl/m&n"	
 "	
 *+GaML_]_aYYM`pq(+Q[ %  
 
 	
 
   BB(!B&"B(rk   c               R   0 [        S[        U5      (       a#  SR                  [        S U 5       S/5      5      O[        05      EU=(       d    0 EnSS0U=(       d    0 EnU R                  S[        [           [        UUUU[        UUUS.[        R                  5      S9[        S9$ )	rp   rA   rB   c              3  8   #    U  H  n[        U5      v   M     g 7frD   rE   rG   s     r0   rJ   $AsyncBatches.list.<locals>.<genexpr>S  rL   rM   rN   rO   rs   rt   rv   )r   r   rV   r   r   ry   r   r$   r   r   r!   rz   r{   s	            r0   r|   AsyncBatches.list%  s    V	
$ '*hhu5Le5LOkNl/m&n"	
 "	
 *+GaML_]_a!!,+,(+'%%$,%.!&
 &55 ## " 
 	
r3   c          
     T  #    U(       d  [        SU< 35      e0 [        S[        U5      (       a#  SR                  [	        S U 5       S/5      5      O[
        05      EU=(       d    0 EnSS0U=(       d    0 EnU R                  [        SUS9[        X4XVS9[        S	9I S
h  vN $  N7f)r   r^   rA   rB   c              3  8   #    U  H  n[        U5      v   M     g 7frD   rE   rG   s     r0   rJ   &AsyncBatches.delete.<locals>.<genexpr>  rL   rM   rN   ra   rb   rQ   rd   Nr   rh   s          r0   r   AsyncBatches.deleteo  s     D  ^_o^rstt	
$ '*hhu5Le5LOkNl/m&n"	
 "	
 *+GaML_]_a\\M`pq(+Q[ , " 
 
 	
 
r   c          
     T  #    U(       d  [        SU< 35      e0 [        S[        U5      (       a#  SR                  [	        S U 5       S/5      5      O[
        05      EU=(       d    0 EnSS0U=(       d    0 EnU R                  [        SUS9[        X4XVS9[        S	9I S
h  vN $  N7f)r   r^   rA   rB   c              3  8   #    U  H  n[        U5      v   M     g 7frD   rE   rG   s     r0   rJ   &AsyncBatches.cancel.<locals>.<genexpr>  rL   rM   rN   r   rb   rQ   rd   Nr   rh   s          r0   r   AsyncBatches.cancel  s     P  ^_o^rstt	
$ '*hhu5Le5LOkNl/m&n"	
 "	
 *+GaML_]_aZZJ]m )+Q[ %   
 
 	
 
r   c          
       #    U(       d  [        SU< 35      eU R                  US9I Sh  vN nUR                  (       d  [        SUR                   35      eSS0U=(       d    0 En0 [        S[        U5      (       a#  SR                  [        S	 U 5       S
/5      5      O[        05      EU=(       d    0 EnSS
0U=(       d    0 EnU R                  [        UR                  US9[        X4XVS9[        [           SS9I Sh  vN $  N N7f)r   r^   rb   Nr   r   r   rA   rB   c              3  8   #    U  H  n[        U5      v   M     g 7frD   rE   rG   s     r0   rJ   'AsyncBatches.results.<locals>.<genexpr>  rL   rM   rN   rQ   Tr   )rf   ri   r   r   r   r   r   rV   r   r   rg   r   r   r    r&   r   s           r0   r   AsyncBatches.results  s4    F  ^_o^rsttmm5EmFF   TUZUlUlTmn  "#7QM<ORQ	
$ '*hhu5Le5LOkNl/m&n"	
 "	
 *+GaML_]_aYY%++>NO(+Q[ &&HI  
 
 	
% G$
s"   )DDCDD	D	Dr   )r   r   )r   r   r   r   )rl   r   rm   r   rn   r   r:   r   r;   r   r<   r   r=   r   r>   r   r   z=AsyncPaginator[BetaMessageBatch, AsyncPage[BetaMessageBatch]]r   )rc   rF   r:   r   r;   r   r<   r   r=   r   r>   r   r   z5AsyncJSONLDecoder[BetaMessageBatchIndividualResponse]r   r   r3   r0   r(   r(     s   1 1 7 7 26 )-$("&;D6
 86
 /	6
 &6
 "6
  6
 96
 
6
x 26 )-$("&;D5
5
 /	5
 &5
 "5
  5
 95
 
5
t  $ $ 15 )-$("&;DH
 H
 	H

 H
 /H
 &H
 "H
  H
 9H
 
GH
\ 26 )-$("&;D5
5
 /	5
 &5
 "5
  5
 95
 
!5
v 26 )-$("&;D=
=
 /	=
 &=
 "=
  =
 9=
 
=
F 26 )-$("&;D?
?
 /	?
 &?
 "?
  ?
 9?
 
??
 ?
r3   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        [        R                  " UR                  5      U l        g rD   )	_batchesr   to_raw_response_wrapperrZ   ri   r|   r   r   r   r/   batchess     r0   __init__BatchesWithRawResponse.__init__(  s    &>>NN
 )@@
 %<<LL
	 '>>NN
 '>>NN
 (??OO
r3   r   r   rZ   r   r|   r   ri   Nr   r'   r   Noner   r   r   r   r   r   r   r3   r0   r-   r-   '      
r3   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        [        R                  " UR                  5      U l        g rD   )	r   r   async_to_raw_response_wrapperrZ   ri   r|   r   r   r   r   s     r0   r   $AsyncBatchesWithRawResponse.__init__@  s    &DDNN
 )FF
 %BBLL
	 'DDNN
 'DDNN
 (EEOO
r3   r   Nr   r(   r   r   r   r   r3   r0   r   r   ?  r   r3   r   c                      \ rS rSrSS jrSrg)r6   iW  c                H   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        [        UR                  5      U l        g rD   )r   r   rZ   ri   r|   r   r   r   r   s     r0   r   %BatchesWithStreamingResponse.__init__X  s    2NN
 5
 1LL
	 3NN
 3NN
 4OO
r3   r   Nr   r   r   r3   r0   r6   r6   W  r   r3   r6   c                      \ rS rSrSS jrSrg)r   io  c                H   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        [        UR                  5      U l        g rD   )r   r   rZ   ri   r|   r   r   r   r   s     r0   r   *AsyncBatchesWithStreamingResponse.__init__p  s    8NN
 ;
 7LL
	 9NN
 9NN
 :OO
r3   r   Nr   r   r   r3   r0   r   r   o  r   r3   r   )=
__future__r   typingr   r   	itertoolsr   httpx r   _typesr	   r
   r   r   r   r   r   _utilsr   r   r   r   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _exceptionsr   _base_clientr   r   _decoders.jsonlr   r    types.beta.messagesr!   r"   types.anthropic_beta_paramr#   &types.beta.messages.beta_message_batchr$   .types.beta.messages.beta_deleted_message_batchr%   :types.beta.messages.beta_message_batch_individual_responser&   __all__r'   r(   r-   r   r6   r   r   r3   r0   <module>r      s    # !   ! L L L g g ' ; Z . * A ? J = G V mn
%B
o B
JB
# B
J
 
0
 
0
 
0
 
r3   