o
    i/                     @  sL  d dl mZ d dl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 ddlmZmZmZ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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 )    )annotationsN   )_legacy_response)BodyOmitQueryHeadersNotGivenomit	not_given)path_templatemaybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)make_request_options)ChatSessionWorkflowParamChatSessionRateLimitsParamChatSessionExpiresAfterParam$ChatSessionChatKitConfigurationParamsession_create_params)ChatSession)r   )r   )r   )r   SessionsAsyncSessionsc                   @  Z   e Zd Zed#ddZed$ddZeeeddded	d%ddZdddedd&d!d"Z	dS )'r   returnSessionsWithRawResponsec                 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/openai/openai-python#accessing-raw-response-data-eg-headers
        )r   self r$   `/home/kim/smarthome/.venv/lib/python3.10/site-packages/openai/resources/beta/chatkit/sessions.pywith_raw_response      zSessions.with_raw_responseSessionsWithStreamingResponsec                 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/openai/openai-python#with_streaming_response
        )r(   r"   r$   r$   r%   with_streaming_response)      z Sessions.with_streaming_responseNchatkit_configurationexpires_afterrate_limitsextra_headersextra_query
extra_bodytimeoutuserstrworkflowr   r-   +ChatSessionChatKitConfigurationParam | Omitr.   #ChatSessionExpiresAfterParam | Omitr/   !ChatSessionRateLimitsParam | Omitr0   Headers | Noner1   Query | Noner2   Body | Noner3   'float | httpx.Timeout | None | NotGivenr   c       	   
   	   C  sB   ddi|pi }| j dt|||||dtjt||||	dtdS )u  
        Create a ChatKit session.

        Args:
          user: A free-form string that identifies your end user; ensures this Session can
              access other objects that have the same `user` scope.

          workflow: Workflow that powers the session.

          chatkit_configuration: Optional overrides for ChatKit runtime configuration features

          expires_after: Optional override for session expiration timing in seconds from creation.
              Defaults to 10 minutes.

          rate_limits: Optional override for per-minute request limits. When omitted, defaults to 10.

          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
        OpenAI-Betachatkit_beta=v1/chatkit/sessionsr4   r6   r-   r.   r/   r0   r1   r2   r3   bodyoptionscast_to)_postr   r   SessionCreateParamsr   r   
r#   r4   r6   r-   r.   r/   r0   r1   r2   r3   r$   r$   r%   create2   s"   '
zSessions.createrC   
session_idc                C  sF   |s	t d|ddi|pi }| jtd|dt||||dtdS )  
        Cancel an active ChatKit session and return its most recent metadata.

        Cancelling prevents new requests from using the issued client secret.

        Args:
          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
        9Expected a non-empty value for `session_id` but received r?   r@   %/chatkit/sessions/{session_id}/cancelrL   rC   rF   rG   
ValueErrorrH   r   r   r   r#   rL   r0   r1   r2   r3   r$   r$   r%   cancell   s   
zSessions.cancel)r   r   )r   r(   r4   r5   r6   r   r-   r7   r.   r8   r/   r9   r0   r:   r1   r;   r2   r<   r3   r=   r   r   rL   r5   r0   r:   r1   r;   r2   r<   r3   r=   r   r   
__name__
__module____qualname__r   r&   r*   r
   r   rK   rU   r$   r$   r$   r%   r      $    	@c                   @  r   )'r   r   AsyncSessionsWithRawResponsec                 C  r    r!   )r]   r"   r$   r$   r%   r&      r'   zAsyncSessions.with_raw_response"AsyncSessionsWithStreamingResponsec                 C  r    r)   )r^   r"   r$   r$   r%   r*      r+   z%AsyncSessions.with_streaming_responseNr,   r4   r5   r6   r   r-   r7   r.   r8   r/   r9   r0   r:   r1   r;   r2   r<   r3   r=   r   c       	   
   	     sP   ddi|pi }| j dt|||||dtjI dH t||||	dtdI dH S )r>   r?   r@   rA   rB   NrC   rD   )rH   r   r   rI   r   r   rJ   r$   r$   r%   rK      s$   '
zAsyncSessions.createrC   rL   c                  sN   |s
t d|ddi|pi }| jtd|dt||||dtdI dH S )	rM   rN   r?   r@   rO   rP   rC   rQ   NrR   rT   r$   r$   r%   rU      s   
zAsyncSessions.cancel)r   r]   )r   r^   rV   rW   rX   r$   r$   r$   r%   r      r\   c                   @     e Zd ZdddZdS )	r   sessionsr   r   Nonec                 C  &   || _ t|j| _t|j| _d S N)	_sessionsr   Zto_raw_response_wrapperrK   rU   r#   r`   r$   r$   r%   __init__     
z SessionsWithRawResponse.__init__Nr`   r   r   ra   rY   rZ   r[   rf   r$   r$   r$   r%   r         r   c                   @  r_   )	r]   r`   r   r   ra   c                 C  rb   rc   )rd   r   Zasync_to_raw_response_wrapperrK   rU   re   r$   r$   r%   rf     rg   z%AsyncSessionsWithRawResponse.__init__Nr`   r   r   ra   ri   r$   r$   r$   r%   r]     rj   r]   c                   @  r_   )	r(   r`   r   r   ra   c                 C  "   || _ t|j| _t|j| _d S rc   )rd   r   rK   rU   re   r$   r$   r%   rf        
z&SessionsWithStreamingResponse.__init__Nrh   ri   r$   r$   r$   r%   r(     rj   r(   c                   @  r_   )	r^   r`   r   r   ra   c                 C  rl   rc   )rd   r   rK   rU   re   r$   r$   r%   rf   )  rm   z+AsyncSessionsWithStreamingResponse.__init__Nrk   ri   r$   r$   r$   r%   r^   (  rj   r^   ).
__future__r   Zhttpx r   _typesr   r   r   r   r	   r
   r   Z_utilsr   r   r   Z_compatr   Z	_resourcer   r   	_responser   r   Z_base_clientr   Ztypes.beta.chatkitr   r   r   r   r   Ztypes.beta.chatkit.chat_sessionr   Z.types.beta.chatkit.chat_session_workflow_paramZ1types.beta.chatkit.chat_session_rate_limits_paramZ3types.beta.chatkit.chat_session_expires_after_paramZ;types.beta.chatkit.chat_session_chatkit_configuration_param__all__r   r   r   r]   r(   r^   r$   r$   r$   r%   <module>   s,   $ss