Ë
    -Œ:jy  ã                  ó$  — d dl mZ d dlmZmZmZmZ d dlmZ d dl	Z	ddl
mZmZ ddlmZmZmZmZ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mZ ddlm Z  erddl!m"Z"m#Z# ddgZ$ G d„ de«      Z% G d„ de«      Z& G d„ d«      Z' G d„ d«      Z(y)é    )Úannotations)ÚTYPE_CHECKINGÚListÚUnionÚoverload)ÚLiteralNé   )Ú
CompletionÚcompletion_create_params)Ú	NOT_GIVENÚBodyÚQueryÚHeadersÚNotGiven)Úrequired_argsÚmaybe_transform)ÚSyncAPIResourceÚAsyncAPIResource)Úto_raw_response_wrapperÚasync_to_raw_response_wrapper)ÚStreamÚAsyncStream)Úmake_request_options)Ú	AnthropicÚAsyncAnthropicÚCompletionsÚAsyncCompletionsc                  ó¾  ‡ — e Zd ZU ded<   dˆ fd„Zeeeeeeedddddœ
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Zeeeeeedddddœ		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	„«       Zeeeeeedddddœ		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
„«       Z eg d¢g d¢«      eeeeeedddddœ
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Zˆ xZ	S )r   ÚCompletionsWithRawResponseÚwith_raw_responsec                óD   •— t         ‰| �  |«       t        | «      | _        y ©N)ÚsuperÚ__init__r   r    ©ÚselfÚclientÚ	__class__s     €úa/var/www/html/tokenscope/api/venv/lib/python3.12/site-packages/anthropic/resources/completions.pyr$   zCompletions.__init__   s   ø€ Ü‰Ñ˜Ô Ü!;¸DÓ!AˆÕó    NéX  ©
ÚmetadataÚstop_sequencesÚstreamÚtemperatureÚtop_kÚtop_pÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutc                ó   — y©a¬  
        Create a completion

        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.

              As we improve Claude, we develop new versions of it that you can query. This
              parameter controls which version of Claude answers your request. Right now we
              are offering two model families: Claude, and Claude Instant. You can use them by
              setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See
              [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for
              additional details.

          prompt: The prompt that you want Claude to complete.

              For proper response generation you will need to format your prompt as follows:

              ```javascript
              const userQuestion = r"Why is the sky blue?";
              const prompt = `

Human: ${userQuestion}

Assistant:`;
              ```

              See our
              [comments on prompts](https://docs.anthropic.com/claude/docs/introduction-to-prompt-design)
              for more context.

          metadata: An object describing metadata about the request.

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

              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
              [this guide to SSE events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
              for details.

          temperature: Amount of randomness injected into the response.

              Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical /
              multiple choice, and closer to 1 for creative and generative tasks.

          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).

          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.

          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-   r.   r/   r0   r1   r2   r3   r4   r5   r6   s                 r)   ÚcreatezCompletions.create   ó   € ðt 	r*   ©	r-   r.   r0   r1   r2   r3   r4   r5   r6   c                ó   — y©a¬  
        Create a completion

        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.

              As we improve Claude, we develop new versions of it that you can query. This
              parameter controls which version of Claude answers your request. Right now we
              are offering two model families: Claude, and Claude Instant. You can use them by
              setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See
              [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for
              additional details.

          prompt: The prompt that you want Claude to complete.

              For proper response generation you will need to format your prompt as follows:

              ```javascript
              const userQuestion = r"Why is the sky blue?";
              const prompt = `

Human: ${userQuestion}

Assistant:`;
              ```

              See our
              [comments on prompts](https://docs.anthropic.com/claude/docs/introduction-to-prompt-design)
              for more context.

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

              See
              [this guide to SSE events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
              for details.

          metadata: An object describing metadata about the request.

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

              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. Ranges from 0 to 1. Use temp closer to 0 for analytical /
              multiple choice, and closer to 1 for creative and generative tasks.

          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).

          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.

          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
        Nr9   ©r&   r;   r<   r=   r/   r-   r.   r0   r1   r2   r3   r4   r5   r6   s                 r)   r>   zCompletions.create{   r?   r*   c                ó   — yrB   r9   rC   s                 r)   r>   zCompletions.create×   r?   r*   ©r;   r<   r=   ©r;   r<   r=   r/   c               ó´   — | j                  dt        |||||||||	dœ	t        j                  «      t	        |
|||¬«      t
        |xs dt        t
           ¬«      S ©Nz/v1/complete)	r;   r<   r=   r-   r.   r/   r0   r1   r2   )r3   r4   r5   r6   F)ÚbodyÚoptionsÚcast_tor/   Ú
stream_cls)Ú_postr   r   ÚCompletionCreateParamsr   r
   r   r:   s                 r)   r>   zCompletions.create3  sy   € ð( �z‰zØÜ à,@Ø"Ø$Ø (Ø&4Ø$Ø#.Ø"Ø"ñ
ô )×?Ñ?óô )Ø+¸ÐQ[Ðelôô Ø’?˜UÜœjÑ)ð+ ó 
ð 	
r*   )r'   r   ÚreturnÚNone©r;   Úintr<   ú3Union[str, Literal['claude-2', 'claude-instant-1']]r=   Ústrr-   ú,completion_create_params.Metadata | NotGivenr.   úList[str] | NotGivenr/   zLiteral[False] | NotGivenr0   úfloat | NotGivenr1   úint | NotGivenr2   rW   r3   úHeaders | Noner4   úQuery | Noner5   úBody | Noner6   ú'float | httpx.Timeout | None | NotGivenrO   r
   )r;   rR   r<   rS   r=   rT   r/   úLiteral[True]r-   rU   r.   rV   r0   rW   r1   rX   r2   rW   r3   rY   r4   rZ   r5   r[   r6   r\   rO   zStream[Completion])r;   rR   r<   rS   r=   rT   r/   Úboolr-   rU   r.   rV   r0   rW   r1   rX   r2   rW   r3   rY   r4   rZ   r5   r[   r6   r\   rO   úCompletion | Stream[Completion])r;   rR   r<   rS   r=   rT   r-   rU   r.   rV   r/   ú)Literal[False] | Literal[True] | NotGivenr0   rW   r1   rX   r2   rW   r3   rY   r4   rZ   r5   r[   r6   r\   rO   r_   ©
Ú__name__Ú
__module__Ú__qualname__Ú__annotations__r$   r   r   r>   r   Ú__classcell__©r(   s   @r)   r   r      sZ  ø… Ø1Ó1õBð ð BKØ/8Ø,5Ø(1Ø )Ø"+ð )-Ø$(Ø"&Ø;>ñ#Yð "ðYð Cð	Yð
 ðYð ?ðYð -ðYð *ðYð &ðYð ðYð  ðYð &ðYð "ðYð   ð!Yð" 9ð#Yð$ 
ò%Yó ðYðv ð BKØ/8Ø(1Ø )Ø"+ð )-Ø$(Ø"&Ø;>ñ#Yð "ðYð Cð	Yð
 ðYð ðYð ?ðYð -ðYð &ðYð ðYð  ðYð &ðYð "ðYð   ð!Yð" 9ð#Yð$ 
ò%Yó ðYðv ð BKØ/8Ø(1Ø )Ø"+ð )-Ø$(Ø"&Ø;>ñ#Yð "ðYð Cð	Yð
 ðYð ðYð ?ðYð -ðYð &ðYð ðYð  ðYð &ðYð "ðYð   ð!Yð" 9ð#Yð$ 
)ò%Yó ðYñv Ò>Ò@uÓvð BKØ/8Ø<EØ(1Ø )Ø"+ð )-Ø$(Ø"&Ø;>ñ#)
ð "ð)
ð Cð	)
ð
 ð)
ð ?ð)
ð -ð)
ð :ð)
ð &ð)
ð ð)
ð  ð)
ð &ð)
ð "ð)
ð   ð!)
ð" 9ð#)
ð$ 
)ò%)
ó wô)
r*   c                  ó¾  ‡ — e Zd ZU ded<   dˆ fd„Zeeeeeeedddddœ
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Zeeeeeedddddœ		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	„«       Zeeeeeedddddœ		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
„«       Z eg d¢g d¢«      eeeeeedddddœ
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„«       Zˆ xZ	S )r   ÚAsyncCompletionsWithRawResponser    c                óD   •— t         ‰| �  |«       t        | «      | _        y r"   )r#   r$   ri   r    r%   s     €r)   r$   zAsyncCompletions.__init__c  s   ø€ Ü‰Ñ˜Ô Ü!@ÀÓ!FˆÕr*   Nr+   r,   c             ƒ  ó   K  — y­wr8   r9   r:   s                 r)   r>   zAsyncCompletions.createg  ó   è ø€ ðt 	ùó   ‚r@   c             ƒ  ó   K  — y­wrB   r9   rC   s                 r)   r>   zAsyncCompletions.createÃ  rl   rm   c             ƒ  ó   K  — y­wrB   r9   rC   s                 r)   r>   zAsyncCompletions.create  rl   rm   rE   rF   c             ƒ  óÐ   K  — | j                  dt        |||||||||	dœ	t        j                  «      t	        |
|||¬«      t
        |xs dt        t
           ¬«      ƒ d {  –—† S 7 Œ­wrH   )rM   r   r   rN   r   r
   r   r:   s                 r)   r>   zAsyncCompletions.create{  s‡   è ø€ ð( —Z‘ZØÜ à,@Ø"Ø$Ø (Ø&4Ø$Ø#.Ø"Ø"ñ
ô )×?Ñ?óô )Ø+¸ÐQ[Ðelôô Ø’?˜UÜ"¤:Ñ.ð+  ó 
÷ 
ð 	
ð 
ús   ‚AA&ÁA$Á A&)r'   r   rO   rP   rQ   )r;   rR   r<   rS   r=   rT   r/   r]   r-   rU   r.   rV   r0   rW   r1   rX   r2   rW   r3   rY   r4   rZ   r5   r[   r6   r\   rO   zAsyncStream[Completion])r;   rR   r<   rS   r=   rT   r/   r^   r-   rU   r.   rV   r0   rW   r1   rX   r2   rW   r3   rY   r4   rZ   r5   r[   r6   r\   rO   ú$Completion | AsyncStream[Completion])r;   rR   r<   rS   r=   rT   r-   rU   r.   rV   r/   r`   r0   rW   r1   rX   r2   rW   r3   rY   r4   rZ   r5   r[   r6   r\   rO   rq   ra   rg   s   @r)   r   r   `  sZ  ø… Ø6Ó6õGð ð BKØ/8Ø,5Ø(1Ø )Ø"+ð )-Ø$(Ø"&Ø;>ñ#Yð "ðYð Cð	Yð
 ðYð ?ðYð -ðYð *ðYð &ðYð ðYð  ðYð &ðYð "ðYð   ð!Yð" 9ð#Yð$ 
ò%Yó ðYðv ð BKØ/8Ø(1Ø )Ø"+ð )-Ø$(Ø"&Ø;>ñ#Yð "ðYð Cð	Yð
 ðYð ðYð ?ðYð -ðYð &ðYð ðYð  ðYð &ðYð "ðYð   ð!Yð" 9ð#Yð$ 
!ò%Yó ðYðv ð BKØ/8Ø(1Ø )Ø"+ð )-Ø$(Ø"&Ø;>ñ#Yð "ðYð Cð	Yð
 ðYð ðYð ?ðYð -ðYð &ðYð ðYð  ðYð &ðYð "ðYð   ð!Yð" 9ð#Yð$ 
.ò%Yó ðYñv Ò>Ò@uÓvð BKØ/8Ø<EØ(1Ø )Ø"+ð )-Ø$(Ø"&Ø;>ñ#)
ð "ð)
ð Cð	)
ð
 ð)
ð ?ð)
ð -ð)
ð :ð)
ð &ð)
ð ð)
ð  ð)
ð &ð)
ð "ð)
ð   ð!)
ð" 9ð#)
ð$ 
.ò%)
ó wô)
r*   c                  ó   — e Zd Zdd„Zy)r   c                ó8   — t        |j                  «      | _        y r"   )r   r>   ©r&   Úcompletionss     r)   r$   z#CompletionsWithRawResponse.__init__©  s   € Ü-Ø×Ñó
ˆ�r*   N)ru   r   rO   rP   ©rb   rc   rd   r$   r9   r*   r)   r   r   ¨  ó   „ ô
r*   r   c                  ó   — e Zd Zdd„Zy)ri   c                ó8   — t        |j                  «      | _        y r"   )r   r>   rt   s     r)   r$   z(AsyncCompletionsWithRawResponse.__init__°  s   € Ü3Ø×Ñó
ˆ�r*   N)ru   r   rO   rP   rv   r9   r*   r)   ri   ri   ¯  rw   r*   ri   ))Ú
__future__r   Útypingr   r   r   r   Útyping_extensionsr   ÚhttpxÚtypesr
   r   Ú_typesr   r   r   r   r   Ú_utilsr   r   Ú	_resourcer   r   Ú	_responser   r   Ú
_streamingr   r   Ú_base_clientr   Ú_clientr   r   Ú__all__r   r   r   ri   r9   r*   r)   ú<module>r‡      sr   ðõ #ç 7Ó 7Ý %ã ç 8ß >Õ >ß 3ß 9ß Nß ,Ý /áß3àÐ,Ð
-€ôE
�/ô E
ôP
E
Ð'ô E
÷P

ñ 
÷
ò 
r*   