o
    +ir0                     @  s8  d dl mZ d dl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 ddl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mZ ddl m!Z!m"Z" ddl#m$Z$ ddl%m&Z& ddgZ'G dd deZ(G dd deZ)G dd dZ*G dd dZ+G dd dZ,G dd dZ-dS )    )annotations)ListN   )_legacy_response)model_list_params)BodyOmitQueryHeadersNotGivenomit	not_given)is_givenmaybe_transformstrip_not_given)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncPage	AsyncPage)AsyncPaginatormake_request_options)	ModelInfo)AnthropicBetaParamModelsAsyncModelsc                	   @  ^   e Zd Zed"ddZed#ddZeddded	d$ddZeeeedddedd%d d!Z	dS )&r   returnModelsWithRawResponsec                 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
        )r    self r%   W/var/www/html/psymed-ai/venv/lib/python3.10/site-packages/anthropic/resources/models.pywith_raw_response      zModels.with_raw_responseModelsWithStreamingResponsec                 C  r!   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
        )r)   r#   r%   r%   r&   with_streaming_response#      zModels.with_streaming_responseNbetasextra_headersextra_query
extra_bodytimeoutmodel_idstrr.   List[AnthropicBetaParam] | Omitr/   Headers | Noner0   Query | Noner1   Body | Noner2   'float | httpx.Timeout | None | NotGivenr   c                C  sh   |s	t d|i tdt|rddd |D nti|p!i }| jd| t||||dtdS )	X  
        Get a specific model.

        The Models API response can be used to determine information about a specific
        model or resolve a model alias to a model ID.

        Args:
          model_id: Model identifier or alias.

          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
        7Expected a non-empty value for `model_id` but received anthropic-beta,c                 s      | ]}t |V  qd S Nr4   .0er%   r%   r&   	<genexpr>N       z"Models.retrieve.<locals>.<genexpr>/v1/models/r/   r0   r1   r2   optionscast_to
ValueErrorr   r   joinr   _getr   r   r$   r3   r.   r/   r0   r1   r2   r%   r%   r&   retrieve,   s   &zModels.retrieveafter_id	before_idlimitr.   r/   r0   r1   r2   rR   
str | OmitrS   rT   
int | OmitSyncPage[ModelInfo]c          	      C  h   i t dt|rddd |D nti|pi }| jdtt t||||t|||dt	j
dtdS )	  
        List available models.

        The Models API response can be used to determine which models are available for
        use in the API. More recently released models are listed first.

        Args:
          after_id: ID of the object to use as a cursor for pagination. When provided, returns the
              page of results immediately after this object.

          before_id: ID of the object to use as a cursor for pagination. When provided, returns the
              page of results immediately before this object.

          limit: Number of items to return per page.

              Defaults to `20`. Ranges from `1` to `1000`.

          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
        r<   r=   c                 s  r>   r?   r@   rA   r%   r%   r&   rD      rE   zModels.list.<locals>.<genexpr>
/v1/modelsrR   rS   rT   r/   r0   r1   r2   querypagerI   model)r   r   rM   r   _get_api_listr   r   r   r   r   ModelListParams	r$   rR   rS   rT   r.   r/   r0   r1   r2   r%   r%   r&   listY   .   )&zModels.list)r   r    )r   r)   r3   r4   r.   r5   r/   r6   r0   r7   r1   r8   r2   r9   r   r   )rR   rU   rS   rU   rT   rV   r.   r5   r/   r6   r0   r7   r1   r8   r2   r9   r   rW   
__name__
__module____qualname__r   r'   r+   r   r   rP   rd   r%   r%   r%   r&   r      (    	0c                	   @  r   )&r   r   AsyncModelsWithRawResponsec                 C  r!   r"   )rl   r#   r%   r%   r&   r'      r(   zAsyncModels.with_raw_response AsyncModelsWithStreamingResponsec                 C  r!   r*   )rm   r#   r%   r%   r&   r+      r,   z#AsyncModels.with_streaming_responseNr-   r3   r4   r.   r5   r/   r6   r0   r7   r1   r8   r2   r9   r   c                  sp   |s
t d|i tdt|rddd |D nti|p"i }| jd| t||||dtdI d	H S )
r:   r;   r<   r=   c                 s  r>   r?   r@   rA   r%   r%   r&   rD      rE   z'AsyncModels.retrieve.<locals>.<genexpr>rF   rG   rH   NrK   rO   r%   r%   r&   rP      s   &zAsyncModels.retrieverQ   rR   rU   rS   rT   rV   /AsyncPaginator[ModelInfo, AsyncPage[ModelInfo]]c          	      C  rX   )	rY   r<   r=   c                 s  r>   r?   r@   rA   r%   r%   r&   rD     rE   z#AsyncModels.list.<locals>.<genexpr>rZ   r[   r\   r^   )r   r   rM   r   ra   r   r   r   r   r   rb   rc   r%   r%   r&   rd      re   zAsyncModels.list)r   rl   )r   rm   rf   )rR   rU   rS   rU   rT   rV   r.   r5   r/   r6   r0   r7   r1   r8   r2   r9   r   rn   rg   r%   r%   r%   r&   r      rk   c                   @     e Zd ZdddZdS )	r    modelsr   r   Nonec                 C  &   || _ t|j| _t|j| _d S r?   )_modelsr   to_raw_response_wrapperrP   rd   r$   rp   r%   r%   r&   __init__     
zModelsWithRawResponse.__init__Nrp   r   r   rq   rh   ri   rj   rv   r%   r%   r%   r&   r          r    c                   @  ro   )	rl   rp   r   r   rq   c                 C  rr   r?   )rs   r   async_to_raw_response_wrapperrP   rd   ru   r%   r%   r&   rv   +  rw   z#AsyncModelsWithRawResponse.__init__Nrp   r   r   rq   ry   r%   r%   r%   r&   rl   *  rz   rl   c                   @  ro   )	r)   rp   r   r   rq   c                 C  "   || _ t|j| _t|j| _d S r?   )rs   r   rP   rd   ru   r%   r%   r&   rv   7     
z$ModelsWithStreamingResponse.__init__Nrx   ry   r%   r%   r%   r&   r)   6  rz   r)   c                   @  ro   )	rm   rp   r   r   rq   c                 C  r}   r?   )rs   r   rP   rd   ru   r%   r%   r&   rv   C  r~   z)AsyncModelsWithStreamingResponse.__init__Nr|   ry   r%   r%   r%   r&   rm   B  rz   rm   ).
__future__r   typingr   httpx r   typesr   _typesr   r   r	   r
   r   r   r   _utilsr   r   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r   types.model_infor   types.anthropic_beta_paramr   __all__r   r   r    rl   r)   rm   r%   r%   r%   r&   <module>   s.   $  