U
    hMI                     @  s\  d dl mZ d dlmZmZ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 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 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% 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Z0G dd dZ1G dd dZ2G dd dZ3G dd dZ4dS )    )annotations)DictIterableOptionalN   )_legacy_response   )Items
AsyncItemsItemsWithRawResponseAsyncItemsWithRawResponseItemsWithStreamingResponseAsyncItemsWithStreamingResponse)	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)make_request_options)conversation_create_paramsconversation_update_params)Metadata)Conversation)ResponseInputItemParam)ConversationDeletedResourceConversationsAsyncConversationsc                	   @  s   e Zd ZeddddZeddddZeddd	d
ZeedddedddddddddddZdddeddddddddddZ	dddedddddddddddZ
dddeddddddd dd!d"ZdS )#r"   r	   returnc                 C  s
   t | jS N)r	   _clientself r*   P/tmp/pip-unpacked-wheel-dms8d3uv/openai/resources/conversations/conversations.pyitems"   s    zConversations.itemsConversationsWithRawResponsec                 C  s   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-   r(   r*   r*   r+   with_raw_response&   s    zConversations.with_raw_response"ConversationsWithStreamingResponsec                 C  s   t | S 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
        )r0   r(   r*   r*   r+   with_streaming_response0   s    z%Conversations.with_streaming_responseNr,   metadataextra_headersextra_query
extra_bodytimeout5Optional[Iterable[ResponseInputItemParam]] | NotGivenOptional[Metadata] | NotGivenHeaders | NoneQuery | NoneBody | None'float | httpx.Timeout | None | NotGivenr   r,   r4   r5   r6   r7   r8   r%   c             	   C  s,   | j dt||dtjt||||dtdS )y  
        Create a conversation.

        Args:
          items: Initial items to include in the conversation context. You may add up to 20 items
              at a time.

          metadata: Set of 16 key-value pairs that can be attached to an object. Useful for storing
              additional information about the object in a structured format.

          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
        /conversationsr,   r4   r5   r6   r7   r8   bodyoptionscast_to)_postr   r   ConversationCreateParamsr   r   r)   r,   r4   r5   r6   r7   r8   r*   r*   r+   create9   s        zConversations.createrC   strconversation_idr5   r6   r7   r8   r%   c                C  s4   |st d|| jd| t||||dtdS )Y  
        Get a conversation with the given ID.

        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
        >Expected a non-empty value for `conversation_id` but received /conversations/rC   rF   rG   
ValueError_getr   r   r)   rN   r5   r6   r7   r8   r*   r*   r+   retrievef   s       zConversations.retrieveDict[str, str]rN   r4   r5   r6   r7   r8   r%   c             	   C  sB   |st d|| jd| td|itjt||||dtdS )  
        Update a conversation's metadata with the given ID.

        Args:
          metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
              for storing additional information about the object in a structured format, and
              querying for objects via API or the dashboard. Keys are strings with a maximum
              length of 64 characters. Values are strings with a maximum length of 512
              characters.

          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
        rP   rQ   r4   rC   rD   )rT   rH   r   r   ConversationUpdateParamsr   r   r)   rN   r4   r5   r6   r7   r8   r*   r*   r+   update   s       zConversations.updater!   c                C  s4   |st d|| jd| t||||dtdS )\  
        Delete a conversation with the given ID.

        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
        rP   rQ   rC   rR   rT   _deleter   r!   rV   r*   r*   r+   delete   s       zConversations.delete__name__
__module____qualname__r   r,   r/   r2   r   rK   rW   r]   ra   r*   r*   r*   r+   r"   !   s8   	3(/c                	   @  s   e Zd ZeddddZeddddZeddd	d
ZeedddedddddddddddZdddeddddddddddZ	dddedddddddddddZ
dddeddddddd dd!d"ZdS )#r#   r
   r$   c                 C  s
   t | jS r&   )r
   r'   r(   r*   r*   r+   r,      s    zAsyncConversations.items!AsyncConversationsWithRawResponsec                 C  s   t | S r.   )rf   r(   r*   r*   r+   r/      s    z$AsyncConversations.with_raw_response'AsyncConversationsWithStreamingResponsec                 C  s   t | S r1   )rg   r(   r*   r*   r+   r2      s    z*AsyncConversations.with_streaming_responseNr3   r9   r:   r;   r<   r=   r>   r   r?   c             	     s8   | j dt||dtjI dH t||||dtdI dH S )r@   rA   rB   NrC   rD   )rH   r   r   rI   r   r   rJ   r*   r*   r+   rK      s        zAsyncConversations.createrC   rL   rM   c                  s:   |st d|| jd| t||||dtdI dH S )rO   rP   rQ   rC   rR   NrS   rV   r*   r*   r+   rW     s       zAsyncConversations.retrieverX   rY   c             	     sN   |st d|| jd| td|itjI dH t||||dtdI dH S )rZ   rP   rQ   r4   NrC   rD   )rT   rH   r   r   r[   r   r   r\   r*   r*   r+   r]   8  s         zAsyncConversations.updater!   c                  s:   |st d|| jd| t||||dtdI dH S )r^   rP   rQ   rC   rR   Nr_   rV   r*   r*   r+   ra   c  s       zAsyncConversations.deleterb   r*   r*   r*   r+   r#      s8   	3(1c                   @  s.   e Zd ZdddddZedddd	Zd
S )r-   r"   Noneconversationsr%   c                 C  sB   || _ t|j| _t|j| _t|j| _t|j| _d S r&   )_conversationsr   Zto_raw_response_wrapperrK   rW   r]   ra   r)   rj   r*   r*   r+   __init__  s    z%ConversationsWithRawResponse.__init__r   r$   c                 C  s   t | jjS r&   )r   rk   r,   r(   r*   r*   r+   r,     s    z"ConversationsWithRawResponse.itemsNrc   rd   re   rm   r   r,   r*   r*   r*   r+   r-     s   r-   c                   @  s.   e Zd ZdddddZedddd	Zd
S )rf   r#   rh   ri   c                 C  sB   || _ t|j| _t|j| _t|j| _t|j| _d S r&   )rk   r   Zasync_to_raw_response_wrapperrK   rW   r]   ra   rl   r*   r*   r+   rm     s    z*AsyncConversationsWithRawResponse.__init__r   r$   c                 C  s   t | jjS r&   )r   rk   r,   r(   r*   r*   r+   r,     s    z'AsyncConversationsWithRawResponse.itemsNrn   r*   r*   r*   r+   rf     s   rf   c                   @  s.   e Zd ZdddddZedddd	Zd
S )r0   r"   rh   ri   c                 C  s:   || _ t|j| _t|j| _t|j| _t|j| _d S r&   )rk   r   rK   rW   r]   ra   rl   r*   r*   r+   rm     s    z+ConversationsWithStreamingResponse.__init__r   r$   c                 C  s   t | jjS r&   )r   rk   r,   r(   r*   r*   r+   r,     s    z(ConversationsWithStreamingResponse.itemsNrn   r*   r*   r*   r+   r0     s   r0   c                   @  s.   e Zd ZdddddZedddd	Zd
S )rg   r#   rh   ri   c                 C  s:   || _ t|j| _t|j| _t|j| _t|j| _d S r&   )rk   r   rK   rW   r]   ra   rl   r*   r*   r+   rm     s    z0AsyncConversationsWithStreamingResponse.__init__r   r$   c                 C  s   t | jjS r&   )r   rk   r,   r(   r*   r*   r+   r,     s    z-AsyncConversationsWithStreamingResponse.itemsNrn   r*   r*   r*   r+   rg     s   rg   )5
__future__r   typingr   r   r   Zhttpx r   r,   r	   r
   r   r   r   r   _typesr   r   r   r   r   _utilsr   r   _compatr   Z	_resourcer   r   	_responser   r   Z_base_clientr   Ztypes.conversationsr   r   Ztypes.shared_params.metadatar   Z types.conversations.conversationr   Z)types.responses.response_input_item_paramr    Z1types.conversations.conversation_deleted_resourcer!   __all__r"   r#   r-   rf   r0   rg   r*   r*   r*   r+   <module>   s0     2 4