
    Mi                    |   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  SS	K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/r, " S S\5      r- " S S\5      r. " S S5      r/ " S S5      r0 " S S5      r1 " S S5      r2g)    )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                     \ 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    y/var/www/eduai.edurigo.com/storigo/production/storigo_env/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5r+   N
metadatastop_sequencesstreamtemperaturetop_ktop_p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.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promptr2   r3   r4   r5   r6   r7   r8   r9   r:   r;   s                 r(   createCompletions.create4       L 	r+   	r2   r3   r5   r6   r7   r8   r9   r:   r;   c                   g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@   rA   rB   r4   r2   r3   r5   r6   r7   r8   r9   r:   r;   s                 r(   rC   rD      rE   r+   c                   grH   r>   rI   s                 r(   rC   rD     rE   r+   r@   rA   rB   r@   rA   rB   r4   c                  [        U5      (       d   U R                  R                  [        :X  a  SnU R	                  S[        UUUUUUUUU	S.	[        R                  5      [        XXS9[        U=(       d    S[        [           S9$ NiX  z/v1/complete)	r@   rA   rB   r2   r3   r4   r5   r6   r7   )r8   r9   r:   r;   F)bodyoptionscast_tor4   
stream_cls)r   _clientr;   r   _postr   r	   CompletionCreateParamsr   r   r   r?   s                 r(   rC   rD   l  s    (   T\\%9%9_%LGzz ,@"$ (&4$#.""
 )?? )+Q[ ?Uj)+  
 	
r+   r>   )returnr%   )rV   r.   r@   intrA   r   rB   strr2   MetadataParam | NotGivenr3   List[str] | NotGivenr4   zLiteral[False] | NotGivenr5   float | NotGivenr6   int | NotGivenr7   r\   r8   Headers | Noner9   Query | Noner:   Body | Noner;   'float | httpx.Timeout | None | NotGivenrV   r   )r@   rX   rA   r   rB   rY   r4   Literal[True]r2   rZ   r3   r[   r5   r\   r6   r]   r7   r\   r8   r^   r9   r_   r:   r`   r;   ra   rV   zStream[Completion])r@   rX   rA   r   rB   rY   r4   boolr2   rZ   r3   r[   r5   r\   r6   r]   r7   r\   r8   r^   r9   r_   r:   r`   r;   ra   rV   Completion | Stream[Completion])r@   rX   rA   r   rB   rY   r2   rZ   r3   r[   r4   )Literal[False] | Literal[True] | NotGivenr5   r\   r6   r]   r7   r\   r8   r^   r9   r_   r:   r`   r;   ra   rV   rd   __name__
__module____qualname____firstlineno__r   r)   r/   r   r
   rC   r   __static_attributes__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                     \ 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4r+   c                    [        U 5      $ r-   )%AsyncCompletionsWithStreamingResponser&   s    r(   r/   (AsyncCompletions.with_streaming_response  s     5T::r+   Nr1   c                  #    g7fr=   r>   r?   s                 r(   rC   AsyncCompletions.create       L 	   rF   c                  #    g7frH   r>   rI   s                 r(   rC   rt     ru   rv   c                  #    g7frH   r>   rI   s                 r(   rC   rt     ru   rv   rK   rL   c               >  #    [        U5      (       d   U R                  R                  [        :X  a  SnU R	                  S[        UUUUUUUUU	S.	[        R                  5      I S h  vN [        XXS9[        U=(       d    S[        [           S9I S h  vN $  N2 N7frN   )r   rS   r;   r   rT   r   r	   rU   r   r   r   r?   s                 r(   rC   rt     s     (   T\\%9%9_%LGZZ,,@"$ (&4$#.""
 )??  )+Q[ ?U":.+   
 
 	

s$   A$B&B
'-BBBBr>   )rV   rn   )rV   rq   rW   )r@   rX   rA   r   rB   rY   r4   rb   r2   rZ   r3   r[   r5   r\   r6   r]   r7   r\   r8   r^   r9   r_   r:   r`   r;   ra   rV   zAsyncStream[Completion])r@   rX   rA   r   rB   rY   r4   rc   r2   rZ   r3   r[   r5   r\   r6   r]   r7   r\   r8   r^   r9   r_   r:   r`   r;   ra   rV   $Completion | AsyncStream[Completion])r@   rX   rA   r   rB   rY   r2   rZ   r3   r[   r4   re   r5   r\   r6   r]   r7   r\   r8   r^   r9   r_   r:   r`   r;   ra   rV   rz   rf   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                      \ 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 N)_completionsr   to_raw_response_wrapperrC   r'   completionss     r(   __init__#CompletionsWithRawResponse.__init__  s#    '&>>
r+   r~   rC   Nr   r   rV   Nonerg   rh   ri   rj   r   rk   r>   r+   r(   r%   r%         
r+   r%   c                      \ rS rSrSS jrSrg)rn   i  c                Z    Xl         [        R                  " UR                  5      U l        g r}   )r~   r   async_to_raw_response_wrapperrC   r   s     r(   r   (AsyncCompletionsWithRawResponse.__init__   s#    '&DD
r+   r   Nr   r    rV   r   r   r>   r+   r(   rn   rn     r   r+   rn   c                      \ rS rSrSS jrSrg)r.   i(  c                D    Xl         [        UR                  5      U l        g r}   )r~   r   rC   r   s     r(   r   )CompletionsWithStreamingResponse.__init__)  s    '2
r+   r   Nr   r   r>   r+   r(   r.   r.   (  r   r+   r.   c                      \ rS rSrSS jrSrg)rq   i1  c                D    Xl         [        UR                  5      U l        g r}   )r~   r   rC   r   s     r(   r   .AsyncCompletionsWithStreamingResponse.__init__2  s    '8
r+   r   Nr   r   r>   r+   r(   rq   rq   1  r   r+   rq   )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%   rn   r.   rq   r>   r+   r(   <module>r      s    #  /   , > >  & 9 X ( , / ) * 0,
-x
/ x
vx
' x
v
 

 

 

 
r+   