Ë
    A²Xj|�  ã                  ó˜  — 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«      Z8y) é    )Ú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dd„«       Zedd„«       Zeeeeeeeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Z	eeeeeeedddedœ
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Z	eeeeeeedddedœ
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Z	 e
g d	¢g d
¢«      eeeeeee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
        )ÚCompletionsWithRawResponse©Úselfs    úe/var/www/html/content_generation/venv/lib/python3.12/site-packages/anthropic/resources/completions.pyÚwith_raw_responsezCompletions.with_raw_response   s   € ô *¨$Ó/Ð/ó    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
        )Ú CompletionsWithStreamingResponser*   s    r,   Úwith_streaming_responsez#Completions.with_streaming_response'   s   € ô 0°Ó5Ð5r.   N©ÚmetadataÚstop_sequencesÚstreamÚtemperatureÚtop_kÚtop_pÚbetasÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutc                ó   — y©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+   Úmax_tokens_to_sampleÚmodelÚpromptr4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   s                  r,   ÚcreatezCompletions.create0   ó   € ðR 	r.   ©
r4   r5   r7   r8   r9   r:   r;   r<   r=   r>   c                ó   — y©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
        NrA   ©r+   rC   rD   rE   r6   r4   r5   r7   r8   r9   r:   r;   r<   r=   r>   s                  r,   rF   zCompletions.create›   rG   r.   c                ó   — yrJ   rA   rK   s                  r,   rF   zCompletions.create  rG   r.   ©rC   rD   rE   ©rC   rD   rE   r6   c               ó¤  — t        |«      s| j                  j                  t        k(  rd}i t	        dt        |
«      rdj                  d„ |
D «       «      nt        i«      ¥|xs i ¥}| j                  dt        |||||||||	dœ	|rt        j                  nt        j                  «      t        ||||¬«      t        |xs dt        t           ¬	«      S )
NéX  úanthropic-betaÚ,c              3  ó2   K  — | ]  }t        |«      –— Œ y ­w©N©Ústr©Ú.0Úes     r,   Ú	<genexpr>z%Completions.create.<locals>.<genexpr>‰  ó   è ø€ Ð9PÉ%ÀQ¼#¸a¿&É%ùó   ‚ú/v1/complete©	rC   rD   rE   r4   r5   r6   r7   r8   r9   ©r;   r<   r=   r>   F©ÚbodyÚoptionsÚcast_tor6   Ú
stream_cls)r   Ú_clientr>   r   r   Újoinr   Ú_postr   r	   ÚCompletionCreateParamsStreamingÚ"CompletionCreateParamsNonStreamingr   r    r   rB   s                  r,   rF   zCompletions.createq  sé   € ô* ˜Ô  T§\¡\×%9Ñ%9¼_Ò%LØˆGð
ÜÐ/ÔT\Ð]bÔTc°·±Ñ9PÉ%Ó9PÔ1PÔirÐsÓtð
àÒ" ð
ˆð �z‰zØÜ à,@Ø"Ø$Ø (Ø&4Ø$Ø#.Ø"Ø"ñ
ñ ô )×HÒHä-×PÑPóô  )Ø+¸ÐQ[Ðelôô Ø’?˜UÜœjÑ)ð/ ó 
ð 	
r.   )Úreturnr)   )rj   r1   ©rC   ÚintrD   r!   rE   rV   r4   úMetadataParam | Omitr5   úSequenceNotStr[str] | Omitr6   zLiteral[False] | Omitr7   úfloat | Omitr8   ú
int | Omitr9   ro   r:   úList[AnthropicBetaParam] | Omitr;   úHeaders | Noner<   úQuery | Noner=   úBody | Noner>   ú'float | httpx.Timeout | None | NotGivenrj   r    )rC   rl   rD   r!   rE   rV   r6   úLiteral[True]r4   rm   r5   rn   r7   ro   r8   rp   r9   ro   r:   rq   r;   rr   r<   rs   r=   rt   r>   ru   rj   zStream[Completion])rC   rl   rD   r!   rE   rV   r6   Úboolr4   rm   r5   rn   r7   ro   r8   rp   r9   ro   r:   rq   r;   rr   r<   rs   r=   rt   r>   ru   rj   úCompletion | Stream[Completion])rC   rl   rD   r!   rE   rV   r4   rm   r5   rn   r6   ú%Literal[False] | Literal[True] | Omitr7   ro   r8   rp   r9   ro   r:   rq   r;   rr   r<   rs   r=   rt   r>   ru   rj   rx   ©Ú__name__Ú
__module__Ú__qualname__r   r-   r2   r   r   r   rF   r   rA   r.   r,   r$   r$      sž  „ Øò0ó ð0ð ò6ó ð6ð ð *.Ø59Ø(,Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dñ%hð "ðhð ð	hð
 ðhð 'ðhð 3ðhð &ðhð "ðhð ðhð ðhð /ðhð &ðhð  "ð!hð"  ð#hð$ 9ð%hð& 
ò'hó ðhðT ð *.Ø59Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dñ%hð "ðhð ð	hð
 ðhð ðhð 'ðhð 3ðhð "ðhð ðhð ðhð /ðhð &ðhð  "ð!hð"  ð#hð$ 9ð%hð& 
ò'hó ðhðT ð *.Ø59Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dñ%hð "ðhð ð	hð
 ðhð ðhð 'ðhð 3ðhð "ðhð ðhð ðhð /ðhð &ðhð  "ð!hð"  ð#hð$ 9ð%hð& 
)ò'hó ðhñT Ò>Ò@uÓvð *.Ø59Ø8<Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dñ%2
ð "ð2
ð ð	2
ð
 ð2
ð 'ð2
ð 3ð2
ð 6ð2
ð "ð2
ð ð2
ð ð2
ð /ð2
ð &ð2
ð  "ð!2
ð"  ð#2
ð$ 9ð%2
ð& 
)ò'2
ó wñ2
r.   c                  óÚ  — e Zd Zedd„«       Zedd„«       Zeeeeeeeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Z	eeeeeeedddedœ
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Z	eeeeeeedddedœ
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Z	 e
g d	¢g d
¢«      eeeeeeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Z	y)r%   c                ó   — t        | «      S r(   )ÚAsyncCompletionsWithRawResponser*   s    r,   r-   z"AsyncCompletions.with_raw_response¨  s   € ô /¨tÓ4Ð4r.   c                ó   — t        | «      S r0   )Ú%AsyncCompletionsWithStreamingResponser*   s    r,   r2   z(AsyncCompletions.with_streaming_response²  s   € ô 5°TÓ:Ð:r.   Nr3   c             ƒ  ó   K  — y­wr@   rA   rB   s                  r,   rF   zAsyncCompletions.create»  ó   è ø€ ðR 	ùó   ‚rH   c             ƒ  ó   K  — y­wrJ   rA   rK   s                  r,   rF   zAsyncCompletions.create&  r„   r…   c             ƒ  ó   K  — y­wrJ   rA   rK   s                  r,   rF   zAsyncCompletions.create‘  r„   r…   rM   rN   c             ƒ  óÔ  K  — t        |«      s| j                  j                  t        k(  rd}i t	        dt        |
«      rdj                  d„ |
D «       «      nt        i«      ¥|xs i ¥}| j                  dt        |||||||||	dœ	|rt        j                  nt        j                  «      ƒ d {  –—† t        ||||¬«      t        |xs dt        t           ¬	«      ƒ d {  –—† S 7 Œ57 Œ­w)
NrP   rQ   rR   c              3  ó2   K  — | ]  }t        |«      –— Œ y ­wrT   rU   rW   s     r,   rZ   z*AsyncCompletions.create.<locals>.<genexpr>  r[   r\   r]   r^   r_   Fr`   )r   re   r>   r   r   rf   r   rg   r   r	   rh   ri   r   r    r   rB   s                  r,   rF   zAsyncCompletions.createü  s  è ø€ ô* ˜Ô  T§\¡\×%9Ñ%9¼_Ò%LØˆGð
ÜÐ/ÔT\Ð]bÔTc°·±Ñ9PÉ%Ó9PÔ1PÔirÐsÓtð
àÒ" ð
ˆð —Z‘ZØÜ,à,@Ø"Ø$Ø (Ø&4Ø$Ø#.Ø"Ø"ñ
ñ ô )×HÒHä-×PÑPó÷ ô  )Ø+¸ÐQ[Ðelôô Ø’?˜UÜ"¤:Ñ.ð/  ó 
÷ 
ð 	
ðøð
ús$   ‚B,C(Â.C$
Â/0C(ÃC&Ã C(Ã&C()rj   r€   )rj   r‚   rk   )rC   rl   rD   r!   rE   rV   r6   rv   r4   rm   r5   rn   r7   ro   r8   rp   r9   ro   r:   rq   r;   rr   r<   rs   r=   rt   r>   ru   rj   zAsyncStream[Completion])rC   rl   rD   r!   rE   rV   r6   rw   r4   rm   r5   rn   r7   ro   r8   rp   r9   ro   r:   rq   r;   rr   r<   rs   r=   rt   r>   ru   rj   ú$Completion | AsyncStream[Completion])rC   rl   rD   r!   rE   rV   r4   rm   r5   rn   r6   ry   r7   ro   r8   rp   r9   ro   r:   rq   r;   rr   r<   rs   r=   rt   r>   ru   rj   rŠ   rz   rA   r.   r,   r%   r%   §  sž  „ Øò5ó ð5ð ò;ó ð;ð ð *.Ø59Ø(,Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dñ%hð "ðhð ð	hð
 ðhð 'ðhð 3ðhð &ðhð "ðhð ðhð ðhð /ðhð &ðhð  "ð!hð"  ð#hð$ 9ð%hð& 
ò'hó ðhðT ð *.Ø59Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dñ%hð "ðhð ð	hð
 ðhð ðhð 'ðhð 3ðhð "ðhð ðhð ðhð /ðhð &ðhð  "ð!hð"  ð#hð$ 9ð%hð& 
!ò'hó ðhðT ð *.Ø59Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dñ%hð "ðhð ð	hð
 ðhð ðhð 'ðhð 3ðhð "ðhð ðhð ðhð /ðhð &ðhð  "ð!hð"  ð#hð$ 9ð%hð& 
.ò'hó ðhñT Ò>Ò@uÓvð *.Ø59Ø8<Ø$(Ø Ø"Ø15ð )-Ø$(Ø"&Ø;Dñ%2
ð "ð2
ð ð	2
ð
 ð2
ð 'ð2
ð 3ð2
ð 6ð2
ð "ð2
ð ð2
ð ð2
ð /ð2
ð &ð2
ð  "ð!2
ð"  ð#2
ð$ 9ð%2
ð& 
.ò'2
ó wñ2
r.   c                  ó   — e Zd Zdd„Zy)r)   c                óZ   — || _         t        j                  |j                  «      | _        y rT   )Ú_completionsr   Úto_raw_response_wrapperrF   ©r+   Úcompletionss     r,   Ú__init__z#CompletionsWithRawResponse.__init__3  s%   € Ø'ˆÔä&×>Ñ>Ø×Ñó
ˆ�r.   N©r�   r$   rj   ÚNone©r{   r|   r}   r‘   rA   r.   r,   r)   r)   2  ó   „ ô
r.   r)   c                  ó   — e Zd Zdd„Zy)r€   c                óZ   — || _         t        j                  |j                  «      | _        y rT   )r�   r   Úasync_to_raw_response_wrapperrF   r�   s     r,   r‘   z(AsyncCompletionsWithRawResponse.__init__<  s%   € Ø'ˆÔä&×DÑDØ×Ñó
ˆ�r.   N©r�   r%   rj   r“   r”   rA   r.   r,   r€   r€   ;  r•   r.   r€   c                  ó   — e Zd Zdd„Zy)r1   c                óF   — || _         t        |j                  «      | _        y rT   )r�   r   rF   r�   s     r,   r‘   z)CompletionsWithStreamingResponse.__init__E  s   € Ø'ˆÔä2Ø×Ñó
ˆ�r.   Nr’   r”   rA   r.   r,   r1   r1   D  r•   r.   r1   c                  ó   — e Zd Zdd„Zy)r‚   c                óF   — || _         t        |j                  «      | _        y rT   )r�   r   rF   r�   s     r,   r‘   z.AsyncCompletionsWithStreamingResponse.__init__N  s   € Ø'ˆÔä8Ø×Ñó
ˆ�r.   Nr™   r”   rA   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€   r1   r‚   rA   r.   r,   Ú<module>r±      s˜   ðõ #å ß /ã å Ý ,ß Z× ZÓ Zß eÕ eÝ %ß 9ß XÝ (ß ,Ý /Ý )Ý *Ý 0Ý ;àÐ,Ð
-€ôH
�/ô H
ôVH
Ð'ô H
÷V
ñ 
÷
ñ 
÷
ñ 
÷
ò 
r.   