Ë
    A²Xj¨v  ã                  óŒ  — 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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  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.m/Z/ ddgZ0 G d„ de«      Z1 G d„ de«      Z2 G d„ d«      Z3 G d„ d«      Z4 G d„ d«      Z5 G d„ d«      Z6y)é    )Úannotations)ÚIterableNé   )Ú_legacy_response)ÚBodyÚOmitÚQueryÚHeadersÚNotGivenÚomitÚ	not_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)Úbatch_list_paramsÚbatch_create_params)ÚJSONLDecoderÚAsyncJSONLDecoder)ÚMessageBatch)ÚDeletedMessageBatch)ÚMessageBatchIndividualResponseÚBatchesÚAsyncBatchesc                  ó@  — e Zd Zedd„«       Zedd„«       Zedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zdddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Z	eeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	„Z
dddedœ	 	 	 	 	 	 	 	 	 	 	 dd
„Zdddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Zdddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Zy)r#   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
        )ÚBatchesWithRawResponse©Úselfs    új/var/www/html/content_generation/venv/lib/python3.12/site-packages/anthropic/resources/messages/batches.pyÚwith_raw_responsezBatches.with_raw_response   s   € ô & dÓ+Ð+ó    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
        )ÚBatchesWithStreamingResponser)   s    r+   Úwith_streaming_responsezBatches.with_streaming_response&   s   € ô ,¨DÓ1Ð1r-   N©Úuser_profile_idÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutc          
     ó¬   — i t        d|i«      ¥|xs i ¥}| j                  dt        d|it        j                  «      t        ||||¬«      t        ¬«      S )áÌ  
        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://platform.claude.com/docs/en/build-with-claude/batch-processing)

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

          user_profile_id: The user profile ID to attribute the requests in this batch to. Use when acting
              on behalf of a party other than your organization. Requires the `user-profiles`
              beta header. Applies to every request in the batch; an individual request whose
              `user_profile_id` body field conflicts with this header is errored.

          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-user-profile-idú/v1/messages/batchesÚrequests©r4   r5   r6   r7   ©ÚbodyÚoptionsÚcast_to)r   Ú_postr   r   ÚBatchCreateParamsr   r    ©r*   r<   r3   r4   r5   r6   r7   s          r+   ÚcreatezBatches.create/   sn   € ðN uœ?Ð,GÈÐ+YÓZÐtÐ_lÒ_rÐprÐtˆØ�z‰zØ"Ü  *¨hÐ!7Ô9L×9^Ñ9^Ó_Ü(Ø+¸ÐQ[Ðelôô !ð ó 
ð 	
r-   r=   c          	     ó‚   — |st        d|›�«      ‚| j                  t        d|¬«      t        ||||¬«      t        ¬«      S )áÆ  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://platform.claude.com/docs/en/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_idr=   ©r@   rA   ©Ú
ValueErrorÚ_getr   r   r    ©r*   rK   r4   r5   r6   r7   s         r+   ÚretrievezBatches.retrieve`   sV   € ñ>  ÜÐ^Ð_oÐ^rÐsÓtÐtØ�y‰yÜÐCÐVfÔgÜ(Ø+¸ÐQ[Ðelôô !ð ó 
ð 	
r-   ©Úafter_idÚ	before_idÚlimitr4   r5   r6   r7   c               óž   — | j                  dt        t           t        ||||t	        |||dœt
        j                  «      ¬«      t        ¬«      S ©aæ  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://platform.claude.com/docs/en/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;   )rS   rT   rU   )r4   r5   r6   r7   Úquery)Úpager@   Úmodel)Ú_get_api_listr   r    r   r   r   ÚBatchListParams©r*   rS   rT   rU   r4   r5   r6   r7   s           r+   ÚlistzBatches.list‰   sb   € ðP ×!Ñ!Ø"Üœ,Ñ'Ü(Ø+Ø'Ø%ØÜ%à$,Ø%.Ø!&ñô
 &×5Ñ5óôô ð# "ó 
ð 	
r-   c          	     ó‚   — |st        d|›�«      ‚| j                  t        d|¬«      t        ||||¬«      t        ¬«      S )á¶  
        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://platform.claude.com/docs/en/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   r=   rL   ©rN   Ú_deleter   r   r!   rP   s         r+   ÚdeletezBatches.deleteÅ   sV   € ñ>  ÜÐ^Ð_oÐ^rÐsÓtÐtØ�|‰|ÜÐCÐVfÔgÜ(Ø+¸ÐQ[Ðelôô (ð ó 
ð 	
r-   c          	     ó‚   — |st        d|›�«      ‚| j                  t        d|¬«      t        ||||¬«      t        ¬«      S )á$  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://platform.claude.com/docs/en/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   r=   rL   ©rN   rB   r   r   r    rP   s         r+   ÚcancelzBatches.cancelî   sW   € ñJ  ÜÐ^Ð_oÐ^rÐsÓtÐtØ�z‰zÜÐJÐ]mÔnÜ(Ø+¸ÐQ[Ðelôô !ð ó 
ð 	
r-   c          	     ó&  — |st        d|›�«      ‚| j                  |¬«      }|j                  st        d|j                  › �«      ‚ddi|xs i ¥}| j                  t        |j                  |¬«      t        ||||¬«      t        t           d¬«      S )	á2  
        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://platform.claude.com/docs/en/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/binaryr=   T©r@   rA   Ústream)
rN   rQ   Úresults_urlr   Úprocessing_statusrO   r   r   r   r"   ©r*   rK   r4   r5   r6   r7   Úbatchs          r+   ÚresultszBatches.results  sµ   € ñ@  ÜÐ^Ð_oÐ^rÐsÓtÐtà—‘Ð/?�Ó@ˆØ× Ò Ü ØTÐUZ×UlÑUlÐTmÐnóð ð "Ð#7ÐQ¸MÒ<OÈRÐQˆØ�y‰yÜ˜%×+Ñ+Ð>NÔOÜ(Ø+¸ÐQ[Ðelôô !Ô!?Ñ@Øð ó 
ð 	
r-   )Úreturnr(   )ru   r0   ©r<   z%Iterable[batch_create_params.Request]r3   ú
str | Omitr4   úHeaders | Noner5   úQuery | Noner6   úBody | Noner7   ú'float | httpx.Timeout | None | NotGivenru   r    ©rK   Ústrr4   rx   r5   ry   r6   rz   r7   r{   ru   r    )rS   rw   rT   rw   rU   ú
int | Omitr4   rx   r5   ry   r6   rz   r7   r{   ru   zSyncPage[MessageBatch]©rK   r}   r4   rx   r5   ry   r6   rz   r7   r{   ru   r!   )rK   r}   r4   rx   r5   ry   r6   rz   r7   r{   ru   z,JSONLDecoder[MessageBatchIndividualResponse]©Ú__name__Ú
__module__Ú__qualname__r   r,   r1   r   r   rE   rQ   r^   rc   rh   rt   © r-   r+   r#   r#      s-  „ Øò,ó ð,ð ò2ó ð2ð '+ð )-Ø$(Ø"&Ø;Dñ/
ð 8ð/
ð $ð	/
ð &ð/
ð "ð/
ð  ð/
ð 9ð/
ð 
ó/
ðn )-Ø$(Ø"&Ø;Dñ'
àð'
ð &ð'
ð "ð'
ð  ð'
ð 9ð'
ð 
ó'
ðX  $Ø $Ø ð )-Ø$(Ø"&Ø;Dñ:
ð ð:
ð ð	:
ð
 ð:
ð &ð:
ð "ð:
ð  ð:
ð 9ð:
ð 
 ó:
ðD )-Ø$(Ø"&Ø;Dñ'
àð'
ð &ð'
ð "ð'
ð  ð'
ð 9ð'
ð 
ó'
ð^ )-Ø$(Ø"&Ø;Dñ-
àð-
ð &ð-
ð "ð-
ð  ð-
ð 9ð-
ð 
ó-
ðj )-Ø$(Ø"&Ø;Dñ1
àð1
ð &ð1
ð "ð1
ð  ð1
ð 9ð1
ð 
6ô1
r-   c                  ó@  — e Zd Zedd„«       Zedd„«       Zedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zdddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Z	eeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	„Z
dddedœ	 	 	 	 	 	 	 	 	 	 	 dd
„Zdddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Zdddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Zy)r$   c                ó   — t        | «      S r'   )ÚAsyncBatchesWithRawResponser)   s    r+   r,   zAsyncBatches.with_raw_responseR  s   € ô +¨4Ó0Ð0r-   c                ó   — t        | «      S r/   )Ú!AsyncBatchesWithStreamingResponser)   s    r+   r1   z$AsyncBatches.with_streaming_response\  s   € ô 1°Ó6Ð6r-   Nr2   c          
   ƒ  óÜ   K  — i t        d|i«      ¥|xs i ¥}| j                  dt        d|it        j                  «      ƒ d{  –—† t        ||||¬«      t        ¬«      ƒ d{  –—† S 7 Œ$7 Œ­w)r9   r:   r;   r<   Nr=   r>   )r   rB   r   r   rC   r   r    rD   s          r+   rE   zAsyncBatches.createe  sƒ   è ø€ ðN uœ?Ð,GÈÐ+YÓZÐtÐ_lÒ_rÐprÐtˆØ—Z‘ZØ"Ü,¨j¸(Ð-CÔEX×EjÑEjÓk×kÜ(Ø+¸ÐQ[Ðelôô !ð  ó 
÷ 
ð 	
àkøð
ús$   ‚AA,ÁA(
ÁA,Á#A*Á$A,Á*A,r=   c          	   ƒ  óž   K  — |st        d|›�«      ‚| j                  t        d|¬«      t        ||||¬«      t        ¬«      ƒ d{  –—† S 7 Œ­w)rG   rH   rI   rJ   r=   rL   NrM   rP   s         r+   rQ   zAsyncBatches.retrieve–  sd   è ø€ ñ>  ÜÐ^Ð_oÐ^rÐsÓtÐtØ—Y‘YÜÐCÐVfÔgÜ(Ø+¸ÐQ[Ðelôô !ð ó 
÷ 
ð 	
ð 
úó   ‚AAÁAÁArR   c               óž   — | j                  dt        t           t        ||||t	        |||dœt
        j                  «      ¬«      t        ¬«      S rW   )r[   r   r    r   r   r   r\   r]   s           r+   r^   zAsyncBatches.list¿  sb   € ðP ×!Ñ!Ø"Üœ<Ñ(Ü(Ø+Ø'Ø%ØÜ%à$,Ø%.Ø!&ñô
 &×5Ñ5óôô ð# "ó 
ð 	
r-   c          	   ƒ  óž   K  — |st        d|›�«      ‚| j                  t        d|¬«      t        ||||¬«      t        ¬«      ƒ d{  –—† S 7 Œ­w)r`   rH   rI   rJ   r=   rL   Nra   rP   s         r+   rc   zAsyncBatches.deleteû  sd   è ø€ ñ>  ÜÐ^Ð_oÐ^rÐsÓtÐtØ—\‘\ÜÐCÐVfÔgÜ(Ø+¸ÐQ[Ðelôô (ð "ó 
÷ 
ð 	
ð 
úrŒ   c          	   ƒ  óž   K  — |st        d|›�«      ‚| j                  t        d|¬«      t        ||||¬«      t        ¬«      ƒ d{  –—† S 7 Œ­w)re   rH   rf   rJ   r=   rL   Nrg   rP   s         r+   rh   zAsyncBatches.cancel$  se   è ø€ ñJ  ÜÐ^Ð_oÐ^rÐsÓtÐtØ—Z‘ZÜÐJÐ]mÔnÜ(Ø+¸ÐQ[Ðelôô !ð  ó 
÷ 
ð 	
ð 
úrŒ   c          	   ƒ  óV  K  — |st        d|›�«      ‚| j                  |¬«      ƒ d{  –—† }|j                  st        d|j                  › �«      ‚ddi|xs i ¥}| j                  t        |j                  |¬«      t        ||||¬«      t        t           d¬	«      ƒ d{  –—† S 7 Œ|7 Œ­w)
rj   rH   rJ   Nrk   rl   rm   r=   Trn   )
rN   rQ   rp   r   rq   rO   r   r   r   r"   rr   s          r+   rt   zAsyncBatches.resultsS  sÍ   è ø€ ñ@  ÜÐ^Ð_oÐ^rÐsÓtÐtà—m‘mÐ5E�mÓF×FˆØ× Ò Ü ØTÐUZ×UlÑUlÐTmÐnóð ð "Ð#7ÐQ¸MÒ<OÈRÐQˆØ—Y‘YÜ˜%×+Ñ+Ð>NÔOÜ(Ø+¸ÐQ[Ðelôô &Ô&DÑEØð ó 
÷ 
ð 	
ð Gøð
ús"   ‚&B)¨B%©A7B)Â B'Â!B)Â'B))ru   r‡   )ru   r‰   rv   r|   )rS   rw   rT   rw   rU   r~   r4   rx   r5   ry   r6   rz   r7   r{   ru   z5AsyncPaginator[MessageBatch, AsyncPage[MessageBatch]]r   )rK   r}   r4   rx   r5   ry   r6   rz   r7   r{   ru   z1AsyncJSONLDecoder[MessageBatchIndividualResponse]r€   r„   r-   r+   r$   r$   Q  s-  „ Øò1ó ð1ð ò7ó ð7ð '+ð )-Ø$(Ø"&Ø;Dñ/
ð 8ð/
ð $ð	/
ð &ð/
ð "ð/
ð  ð/
ð 9ð/
ð 
ó/
ðn )-Ø$(Ø"&Ø;Dñ'
àð'
ð &ð'
ð "ð'
ð  ð'
ð 9ð'
ð 
ó'
ðX  $Ø $Ø ð )-Ø$(Ø"&Ø;Dñ:
ð ð:
ð ð	:
ð
 ð:
ð &ð:
ð "ð:
ð  ð:
ð 9ð:
ð 
?ó:
ðD )-Ø$(Ø"&Ø;Dñ'
àð'
ð &ð'
ð "ð'
ð  ð'
ð 9ð'
ð 
ó'
ð^ )-Ø$(Ø"&Ø;Dñ-
àð-
ð &ð-
ð "ð-
ð  ð-
ð 9ð-
ð 
ó-
ðj )-Ø$(Ø"&Ø;Dñ1
àð1
ð &ð1
ð "ð1
ð  ð1
ð 9ð1
ð 
;ô1
r-   c                  ó   — e Zd Zdd„Zy)r(   c                óz  — || _         t        j                  |j                  «      | _        t        j                  |j                  «      | _        t        j                  |j
                  «      | _        t        j                  |j                  «      | _        t        j                  |j                  «      | _        y ©N)Ú_batchesr   Úto_raw_response_wrapperrE   rQ   r^   rc   rh   ©r*   Úbatchess     r+   Ú__init__zBatchesWithRawResponse.__init__ˆ  s�   € ØˆŒä&×>Ñ>Ø�N‰Nó
ˆŒô )×@Ñ@Ø×Ñó
ˆŒô %×<Ñ<Ø�L‰Ló
ˆŒ	ô '×>Ñ>Ø�N‰Nó
ˆŒô '×>Ñ>Ø�N‰Nó
ˆ�r-   N©r—   r#   ru   ÚNone©r�   r‚   rƒ   r˜   r„   r-   r+   r(   r(   ‡  ó   „ ô
r-   r(   c                  ó   — e Zd Zdd„Zy)r‡   c                óz  — || _         t        j                  |j                  «      | _        t        j                  |j                  «      | _        t        j                  |j
                  «      | _        t        j                  |j                  «      | _        t        j                  |j                  «      | _        y r“   )r”   r   Úasync_to_raw_response_wrapperrE   rQ   r^   rc   rh   r–   s     r+   r˜   z$AsyncBatchesWithRawResponse.__init__�  s�   € ØˆŒä&×DÑDØ�N‰Nó
ˆŒô )×FÑFØ×Ñó
ˆŒô %×BÑBØ�L‰Ló
ˆŒ	ô '×DÑDØ�N‰Nó
ˆŒô '×DÑDØ�N‰Nó
ˆ�r-   N©r—   r$   ru   rš   r›   r„   r-   r+   r‡   r‡   œ  rœ   r-   r‡   c                  ó   — e Zd Zdd„Zy)r0   c                ó  — || _         t        |j                  «      | _        t        |j                  «      | _        t        |j                  «      | _        t        |j
                  «      | _        t        |j                  «      | _        y r“   )r”   r   rE   rQ   r^   rc   rh   r–   s     r+   r˜   z%BatchesWithStreamingResponse.__init__²  sr   € ØˆŒä2Ø�N‰Nó
ˆŒô 5Ø×Ñó
ˆŒô 1Ø�L‰Ló
ˆŒ	ô 3Ø�N‰Nó
ˆŒô 3Ø�N‰Nó
ˆ�r-   Nr™   r›   r„   r-   r+   r0   r0   ±  rœ   r-   r0   c                  ó   — e Zd Zdd„Zy)r‰   c                ó  — || _         t        |j                  «      | _        t        |j                  «      | _        t        |j                  «      | _        t        |j
                  «      | _        t        |j                  «      | _        y r“   )r”   r   rE   rQ   r^   rc   rh   r–   s     r+   r˜   z*AsyncBatchesWithStreamingResponse.__init__Ç  sr   € ØˆŒä8Ø�N‰Nó
ˆŒô ;Ø×Ñó
ˆŒô 7Ø�L‰Ló
ˆŒ	ô 9Ø�N‰Nó
ˆŒô 9Ø�N‰Nó
ˆ�r-   Nr    r›   r„   r-   r+   r‰   r‰   Æ  rœ   r-   r‰   )7Ú
__future__r   Útypingr   ÚhttpxÚ r   Ú_typesr   r   r	   r
   r   r   r   Ú_utilsr   r   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‡   r0   r‰   r„   r-   r+   Ú<module>r·      s”   ðõ #å ã å  ß K× KÑ Kß \Ó \Ý &ß :ß Yß -Ý )ß @ß Dß >Ý 8Ý GÝ ^à�nÐ
%€ôs
ˆoô s
ôl	s
Ð#ô s
÷l	
ñ 
÷*
ñ 
÷*
ñ 
÷*
ò 
r-   