
    ̺i                       S SK Jr  S SKJr  S SKJrJr  S SKrSSKJ	r	  SSK
Jr  SSKJrJrJrJrJrJrJrJr  SS	KJrJrJrJrJr  SS
KJr  SSKJrJr  SSK J!r!J"r"  SSK#J$r$  SSK%J&r&J'r'  SSK(J)r)  SSK*J+r+  SSK,J-r-  SSK.J/r/  SSK0J1r1  SS/r2 " S S\5      r3 " S S\5      r4 " S S5      r5 " S S5      r6 " S S5      r7 " S S5      r8g)     )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                     \ rS rSr\SS j5       r\SS j5       r\\\\\\\\SSS\	S.                             SS jj5       r
\\\\\\\SSS\	S.
                             SS jj5       r
\\\\\\\SSS\	S.
                             SS	 jj5       r
\" / S
Q/ SQ5      \\\\\\\SSS\	S.                             SS jj5       r
Srg)r$      c                    [        U 5      $ z
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    ^/var/www/piano.thomer.com/venv/lib/python3.13/site-packages/anthropic/resources/completions.pywith_raw_responseCompletions.with_raw_response   s     *$//    c                    [        U 5      $ 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_response#Completions.with_streaming_response'   s     055r0   Nmetadatastop_sequencesstreamtemperaturetop_ktop_pbetasextra_headersextra_query
extra_bodytimeoutc                   ga  [Legacy] Create a Text Completion.

        The Text Completions API is a legacy API.

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

        Future models and features will not be compatible with Text Completions. See our
        [migration guide](https://docs.claude.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.claude.com/en/api/prompt-validation) and
              our guide to [prompt design](https://docs.claude.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.claude.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`.

          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promptr7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   s                  r-   createCompletions.create0       P 	r0   
r7   r8   r:   r;   r<   r=   r>   r?   r@   rA   c                   ga  [Legacy] Create a Text Completion.

        The Text Completions API is a legacy API.

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

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

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

              See [streaming](https://docs.claude.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`.

          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
        NrD   r,   rF   rG   rH   r9   r7   r8   r:   r;   r<   r=   r>   r?   r@   rA   s                  r-   rI   rJ      rK   r0   c                   grN   rD   rO   s                  r-   rI   rJ     rK   r0   rF   rG   rH   rF   rG   rH   r9   c                  [        U5      (       d   U R                  R                  [        :X  a  Sn0 [	        S[        U
5      (       a  SR                  S U
 5       5      O[        05      EU=(       d    0 EnU R                  S[        UUUUUUUUU	S.	U(       a  [        R                  O[        R                  5      [        XXS9[        U=(       d    S[        [           S	9$ )
NX  anthropic-beta,c              3  8   #    U  H  n[        U5      v   M     g 7fNstr.0es     r-   	<genexpr>%Completions.create.<locals>.<genexpr>       9P%Q#a&&%   /v1/complete	rF   rG   rH   r7   r8   r9   r:   r;   r<   r>   r?   r@   rA   Fbodyoptionscast_tor9   
stream_cls)r   _clientrA   r   r   joinr   _postr   r	   CompletionCreateParamsStreaming"CompletionCreateParamsNonStreamingr   r    r   rE   s                  r-   rI   rJ   n  s    *   T\\%9%9_%LG
/T\]bTcTc9P%9P1Pirst
"
 zz ,@"$ (&4$#.""
  )HH-PP  )+Q[ ?Uj)/  
 	
r0   rD   )returnr*   )ro   r3   rF   intrG   r!   rH   rZ   r7   MetadataParam | Omitr8   SequenceNotStr[str] | Omitr9   zLiteral[False] | Omitr:   float | Omitr;   
int | Omitr<   rt   r=   List[AnthropicBetaParam] | Omitr>   Headers | Noner?   Query | Noner@   Body | NonerA   'float | httpx.Timeout | None | NotGivenro   r    )rF   rq   rG   r!   rH   rZ   r9   Literal[True]r7   rr   r8   rs   r:   rt   r;   ru   r<   rt   r=   rv   r>   rw   r?   rx   r@   ry   rA   rz   ro   zStream[Completion])rF   rq   rG   r!   rH   rZ   r9   boolr7   rr   r8   rs   r:   rt   r;   ru   r<   rt   r=   rv   r>   rw   r?   rx   r@   ry   rA   rz   ro   Completion | Stream[Completion])rF   rq   rG   r!   rH   rZ   r7   rr   r8   rs   r9   %Literal[False] | Literal[True] | Omitr:   rt   r;   ru   r<   rt   r=   rv   r>   rw   r?   rx   r@   ry   rA   rz   ro   r}   __name__
__module____qualname____firstlineno__r   r.   r4   r   r   r   rI   r   __static_attributes__rD   r0   r-   r$   r$      s   0 0 6 6  *.59(,$( "15 )-$("&;D%g "g 	g
 g 'g 3g &g "g g g /g &g  "!g"  #g$ 9%g& 
'g gR  *.59$( "15 )-$("&;D%g "g 	g
 g g 'g 3g "g g g /g &g  "!g"  #g$ 9%g& 
'g gR  *.59$( "15 )-$("&;D%g "g 	g
 g g 'g 3g "g g g /g &g  "!g"  #g$ 9%g& 
)'g gR >@uv *.598<$( "15 )-$("&;D%2
 "2
 	2

 2
 '2
 32
 62
 "2
 2
 2
 /2
 &2
  "!2
"  #2
$ 9%2
& 
)'2
 w2
r0   c                     \ rS rSr\SS j5       r\SS j5       r\\\\\\\\SSS\	S.                             SS jj5       r
\\\\\\\SSS\	S.
                             SS jj5       r
\\\\\\\SSS\	S.
                             SS	 jj5       r
\" / S
Q/ SQ5      \\\\\\\SSS\	S.                             SS jj5       r
Srg)r%   i  c                    [        U 5      $ r)   )AsyncCompletionsWithRawResponser+   s    r-   r.   "AsyncCompletions.with_raw_response  s     /t44r0   c                    [        U 5      $ r2   )%AsyncCompletionsWithStreamingResponser+   s    r-   r4   (AsyncCompletions.with_streaming_response  s     5T::r0   Nr6   c                  #    g7frC   rD   rE   s                  r-   rI   AsyncCompletions.create       P 	   rL   c                  #    g7frN   rD   rO   s                  r-   rI   r   "  r   r   c                  #    g7frN   rD   rO   s                  r-   rI   r     r   r   rQ   rR   c                 #    [        U5      (       d   U R                  R                  [        :X  a  Sn0 [	        S[        U
5      (       a  SR                  S U
 5       5      O[        05      EU=(       d    0 EnU R                  S[        UUUUUUUUU	S.	U(       a  [        R                  O[        R                  5      I S h  vN [        XXS9[        U=(       d    S[        [           S	9I S h  vN $  N2 N7f)
NrT   rU   rV   c              3  8   #    U  H  n[        U5      v   M     g 7frX   rY   r[   s     r-   r^   *AsyncCompletions.create.<locals>.<genexpr>  r`   ra   rb   rc   rd   Fre   )r   rj   rA   r   r   rk   r   rl   r   r	   rm   rn   r   r    r   rE   s                  r-   rI   r     s    *   T\\%9%9_%LG
/T\]bTcTc9P%9P1Pirst
"
 ZZ,,@"$ (&4$#.""
  )HH-PP   )+Q[ ?U":./   
 
 	

s$   CC:C6
-C:1C82C:8C:rD   )ro   r   )ro   r   rp   )rF   rq   rG   r!   rH   rZ   r9   r{   r7   rr   r8   rs   r:   rt   r;   ru   r<   rt   r=   rv   r>   rw   r?   rx   r@   ry   rA   rz   ro   zAsyncStream[Completion])rF   rq   rG   r!   rH   rZ   r9   r|   r7   rr   r8   rs   r:   rt   r;   ru   r<   rt   r=   rv   r>   rw   r?   rx   r@   ry   rA   rz   ro   $Completion | AsyncStream[Completion])rF   rq   rG   r!   rH   rZ   r7   rr   r8   rs   r9   r~   r:   rt   r;   ru   r<   rt   r=   rv   r>   rw   r?   rx   r@   ry   rA   rz   ro   r   r   rD   r0   r-   r%   r%     s   5 5 ; ;  *.59(,$( "15 )-$("&;D%g "g 	g
 g 'g 3g &g "g g g /g &g  "!g"  #g$ 9%g& 
'g gR  *.59$( "15 )-$("&;D%g "g 	g
 g g 'g 3g "g g g /g &g  "!g"  #g$ 9%g& 
!'g gR  *.59$( "15 )-$("&;D%g "g 	g
 g g 'g 3g "g g g /g &g  "!g"  #g$ 9%g& 
.'g gR >@uv *.598<$( "15 )-$("&;D%2
 "2
 	2

 2
 '2
 32
 62
 "2
 2
 2
 /2
 &2
  "!2
"  #2
$ 9%2
& 
.'2
 w2
r0   c                      \ rS rSrSS jrSrg)r*   i,  c                Z    Xl         [        R                  " UR                  5      U l        g rX   )_completionsr   to_raw_response_wrapperrI   r,   completionss     r-   __init__#CompletionsWithRawResponse.__init__-  s#    '&>>
r0   r   rI   Nr   r$   ro   Noner   r   r   r   r   r   rD   r0   r-   r*   r*   ,      
r0   r*   c                      \ rS rSrSS jrSrg)r   i5  c                Z    Xl         [        R                  " UR                  5      U l        g rX   )r   r   async_to_raw_response_wrapperrI   r   s     r-   r   (AsyncCompletionsWithRawResponse.__init__6  s#    '&DD
r0   r   Nr   r%   ro   r   r   rD   r0   r-   r   r   5  r   r0   r   c                      \ rS rSrSS jrSrg)r3   i>  c                D    Xl         [        UR                  5      U l        g rX   )r   r   rI   r   s     r-   r   )CompletionsWithStreamingResponse.__init__?  s    '2
r0   r   Nr   r   rD   r0   r-   r3   r3   >  r   r0   r3   c                      \ rS rSrSS jrSrg)r   iG  c                D    Xl         [        UR                  5      U l        g rX   )r   r   rI   r   s     r-   r   .AsyncCompletionsWithStreamingResponse.__init__H  s    '8
r0   r   Nr   r   rD   r0   r-   r   r   G  r   r0   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   r3   r   rD   r0   r-   <module>r      s    #  /   , Z Z Z e e % 9 X ( , / ) * 0 ;,
-E
/ E
PE
' E
P
 

 

 

 
r0   