Ë
    ö�DjŠŠ  ã                  ó|  — 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 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  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gZ, G d„ de«      Z- G d„ de«      Z. G d„ d«      Z/ G d„ d«      Z0 G d„ d«      Z1 G d„ d«      Z2y)é    )Úannotations)ÚList)ÚLiteralÚoverloadNé   )Ú_legacy_response)Úcompletion_create_params)Ú	NOT_GIVENÚBodyÚQueryÚHeadersÚNotGiven)Úis_givenÚrequired_argsÚmaybe_transformÚ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ÚCompletionsÚAsyncCompletionsc                  óÂ  — e Zd Zedd„«       Zedd„«       Zeeeeeeedddedœ
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Zeeeeeedddedœ		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Z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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
        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    úcC:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\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Úextra_headersÚextra_queryÚ
extra_bodyÚtimeoutc                ó   — y©a[  [Legacy] Create a Text Completion.

        The Text Completions API is a legacy API.

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

        Future models and features will not be compatible with Text Completions. See our
        [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-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://docs.anthropic.com/en/api/prompt-validation) and
              our guide to
              [prompt design](https://docs.anthropic.com/en/docs/intro-to-prompting) 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://docs.anthropic.com/en/api/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. You usually only need to use
              `temperature`.

          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`. You should either alter
              `temperature` or `top_p`, but not both.

              Recommended for advanced use cases only. You usually only need to use
              `temperature`.

          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Úpromptr/   r0   r1   r2   r3   r4   r5   r6   r7   r8   s                 r'   ÚcreatezCompletions.create4   ó   € ðL 	r)   ©	r/   r0   r2   r3   r4   r5   r6   r7   r8   c                ó   — y©a[  [Legacy] Create a Text Completion.

        The Text Completions API is a legacy API.

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

        Future models and features will not be compatible with Text Completions. See our
        [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-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://docs.anthropic.com/en/api/prompt-validation) and
              our guide to
              [prompt design](https://docs.anthropic.com/en/docs/intro-to-prompting) for more
              details.

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

              See [streaming](https://docs.anthropic.com/en/api/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. You usually only need to use
              `temperature`.

          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`. You should either alter
              `temperature` or `top_p`, but not both.

              Recommended for advanced use cases only. You usually only need to use
              `temperature`.

          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
        Nr;   ©r&   r=   r>   r?   r1   r/   r0   r2   r3   r4   r5   r6   r7   r8   s                 r'   r@   zCompletions.createœ   rA   r)   c                ó   — yrD   r;   rE   s                 r'   r@   zCompletions.create  rA   r)   ©r=   r>   r?   ©r=   r>   r?   r1   c               ó  — t        |«      s| j                  j                  t        k(  rd}| j	                  dt        |||||||||	dœ	t        j                  «      t        |
|||¬«      t        |xs dt        t           ¬«      S ©NiX  z/v1/complete)	r=   r>   r?   r/   r0   r1   r2   r3   r4   )r5   r6   r7   r8   F)ÚbodyÚoptionsÚcast_tor1   Ú
stream_cls)r   Ú_clientr8   r   Ú_postr   r	   ÚCompletionCreateParamsr   r   r   r<   s                 r'   r@   zCompletions.createl  s—   € ô( ˜Ô  T§\¡\×%9Ñ%9¼_Ò%LØˆGØ�z‰zØÜ à,@Ø"Ø$Ø (Ø&4Ø$Ø#.Ø"Ø"ñ
ô )×?Ñ?óô )Ø+¸ÐQ[Ðelôô Ø’?˜UÜœjÑ)ð+ ó 
ð 	
r)   )Úreturnr$   )rR   r,   ©r=   Úintr>   r   r?   Ústrr/   úMetadataParam | NotGivenr0   úList[str] | NotGivenr1   zLiteral[False] | NotGivenr2   úfloat | NotGivenr3   úint | NotGivenr4   rX   r5   úHeaders | Noner6   úQuery | Noner7   úBody | Noner8   ú'float | httpx.Timeout | None | NotGivenrR   r   )r=   rT   r>   r   r?   rU   r1   úLiteral[True]r/   rV   r0   rW   r2   rX   r3   rY   r4   rX   r5   rZ   r6   r[   r7   r\   r8   r]   rR   zStream[Completion])r=   rT   r>   r   r?   rU   r1   Úboolr/   rV   r0   rW   r2   rX   r3   rY   r4   rX   r5   rZ   r6   r[   r7   r\   r8   r]   rR   úCompletion | Stream[Completion])r=   rT   r>   r   r?   rU   r/   rV   r0   rW   r1   ú)Literal[False] | Literal[True] | NotGivenr2   rX   r3   rY   r4   rX   r5   rZ   r6   r[   r7   r\   r8   r]   rR   r`   ©
Ú__name__Ú
__module__Ú__qualname__r   r(   r-   r   r
   r@   r   r;   r)   r'   r   r       sg  „ Øò0ó ð0ð ò6ó ð6ð ð .7Ø/8Ø,5Ø(1Ø )Ø"+ð )-Ø$(Ø"&Ø;Dñ#eð "ðeð ð	eð
 ðeð +ðeð -ðeð *ðeð &ðeð ðeð  ðeð &ðeð "ðeð   ð!eð" 9ð#eð$ 
ò%eó ðeðN ð .7Ø/8Ø(1Ø )Ø"+ð )-Ø$(Ø"&Ø;Dñ#eð "ðeð ð	eð
 ðeð ðeð +ðeð -ðeð &ðeð ðeð  ðeð &ðeð "ðeð   ð!eð" 9ð#eð$ 
ò%eó ðeðN ð .7Ø/8Ø(1Ø )Ø"+ð )-Ø$(Ø"&Ø;Dñ#eð "ðeð ð	eð
 ðeð ðeð +ðeð -ðeð &ðeð ðeð  ðeð &ðeð "ðeð   ð!eð" 9ð#eð$ 
)ò%eó ðeñN Ò>Ò@uÓvð .7Ø/8Ø<EØ(1Ø )Ø"+ð )-Ø$(Ø"&Ø;Dñ#+
ð "ð+
ð ð	+
ð
 ð+
ð +ð+
ð -ð+
ð :ð+
ð &ð+
ð ð+
ð  ð+
ð &ð+
ð "ð+
ð   ð!+
ð" 9ð#+
ð$ 
)ò%+
ó wñ+
r)   c                  óÂ  — e Zd Zedd„«       Zedd„«       Zeeeeeeedddedœ
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Zeeeeeedddedœ		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Z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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 r+   )Ú%AsyncCompletionsWithStreamingResponser%   s    r'   r-   z(AsyncCompletions.with_streaming_response¦  s   € ô 5°TÓ:Ð:r)   Nr.   c             ƒ  ó   K  — y­wr:   r;   r<   s                 r'   r@   zAsyncCompletions.create¯  ó   è ø€ ðL 	ùó   ‚rB   c             ƒ  ó   K  — y­wrD   r;   rE   s                 r'   r@   zAsyncCompletions.create  rl   rm   c             ƒ  ó   K  — y­wrD   r;   rE   s                 r'   r@   zAsyncCompletions.create  rl   rm   rG   rH   c             ƒ  ó8  K  — t        |«      s| j                  j                  t        k(  rd}| j	                  dt        |||||||||	dœ	t        j                  «      ƒ d {  –—† t        |
|||¬«      t        |xs dt        t           ¬«      ƒ d {  –—† S 7 Œ57 Œ­wrJ   )r   rO   r8   r   rP   r   r	   rQ   r   r   r   r<   s                 r'   r@   zAsyncCompletions.createç  s°   è ø€ ô( ˜Ô  T§\¡\×%9Ñ%9¼_Ò%LØˆGØ—Z‘ZØÜ,à,@Ø"Ø$Ø (Ø&4Ø$Ø#.Ø"Ø"ñ
ô )×?Ñ?ó÷ ô )Ø+¸ÐQ[Ðelôô Ø’?˜UÜ"¤:Ñ.ð+  ó 
÷ 
ð 	
ðøð
ús$   ‚ABÁ B
Á!0BÂBÂBÂB)rR   rh   )rR   rj   rS   )r=   rT   r>   r   r?   rU   r1   r^   r/   rV   r0   rW   r2   rX   r3   rY   r4   rX   r5   rZ   r6   r[   r7   r\   r8   r]   rR   zAsyncStream[Completion])r=   rT   r>   r   r?   rU   r1   r_   r/   rV   r0   rW   r2   rX   r3   rY   r4   rX   r5   rZ   r6   r[   r7   r\   r8   r]   rR   ú$Completion | AsyncStream[Completion])r=   rT   r>   r   r?   rU   r/   rV   r0   rW   r1   ra   r2   rX   r3   rY   r4   rX   r5   rZ   r6   r[   r7   r\   r8   r]   rR   rq   rb   r;   r)   r'   r    r    ›  sg  „ Øò5ó ð5ð ò;ó ð;ð ð .7Ø/8Ø,5Ø(1Ø )Ø"+ð )-Ø$(Ø"&Ø;Dñ#eð "ðeð ð	eð
 ðeð +ðeð -ðeð *ðeð &ðeð ðeð  ðeð &ðeð "ðeð   ð!eð" 9ð#eð$ 
ò%eó ðeðN ð .7Ø/8Ø(1Ø )Ø"+ð )-Ø$(Ø"&Ø;Dñ#eð "ðeð ð	eð
 ðeð ðeð +ðeð -ðeð &ðeð ðeð  ðeð &ðeð "ðeð   ð!eð" 9ð#eð$ 
!ò%eó ðeðN ð .7Ø/8Ø(1Ø )Ø"+ð )-Ø$(Ø"&Ø;Dñ#eð "ðeð ð	eð
 ðeð ðeð +ðeð -ðeð &ðeð ðeð  ðeð &ðeð "ðeð   ð!eð" 9ð#eð$ 
.ò%eó ðeñN Ò>Ò@uÓvð .7Ø/8Ø<EØ(1Ø )Ø"+ð )-Ø$(Ø"&Ø;Dñ#+
ð "ð+
ð ð	+
ð
 ð+
ð +ð+
ð -ð+
ð :ð+
ð &ð+
ð ð+
ð  ð+
ð &ð+
ð "ð+
ð   ð!+
ð" 9ð#+
ð$ 
.ò%+
ó wñ+
r)   c                  ó   — e Zd Zdd„Zy)r$   c                óZ   — || _         t        j                  |j                  «      | _        y ©N)Ú_completionsr   Úto_raw_response_wrapperr@   ©r&   Úcompletionss     r'   Ú__init__z#CompletionsWithRawResponse.__init__  s%   € Ø'ˆÔä&×>Ñ>Ø×Ñó
ˆ�r)   N©rx   r   rR   ÚNone©rc   rd   re   ry   r;   r)   r'   r$   r$     ó   „ ô
r)   r$   c                  ó   — e Zd Zdd„Zy)rh   c                óZ   — || _         t        j                  |j                  «      | _        y rt   )ru   r   Úasync_to_raw_response_wrapperr@   rw   s     r'   ry   z(AsyncCompletionsWithRawResponse.__init__   s%   € Ø'ˆÔä&×DÑDØ×Ñó
ˆ�r)   N©rx   r    rR   r{   r|   r;   r)   r'   rh   rh     r}   r)   rh   c                  ó   — e Zd Zdd„Zy)r,   c                óF   — || _         t        |j                  «      | _        y rt   )ru   r   r@   rw   s     r'   ry   z)CompletionsWithStreamingResponse.__init__)  s   € Ø'ˆÔä2Ø×Ñó
ˆ�r)   Nrz   r|   r;   r)   r'   r,   r,   (  r}   r)   r,   c                  ó   — e Zd Zdd„Zy)rj   c                óF   — || _         t        |j                  «      | _        y rt   )ru   r   r@   rw   s     r'   ry   z.AsyncCompletionsWithStreamingResponse.__init__2  s   € Ø'ˆÔä8Ø×Ñó
ˆ�r)   Nr�   r|   r;   r)   r'   rj   rj   1  r}   r)   rj   )3Ú
__future__r   Útypingr   Útyping_extensionsr   r   ÚhttpxÚ r   Útypesr	   Ú_typesr
   r   r   r   r   Ú_utilsr   r   r   r   Ú_compatr   Ú	_resourcer   r   Ú	_responser   r   Ú
_constantsr   Ú
_streamingr   r   Ú_base_clientr   Útypes.completionr   Útypes.model_paramr   Útypes.metadata_paramr   Ú__all__r   r    r$   rh   r,   rj   r;   r)   r'   ú<module>r˜      s˜   ðõ #å ß /ã å Ý ,ß >Õ >÷ó õ &ß 9ß XÝ (ß ,Ý /Ý )Ý *Ý 0àÐ,Ð
-€ôx
�/ô x
ôvx
Ð'ô x
÷v
ñ 
÷
ñ 
÷
ñ 
÷
ò 
r)   