
    ̺ip                       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  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      r/ " S S\5      r0 " S S5      r1 " S S5      r2 " S S5      r3 " S S5      r4g)    )annotations)IterableN   )_legacy_response)BodyOmitQueryHeadersNotGivenomit	not_given)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    c/var/www/piano.thomer.com/venv/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requestsr3   bodyoptionscast_to)_postr   r   BatchCreateParamsr   r   r)   r;   r4   r5   r6   r7   s         r*   createBatches.create/   sG    B zz" *h!79L9^9^_(+Q[ !  
 	
r-   c          
     n    U(       d  [        SU< 35      eU R                  SU 3[        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/r3   r>   r?   
ValueError_getr   r   r)   message_batch_idr4   r5   r6   r7   s         r*   retrieveBatches.retrieveY   sQ    >  ^_o^rsttyy#$4#56(+Q[ !  
 	
r-   after_id	before_idlimitr4   r5   r6   r7   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:   )rR   rS   rT   )r4   r5   r6   r7   query)pager>   model)_get_api_listr   r   r   r   r   BatchListParamsr)   rR   rS   rT   r4   r5   r6   r7   s           r*   listBatches.list   sb    P !!",'(+'%%$,%.!&
 &55 # " 
 	
r-   c          
     n    U(       d  [        SU< 35      eU R                  SU 3[        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
rG   rH   r3   rI   rK   _deleter   r   rM   s         r*   deleteBatches.delete   sQ    >  ^_o^rstt||#$4#56(+Q[ (  
 	
r-   c          
     p    U(       d  [        SU< 35      eU R                  SU S3[        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
rG   rH   /cancelr3   rI   rK   r@   r   r   rM   s         r*   cancelBatches.cancel   sT    J  ^_o^rsttzz#$4#5W=(+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                  [        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
rG   rN   BNo `results_url` for the given batch; Has it finished processing? Acceptapplication/binaryr3   Tr>   r?   stream)	rK   rO   results_urlr   processing_statusrL   r   r   r    r)   rN   r4   r5   r6   r7   batchs          r*   resultsBatches.results  s    @  ^_o^rstt/?@   TUZUlUlTmn  "#7QM<ORQyy(+Q[ !!?@  
 	
r-    )returnr'   )rz   r0   r;   z%Iterable[batch_create_params.Request]r4   Headers | Noner5   Query | Noner6   Body | Noner7   'float | httpx.Timeout | None | NotGivenrz   r   rN   strr4   r|   r5   r}   r6   r~   r7   r   rz   r   )rR   
str | OmitrS   r   rT   
int | Omitr4   r|   r5   r}   r6   r~   r7   r   rz   zSyncPage[MessageBatch]rN   r   r4   r|   r5   r}   r6   r~   r7   r   rz   r   )rN   r   r4   r|   r5   r}   r6   r~   r7   r   rz   z,JSONLDecoder[MessageBatchIndividualResponse]__name__
__module____qualname____firstlineno__r   r+   r1   r   rC   rO   r   r]   rc   ri   rw   __static_attributes__ry   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      $ r/   )!AsyncBatchesWithStreamingResponser(   s    r*   r1   $AsyncBatches.with_streaming_responseU  s     166r-   Nr3   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)r9   r:   r;   Nr3   r<   )r@   r   r   rA   r   r   rB   s         r*   rC   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 3[        X#XES9[        S9I Sh  vN $  N7f)rF   rG   rH   r3   rI   NrJ   rM   s         r*   rO   AsyncBatches.retrieve  s^     >  ^_o^rsttYY#$4#56(+Q[ !  
 
 	
 
   :AAArQ   c                   U R                  S[        [           [        UUUU[	        UUUS.[
        R                  5      S9[        S9$ rV   )rZ   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 3[        X#XES9[        S9I Sh  vN $  N7f)r`   rG   rH   r3   rI   Nra   rM   s         r*   rc   AsyncBatches.delete  s^     >  ^_o^rstt\\#$4#56(+Q[ ( " 
 
 	
 
r   c          
        #    U(       d  [        SU< 35      eU R                  SU S3[        X#XES9[        S9I Sh  vN $  N7f)rf   rG   rH   rg   r3   rI   Nrh   rM   s         r*   ri   AsyncBatches.cancel  sa     J  ^_o^rsttZZ#$4#5W=(+Q[ !   
 
 	
 
s   ;AAAc          
     J  #    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                  [        X#XES9[        [           SS	9I Sh  vN $  Ns N7f)
rl   rG   rm   Nrn   ro   rp   r3   Trq   )	rK   rO   rs   r   rt   rL   r   r   r    ru   s          r*   rw   AsyncBatches.resultsE  s     @  ^_o^rsttmm5EmFF   TUZUlUlTmn  "#7QM<ORQYY(+Q[ &&DE  
 
 	
 G
s"   )B#BA.B#B!B#!B#ry   )rz   r   )rz   r   r{   r   )rR   r   rS   r   rT   r   r4   r|   r5   r}   r6   r~   r7   r   rz   z5AsyncPaginator[MessageBatch, AsyncPage[MessageBatch]]r   )rN   r   r4   r|   r5   r}   r6   r~   r7   r   rz   z1AsyncJSONLDecoder[MessageBatchIndividualResponse]r   ry   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_wrapperrC   rO   r]   rc   ri   r)   batchess     r*   __init__BatchesWithRawResponse.__init__z  s    &>>NN
 )@@
 %<<LL
	 '>>NN
 '>>NN
r-   r   ri   rC   rc   r]   rO   Nr   r!   rz   Noner   r   r   r   r   r   ry   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_wrapperrC   rO   r]   rc   ri   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"   rz   r   r   ry   r-   r*   r   r     r   r-   r   c                      \ rS rSrSS jrSrg)r0   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   rC   rO   r]   rc   ri   r   s     r*   r   %BatchesWithStreamingResponse.__init__  sp    2NN
 5
 1LL
	 3NN
 3NN
r-   r   Nr   r   ry   r-   r*   r0   r0     r   r-   r0   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   rC   rO   r]   rc   ri   r   s     r*   r   *AsyncBatchesWithStreamingResponse.__init__  sp    8NN
 ;
 7LL
	 9NN
 9NN
r-   r   Nr   r   ry   r-   r*   r   r     r   r-   r   )5
__future__r   typingr   httpx r   _typesr   r   r	   r
   r   r   r   _utilsr   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   r0   r   ry   r-   r*   <module>r      s    #     K K K < & : Y - ) @ D > 8 G ^n
%l
o l
^	l
# l
^	
 
*
 
*
 
*
 
r-   