§
    ÜŽ’jÏ�  ã                  ó¾  — d dl mZ d dlmZ d dlmZmZ d dlZddlm	Z	 ddl
mZ ddlmZ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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$ ddl%m&Z&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddgZ2 G d„ de¦  «        Z3 G d„ de¦  «        Z4 G d„ d¦  «        Z5 G d„ d¦  «        Z6 G d„ d¦  «        Z7 G d„ d¦  «        Z8dS ) é    )Úannotations)ÚList)ÚLiteralÚoverloadNé   )Ú_legacy_response)Úcompletion_create_params)ÚBodyÚOmitÚQueryÚHeadersÚNotGivenÚSequenceNotStrÚomitÚ	not_given)Úis_givenÚrequired_argsÚmaybe_transformÚstrip_not_givenÚasync_maybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_streamed_response_wrapperÚ"async_to_streamed_response_wrapper)ÚDEFAULT_TIMEOUT)ÚStreamÚAsyncStream)Úmake_request_options)Ú
Completion)Ú
ModelParam)ÚMetadataParam)ÚAnthropicBetaParamÚCompletionsÚAsyncCompletionsc                  ó  — e Zd Zed0d„¦   «         Zed1d„¦   «         Zeeeeeeeedddedœd2d$„¦   «         Z	eeeeeeeddded%œ
d3d(„¦   «         Z	eeeeeeeddded%œ
d4d+„¦   «         Z	 e
g d,¢g d-¢¦  «        eeeeeeedddedœd5d/„¦   «         Z	dS )6r$   ÚreturnÚCompletionsWithRawResponsec                ó    — 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
        )r(   ©Úselfs    úMC:\Projects\DSCons\.venv\Lib\site-packages\anthropic\resources\completions.pyÚwith_raw_responsezCompletions.with_raw_response   s   € õ *¨$Ñ/Ô/Ð/ó    Ú CompletionsWithStreamingResponsec                ó    — 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
        )r0   r+   s    r-   Úwith_streaming_responsez#Completions.with_streaming_response'   s   € õ 0°Ñ5Ô5Ð5r/   N©ÚmetadataÚstop_sequencesÚstreamÚtemperatureÚtop_kÚtop_pÚbetasÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚmax_tokens_to_sampleÚintÚmodelr!   ÚpromptÚstrr5   úMetadataParam | Omitr6   úSequenceNotStr[str] | Omitr7   úLiteral[False] | Omitr8   úfloat | Omitr9   ú
int | Omitr:   r;   úList[AnthropicBetaParam] | Omitr<   úHeaders | Noner=   úQuery | Noner>   úBody | Noner?   ú'float | httpx.Timeout | None | NotGivenr    c               ó   — dS ©aS  [Legacy] Create a Text Completion.

        The Text Completions API is a legacy API.

        We recommend using the
        [Messages API](https://platform.claude.com/docs/en/api/messages) going forward.

        Future models and features will not be compatible with Text Completions. See our
        [migration guide](https://platform.claude.com/docs/en/build-with-claude/working-with-messages)
        for guidance in migrating from Text Completions to Messages.

        Args:
          max_tokens_to_sample: The maximum number of tokens to generate before stopping.

              Note that our models may stop _before_ reaching this maximum. This parameter
              only specifies the absolute maximum number of tokens to generate.

          model: The model that will complete your prompt.

              See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
              details and options.

          prompt: The prompt that you want Claude to complete.

              For proper response generation you will need to format your prompt using
              alternating `

Human:` and `

Assistant:` conversational turns. For example:

              ```
              "

Human: {userQuestion}

Assistant:"
              ```

              See
              [prompt validation](https://platform.claude.com/docs/en/build-with-claude/working-with-messages)
              and our guide to
              [prompt design](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview)
              for more details.

          metadata: An object describing metadata about the request.

          stop_sequences: Sequences that will cause the model to stop generating.

              Our models stop on `"

Human:"`, and may include additional built-in stop
              sequences in the future. By providing the stop_sequences parameter, you may
              include additional strings that will cause the model to stop generating.

          stream: Whether to incrementally stream the response using server-sent events.

              See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
              for details.

          temperature: Amount of randomness injected into the response.

              Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
              for analytical / multiple choice, and closer to `1.0` for creative and
              generative tasks.

              Note that even with `temperature` of `0.0`, the results will not be fully
              deterministic.

          top_k: Only sample from the top K options for each subsequent token.

              Used to remove "long tail" low probability responses.
              [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).

              Recommended for advanced use cases only.

          top_p: Use nucleus sampling.

              In nucleus sampling, we compute the cumulative distribution over all the options
              for each subsequent token in decreasing probability order and cut it off once it
              reaches a particular probability specified by `top_p`.

              Recommended for advanced use cases 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
        N© ©r,   r@   rB   rC   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   s                  r-   ÚcreatezCompletions.create0   ó
   € ðR 	ˆr/   ©
r5   r6   r8   r9   r:   r;   r<   r=   r>   r?   úLiteral[True]úStream[Completion]c               ó   — dS ©aS  [Legacy] Create a Text Completion.

        The Text Completions API is a legacy API.

        We recommend using the
        [Messages API](https://platform.claude.com/docs/en/api/messages) going forward.

        Future models and features will not be compatible with Text Completions. See our
        [migration guide](https://platform.claude.com/docs/en/build-with-claude/working-with-messages)
        for guidance in migrating from Text Completions to Messages.

        Args:
          max_tokens_to_sample: The maximum number of tokens to generate before stopping.

              Note that our models may stop _before_ reaching this maximum. This parameter
              only specifies the absolute maximum number of tokens to generate.

          model: The model that will complete your prompt.

              See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
              details and options.

          prompt: The prompt that you want Claude to complete.

              For proper response generation you will need to format your prompt using
              alternating `

Human:` and `

Assistant:` conversational turns. For example:

              ```
              "

Human: {userQuestion}

Assistant:"
              ```

              See
              [prompt validation](https://platform.claude.com/docs/en/build-with-claude/working-with-messages)
              and our guide to
              [prompt design](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview)
              for more details.

          stream: Whether to incrementally stream the response using server-sent events.

              See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
              for details.

          metadata: An object describing metadata about the request.

          stop_sequences: Sequences that will cause the model to stop generating.

              Our models stop on `"

Human:"`, and may include additional built-in stop
              sequences in the future. By providing the stop_sequences parameter, you may
              include additional strings that will cause the model to stop generating.

          temperature: Amount of randomness injected into the response.

              Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
              for analytical / multiple choice, and closer to `1.0` for creative and
              generative tasks.

              Note that even with `temperature` of `0.0`, the results will not be fully
              deterministic.

          top_k: Only sample from the top K options for each subsequent token.

              Used to remove "long tail" low probability responses.
              [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).

              Recommended for advanced use cases only.

          top_p: Use nucleus sampling.

              In nucleus sampling, we compute the cumulative distribution over all the options
              for each subsequent token in decreasing probability order and cut it off once it
              reaches a particular probability specified by `top_p`.

              Recommended for advanced use cases 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
        NrQ   ©r,   r@   rB   rC   r7   r5   r6   r8   r9   r:   r;   r<   r=   r>   r?   s                  r-   rS   zCompletions.create›   rT   r/   ÚboolúCompletion | Stream[Completion]c               ó   — dS rY   rQ   rZ   s                  r-   rS   zCompletions.create  rT   r/   ©r@   rB   rC   ©r@   rB   rC   r7   ú%Literal[False] | Literal[True] | Omitc               óÈ  — t          |¦  «        s| j        j        t          k    rd}i t	          dt          |
¦  «        rd                     d„ |
D ¦   «         ¦  «        nt          i¦  «        ¥|pi ¥}|                      dt          |||||||||	dœ	|rt          j
        nt          j        ¦  «        t          ||||¬¦  «        t          |pdt          t                   ¬	¦  «        S )
NéX  úanthropic-betaú,c              3  ó4   K  — | ]}t          |¦  «        V — Œd S ©N©rD   ©Ú.0Úes     r-   ú	<genexpr>z%Completions.create.<locals>.<genexpr>‰  ó(   è è € Ð9PÐ9PÀQ½#¸a¹&¼&Ð9PÐ9PÐ9PÐ9PÐ9PÐ9Pr/   ú/v1/complete©	r@   rB   rC   r5   r6   r7   r8   r9   r:   ©r<   r=   r>   r?   F©ÚbodyÚoptionsÚcast_tor7   Ú
stream_cls)r   Ú_clientr?   r   r   Újoinr   Ú_postr   r	   ÚCompletionCreateParamsStreamingÚ"CompletionCreateParamsNonStreamingr   r    r   rR   s                  r-   rS   zCompletions.createq  s!  € õ* ˜Ñ Ô ð 	 T¤\Ô%9½_Ò%LÐ%LØˆGð
ÝÐ/ÕT\Ð]bÑTcÔTcÐ1r°·²Ð9PÐ9PÈ%Ð9PÑ9PÔ9PÑ1PÔ1PÐ1PÕirÐsÑtÔtð
àÐ" ð
ˆð �zŠzØÝ à,@Ø"Ø$Ø (Ø&4Ø$Ø#.Ø"Ø"ð
ð 
ð ðQÕ(ÔHÐHå-ÔPñô õ  )Ø+¸ÐQ[Ðelðñ ô õ Ø�?˜UÝ�jÔ)ð/ ñ 
ô 
ð 	
r/   )r'   r(   )r'   r0   ©r@   rA   rB   r!   rC   rD   r5   rE   r6   rF   r7   rG   r8   rH   r9   rI   r:   rH   r;   rJ   r<   rK   r=   rL   r>   rM   r?   rN   r'   r    )r@   rA   rB   r!   rC   rD   r7   rV   r5   rE   r6   rF   r8   rH   r9   rI   r:   rH   r;   rJ   r<   rK   r=   rL   r>   rM   r?   rN   r'   rW   )r@   rA   rB   r!   rC   rD   r7   r[   r5   rE   r6   rF   r8   rH   r9   rI   r:   rH   r;   rJ   r<   rK   r=   rL   r>   rM   r?   rN   r'   r\   )r@   rA   rB   r!   rC   rD   r5   rE   r6   rF   r7   r`   r8   rH   r9   rI   r:   rH   r;   rJ   r<   rK   r=   rL   r>   rM   r?   rN   r'   r\   ©Ú__name__Ú
__module__Ú__qualname__r   r.   r3   r   r   r   rS   r   rQ   r/   r-   r$   r$      s¹  € € € € € Øð0ð 0ð 0ñ „_ð0ð ð6ð 6ð 6ñ „_ð6ð ð *.Ø59Ø(,Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dð%hð hð hð hð hñ „XðhðT ð *.Ø59Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dð%hð hð hð hð hñ „XðhðT ð *.Ø59Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dð%hð hð hð hð hñ „XðhðT €]Ð>Ð>Ð>Ð@uÐ@uÐ@uÑvÔvð *.Ø59Ø8<Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dð%2
ð 2
ð 2
ð 2
ð 2
ñ wÔvð2
ð 2
ð 2
r/   c                  ó  — e Zd Zed0d„¦   «         Zed1d„¦   «         Zeeeeeeeedddedœd2d$„¦   «         Z	eeeeeeeddded%œ
d3d(„¦   «         Z	eeeeeeeddded%œ
d4d+„¦   «         Z	 e
g d,¢g d-¢¦  «        eeeeeeedddedœd5d/„¦   «         Z	dS )6r%   r'   ÚAsyncCompletionsWithRawResponsec                ó    — t          | ¦  «        S r*   )r€   r+   s    r-   r.   z"AsyncCompletions.with_raw_response¨  s   € õ /¨tÑ4Ô4Ð4r/   Ú%AsyncCompletionsWithStreamingResponsec                ó    — t          | ¦  «        S r2   )r‚   r+   s    r-   r3   z(AsyncCompletions.with_streaming_response²  s   € õ 5°TÑ:Ô:Ð:r/   Nr4   r@   rA   rB   r!   rC   rD   r5   rE   r6   rF   r7   rG   r8   rH   r9   rI   r:   r;   rJ   r<   rK   r=   rL   r>   rM   r?   rN   r    c             ƒ  ó
   K  — dS rP   rQ   rR   s                  r-   rS   zAsyncCompletions.create»  ó   è è € ðR 	ˆr/   rU   rV   úAsyncStream[Completion]c             ƒ  ó
   K  — dS rY   rQ   rZ   s                  r-   rS   zAsyncCompletions.create&  r…   r/   r[   ú$Completion | AsyncStream[Completion]c             ƒ  ó
   K  — dS rY   rQ   rZ   s                  r-   rS   zAsyncCompletions.create‘  r…   r/   r^   r_   r`   c             ƒ  óä  K  — t          |¦  «        s| j        j        t          k    rd}i t	          dt          |
¦  «        rd                     d„ |
D ¦   «         ¦  «        nt          i¦  «        ¥|pi ¥}|                      dt          |||||||||	dœ	|rt          j
        nt          j        ¦  «        ƒ d {V —†t          ||||¬¦  «        t          |pdt          t                   ¬	¦  «        ƒ d {V —†S )
Nrb   rc   rd   c              3  ó4   K  — | ]}t          |¦  «        V — Œd S rf   rg   rh   s     r-   rk   z*AsyncCompletions.create.<locals>.<genexpr>  rl   r/   rm   rn   ro   Frp   )r   ru   r?   r   r   rv   r   rw   r   r	   rx   ry   r   r    r   rR   s                  r-   rS   zAsyncCompletions.createü  sa  è è € õ* ˜Ñ Ô ð 	 T¤\Ô%9½_Ò%LÐ%LØˆGð
ÝÐ/ÕT\Ð]bÑTcÔTcÐ1r°·²Ð9PÐ9PÈ%Ð9PÑ9PÔ9PÑ1PÔ1PÐ1PÕirÐsÑtÔtð
àÐ" ð
ˆð —Z’ZØÝ,à,@Ø"Ø$Ø (Ø&4Ø$Ø#.Ø"Ø"ð
ð 
ð ðQÕ(ÔHÐHå-ÔPñô ð ð ð ð ð ð õ  )Ø+¸ÐQ[Ðelðñ ô õ Ø�?˜UÝ"¥:Ô.ð/  ñ 
ô 
ð 
ð 
ð 
ð 
ð 
ð 
ð 	
r/   )r'   r€   )r'   r‚   rz   )r@   rA   rB   r!   rC   rD   r7   rV   r5   rE   r6   rF   r8   rH   r9   rI   r:   rH   r;   rJ   r<   rK   r=   rL   r>   rM   r?   rN   r'   r†   )r@   rA   rB   r!   rC   rD   r7   r[   r5   rE   r6   rF   r8   rH   r9   rI   r:   rH   r;   rJ   r<   rK   r=   rL   r>   rM   r?   rN   r'   rˆ   )r@   rA   rB   r!   rC   rD   r5   rE   r6   rF   r7   r`   r8   rH   r9   rI   r:   rH   r;   rJ   r<   rK   r=   rL   r>   rM   r?   rN   r'   rˆ   r{   rQ   r/   r-   r%   r%   §  s¹  € € € € € Øð5ð 5ð 5ñ „_ð5ð ð;ð ;ð ;ñ „_ð;ð ð *.Ø59Ø(,Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dð%hð hð hð hð hñ „XðhðT ð *.Ø59Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dð%hð hð hð hð hñ „XðhðT ð *.Ø59Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dð%hð hð hð hð hñ „XðhðT €]Ð>Ð>Ð>Ð@uÐ@uÐ@uÑvÔvð *.Ø59Ø8<Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dð%2
ð 2
ð 2
ð 2
ð 2
ñ wÔvð2
ð 2
ð 2
r/   c                  ó   — e Zd Zdd„ZdS )r(   Úcompletionsr$   r'   ÚNonec                óP   — || _         t          j        |j        ¦  «        | _        d S rf   )Ú_completionsr   Úto_raw_response_wrapperrS   ©r,   r�   s     r-   Ú__init__z#CompletionsWithRawResponse.__init__3  s(   € Ø'ˆÔå&Ô>ØÔñ
ô 
ˆŒˆˆr/   N©r�   r$   r'   rŽ   ©r|   r}   r~   r“   rQ   r/   r-   r(   r(   2  ó(   € € € € € ð
ð 
ð 
ð 
ð 
ð 
r/   r(   c                  ó   — e Zd Zdd„ZdS )r€   r�   r%   r'   rŽ   c                óP   — || _         t          j        |j        ¦  «        | _        d S rf   )r�   r   Úasync_to_raw_response_wrapperrS   r’   s     r-   r“   z(AsyncCompletionsWithRawResponse.__init__<  s(   € Ø'ˆÔå&ÔDØÔñ
ô 
ˆŒˆˆr/   N©r�   r%   r'   rŽ   r•   rQ   r/   r-   r€   r€   ;  r–   r/   r€   c                  ó   — e Zd Zdd„ZdS )r0   r�   r$   r'   rŽ   c                óF   — || _         t          |j        ¦  «        | _        d S rf   )r�   r   rS   r’   s     r-   r“   z)CompletionsWithStreamingResponse.__init__E  s%   € Ø'ˆÔå2ØÔñ
ô 
ˆŒˆˆr/   Nr”   r•   rQ   r/   r-   r0   r0   D  r–   r/   r0   c                  ó   — e Zd Zdd„ZdS )r‚   r�   r%   r'   rŽ   c                óF   — || _         t          |j        ¦  «        | _        d S rf   )r�   r   rS   r’   s     r-   r“   z.AsyncCompletionsWithStreamingResponse.__init__N  s%   € Ø'ˆÔå8ØÔñ
ô 
ˆŒˆˆr/   Nrš   r•   rQ   r/   r-   r‚   r‚   M  r–   r/   r‚   )9Ú
__future__r   Útypingr   Útyping_extensionsr   r   ÚhttpxÚ r   Útypesr	   Ú_typesr
   r   r   r   r   r   r   r   Ú_utilsr   r   r   r   r   Ú_compatr   Ú	_resourcer   r   Ú	_responser   r   Ú
_constantsr   Ú
_streamingr   r   Ú_base_clientr   Útypes.completionr    Útypes.model_paramr!   Útypes.metadata_paramr"   Útypes.anthropic_beta_paramr#   Ú__all__r$   r%   r(   r€   r0   r‚   rQ   r/   r-   ú<module>r²      s¸  ðð #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð Ø /Ð /Ð /Ð /Ð /Ð /Ð /Ð /à €€€à Ð Ð Ð Ð Ð Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZÐ ZØ eÐ eÐ eÐ eÐ eÐ eÐ eÐ eÐ eÐ eÐ eÐ eÐ eÐ eØ %Ð %Ð %Ð %Ð %Ð %Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø XÐ XÐ XÐ XÐ XÐ XÐ XÐ XØ (Ð (Ð (Ð (Ð (Ð (Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø /Ð /Ð /Ð /Ð /Ð /Ø )Ð )Ð )Ð )Ð )Ð )Ø *Ð *Ð *Ð *Ð *Ð *Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø ;Ð ;Ð ;Ð ;Ð ;Ð ;àÐ,Ð
-€ðH
ð H
ð H
ð H
ð H
�/ñ H
ô H
ð H
ðVH
ð H
ð H
ð H
ð H
Ð'ñ H
ô H
ð H
ðV
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð 
ð 
r/   