
    _j1r                       S SK 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  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,  SSK-J.r.  SS/r/ " S S\5      r0 " S S\5      r1 " S S5      r2 " S S5      r3 " S S5      r4 " S S5      r5g)    )annotations)IterableN   )_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)SyncPage	AsyncPage)AnthropicError)AsyncPaginatormake_request_options)batch_list_paramsbatch_create_params)JSONLDecoderAsyncJSONLDecoder)MessageBatch)DeletedMessageBatch)MessageBatchIndividualResponse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    Y/home/rurouni/.local/lib/python3.13/site-packages/anthropic/resources/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    r+   with_streaming_responseBatches.with_streaming_response&   s     ,D11r.   Nextra_headersextra_query
extra_bodytimeoutc               r    U R                  S[        SU0[        R                  5      [	        X#XES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.

  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
/v1/messages/batchesrequestsr4   bodyoptionscast_to)_postr   r   BatchCreateParamsr   r   r*   r<   r5   r6   r7   r8   s         r+   createBatches.create/   sG    B zz" *h!79L9^9^_(+Q[ !  
 	
r.   c          
     x    U(       d  [        SU< 35      eU R                  [        SUS9[        X#XES9[        S9$ )b  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.

  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 '/v1/messages/batches/{message_batch_id}message_batch_idr4   r?   r@   
ValueError_getr   r   r   r*   rK   r5   r6   r7   r8   s         r+   retrieveBatches.retrieveY   sQ    >  ^_o^rsttyyCVfg(+Q[ !  
 	
r.   after_id	before_idlimitr5   r6   r7   r8   c                   U R                  S[        [           [        UUUU[	        UUUS.[
        R                  5      S9[        S9$ ab  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`.

  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;   )rT   rU   rV   )r5   r6   r7   r8   query)pager?   model)_get_api_listr   r   r   r   r   BatchListParamsr*   rT   rU   rV   r5   r6   r7   r8   s           r+   listBatches.list   sb    P !!",'(+'%%$,%.!&
 &55 # " 
 	
r.   c          
     x    U(       d  [        SU< 35      eU R                  [        SUS9[        X#XES9[        S9$ )R  
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.

  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
rH   rI   rJ   r4   rL   rN   _deleter   r   r    rP   s         r+   deleteBatches.delete   sQ    >  ^_o^rstt||CVfg(+Q[ (  
 	
r.   c          
     x    U(       d  [        SU< 35      eU R                  [        SUS9[        X#XES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.

  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
rH   ./v1/messages/batches/{message_batch_id}/cancelrJ   r4   rL   rN   rA   r   r   r   rP   s         r+   cancelBatches.cancel   sR    J  ^_o^rsttzzJ]mn(+Q[ !  
 	
r.   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U R                  [        UR                  US9[        X#XES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.

  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
rH   rJ   BNo `results_url` for the given batch; Has it finished processing? Acceptapplication/binaryr4   Tr?   r@   stream)
rN   rQ   results_urlr   processing_statusrO   r   r   r   r!   r*   rK   r5   r6   r7   r8   batchs          r+   resultsBatches.results  s    @  ^_o^rstt/?@   TUZUlUlTmn  "#7QM<ORQyy%++>NO(+Q[ !!?@  
 	
r.    )returnr(   )r{   r1   r<   z%Iterable[batch_create_params.Request]r5   Headers | Noner6   Query | Noner7   Body | Noner8   'float | httpx.Timeout | None | NotGivenr{   r   rK   strr5   r}   r6   r~   r7   r   r8   r   r{   r   )rT   
str | OmitrU   r   rV   
int | Omitr5   r}   r6   r~   r7   r   r8   r   r{   zSyncPage[MessageBatch]rK   r   r5   r}   r6   r~   r7   r   r8   r   r{   r    )rK   r   r5   r}   r6   r~   r7   r   r8   r   r{   z,JSONLDecoder[MessageBatchIndividualResponse]__name__
__module____qualname____firstlineno__r   r,   r2   r   rD   rQ   r   r_   re   rk   rx   __static_attributes__rz   r.   r+   r"   r"      s#   , , 2 2 )-$("&;D(
 8(
 &(
 "(
  (
 9(
 
(
` )-$("&;D'
'
 &'
 "'
  '
 9'
 
'
X  $ $  )-$("&;D:
 :
 	:

 :
 &:
 ":
  :
 9:
 
 :
D )-$("&;D'
'
 &'
 "'
  '
 9'
 
'
^ )-$("&;D-
-
 &-
 "-
  -
 9-
 
-
j )-$("&;D1
1
 &1
 "1
  1
 91
 
61
 1
r.   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#   iJ  c                    [        U 5      $ r'   )AsyncBatchesWithRawResponser)   s    r+   r,   AsyncBatches.with_raw_responseK  s     +400r.   c                    [        U 5      $ r0   )!AsyncBatchesWithStreamingResponser)   s    r+   r2   $AsyncBatches.with_streaming_responseU  s     166r.   Nr4   c                  #    U R                  S[        SU0[        R                  5      I Sh  vN [	        X#XES9[
        S9I Sh  vN $  N N7f)r:   r;   r<   Nr4   r=   )rA   r   r   rB   r   r   rC   s         r+   rD   AsyncBatches.create^  sZ     B ZZ",j(-CEXEjEjkk(+Q[ !   
 
 	
k
s!   ,AA
AAAAc          
        #    U(       d  [        SU< 35      eU R                  [        SUS9[        X#XES9[        S9I Sh  vN $  N7f)rG   rH   rI   rJ   r4   rL   NrM   rP   s         r+   rQ   AsyncBatches.retrieve  s^     >  ^_o^rsttYYCVfg(+Q[ !  
 
 	
 
   ?AAArS   c                   U R                  S[        [           [        UUUU[	        UUUS.[
        R                  5      S9[        S9$ rX   )r\   r   r   r   r   r   r]   r^   s           r+   r_   AsyncBatches.list  sb    P !!"<((+'%%$,%.!&
 &55 # " 
 	
r.   c          
        #    U(       d  [        SU< 35      eU R                  [        SUS9[        X#XES9[        S9I Sh  vN $  N7f)rb   rH   rI   rJ   r4   rL   Nrc   rP   s         r+   re   AsyncBatches.delete  s^     >  ^_o^rstt\\CVfg(+Q[ ( " 
 
 	
 
r   c          
        #    U(       d  [        SU< 35      eU R                  [        SUS9[        X#XES9[        S9I Sh  vN $  N7f)rh   rH   ri   rJ   r4   rL   Nrj   rP   s         r+   rk   AsyncBatches.cancel  s_     J  ^_o^rsttZZJ]mn(+Q[ !   
 
 	
 
r   c          
     Z  #    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U R                  [        UR                  US9[        X#XES9[        [           SS	9I Sh  vN $  N{ N7f)
rn   rH   rJ   Nro   rp   rq   r4   Trr   )
rN   rQ   rt   r   ru   rO   r   r   r   r!   rv   s          r+   rx   AsyncBatches.resultsE  s     @  ^_o^rsttmm5EmFF   TUZUlUlTmn  "#7QM<ORQYY%++>NO(+Q[ &&DE  
 
 	
 G
s"   )B+B'A6B+"B)#B+)B+rz   )r{   r   )r{   r   r|   r   )rT   r   rU   r   rV   r   r5   r}   r6   r~   r7   r   r8   r   r{   z5AsyncPaginator[MessageBatch, AsyncPage[MessageBatch]]r   )rK   r   r5   r}   r6   r~   r7   r   r8   r   r{   z1AsyncJSONLDecoder[MessageBatchIndividualResponse]r   rz   r.   r+   r#   r#   J  s#   1 1 7 7 )-$("&;D(
 8(
 &(
 "(
  (
 9(
 
(
` )-$("&;D'
'
 &'
 "'
  '
 9'
 
'
X  $ $  )-$("&;D:
 :
 	:

 :
 &:
 ":
  :
 9:
 
?:
D )-$("&;D'
'
 &'
 "'
  '
 9'
 
'
^ )-$("&;D-
-
 &-
 "-
  -
 9-
 
-
j )-$("&;D1
1
 &1
 "1
  1
 91
 
;1
 1
r.   c                      \ rS rSrSS jrSrg)r(   iy  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)_batchesr   to_raw_response_wrapperrD   rQ   r_   re   rk   r*   batchess     r+   __init__BatchesWithRawResponse.__init__z  s    &>>NN
 )@@
 %<<LL
	 '>>NN
 '>>NN
r.   r   rk   rD   re   r_   rQ   Nr   r"   r{   Noner   r   r   r   r   r   rz   r.   r+   r(   r(   y      
r.   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_wrapperrD   rQ   r_   re   rk   r   s     r+   r   $AsyncBatchesWithRawResponse.__init__  s    &DDNN
 )FF
 %BBLL
	 'DDNN
 'DDNN
r.   r   Nr   r#   r{   r   r   rz   r.   r+   r   r     r   r.   r   c                      \ rS rSrSS jrSrg)r1   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   rD   rQ   r_   re   rk   r   s     r+   r   %BatchesWithStreamingResponse.__init__  sp    2NN
 5
 1LL
	 3NN
 3NN
r.   r   Nr   r   rz   r.   r+   r1   r1     r   r.   r1   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   rD   rQ   r_   re   rk   r   s     r+   r   *AsyncBatchesWithStreamingResponse.__init__  sp    8NN
 ;
 7LL
	 9NN
 9NN
r.   r   Nr   r   rz   r.   r+   r   r     r   r.   r   )6
__future__r   typingr   httpx r   _typesr   r   r	   r
   r   r   r   _utilsr   r   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _exceptionsr   _base_clientr   r   types.messagesr   r   _decoders.jsonlr   r   types.messages.message_batchr   $types.messages.deleted_message_batchr    0types.messages.message_batch_individual_responser!   __all__r"   r#   r(   r   r1   r   rz   r.   r+   <module>r      s    #     K K K K K & : Y - ) @ D > 8 G ^n
%l
o l
^	l
# l
^	
 
*
 
*
 
*
 
r.   