o
    id`                     @  s|  d dl mZ d dlmZmZmZmZ 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!m"Z" ddl#m$Z$m%Z% ddl&m'Z'm(Z(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddgZ4G dd deZ5G dd deZ6G dd dZ7G dd dZ8G dd dZ9G dd dZ:dS )     )annotations)AnyListIterablecast)LiteralN   )_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)SyncConversationCursorPageAsyncConversationCursorPage)AsyncPaginatormake_request_options)item_list_paramsitem_create_paramsitem_retrieve_params)Conversation)ResponseIncludable)ConversationItem)ResponseInputItemParam)ConversationItemListItems
AsyncItemsc                	   @     e Zd ZdZed.ddZed/ddZed	d	d	ed
d0ddZ	ed	d	d	ed
d1ddZ
eeeed	d	d	ed d2d(d)Zd	d	d	ed*d3d,d-Zd	S )4r%   ,Manage conversations and conversation items.returnItemsWithRawResponsec                 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/conversations/items.pywith_raw_response      zItems.with_raw_responseItemsWithStreamingResponsec                 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
        )r3   r-   r/   r/   r0   with_streaming_response)      zItems.with_streaming_responseNincludeextra_headersextra_query
extra_bodytimeoutconversation_idstritems Iterable[ResponseInputItemParam]r8   List[ResponseIncludable] | Omitr9   Headers | Noner:   Query | Noner;   Body | Noner<   'float | httpx.Timeout | None | NotGivenr$   c                C  sR   |s	t d|| jtd|dtd|itjt||||td|itjdtdS )  
        Create items in a conversation with the given ID.

        Args:
          items: The items to add to the conversation. You may add up to 20 items at a time.

          include: Additional fields to include in the response. See the `include` parameter for
              [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
              for more information.

          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/{conversation_id}/itemsr=   r?   r8   r9   r:   r;   r<   querybodyoptionscast_to)
ValueError_postr   r   r   ItemCreateParamsr   r$   r.   r=   r?   r8   r9   r:   r;   r<   r/   r/   r0   create2   s   
zItems.createitem_idr"   c                C  sd   |s	t d||st d|tt| jtd||dt||||td|itjdtt	tdS )  
        Get a single item from a conversation with the given IDs.

        Args:
          include: Additional fields to include in the response. See the `include` parameter for
              [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
              for more information.

          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
        rG   6Expected a non-empty value for `item_id` but received 0/conversations/{conversation_id}/items/{item_id}r=   rU   r8   rJ   rN   rO   )
rP   r   r"   _getr   r   r   r   ItemRetrieveParamsr   r.   rU   r=   r8   r9   r:   r;   r<   r/   r/   r0   retrieve`   s(   zItems.retrieveafterr8   limitorderr9   r:   r;   r<   r`   
str | Omitra   
int | Omitrb   Literal['asc', 'desc'] | Omit,SyncConversationCursorPage[ConversationItem]c          
      C  V   |s	t d|| jtd|dtt t||||	t||||dtjdt	t
tdS a  
        List all items for a conversation with the given ID.

        Args:
          after: An item ID to list items after, used in pagination.

          include: Specify additional output data to include in the model response. Currently
              supported values are:

              - `web_search_call.action.sources`: Include the sources of the web search tool
                call.
              - `code_interpreter_call.outputs`: Includes the outputs of python code execution
                in code interpreter tool call items.
              - `computer_call_output.output.image_url`: Include image urls from the computer
                call output.
              - `file_search_call.results`: Include the search results of the file search tool
                call.
              - `message.input_image.image_url`: Include image urls from the input message.
              - `message.output_text.logprobs`: Include logprobs with assistant messages.
              - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
                tokens in reasoning item outputs. This enables reasoning items to be used in
                multi-turn conversations when using the Responses API statelessly (like when
                the `store` parameter is set to `false`, or when an organization is enrolled
                in the zero data retention program).

          limit: A limit on the number of objects to be returned. Limit can range between 1 and
              100, and the default is 20.

          order: The order to return the input items in. Default is `desc`.

              - `asc`: Return the input items in ascending order.
              - `desc`: Return the input items in descending order.

          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
        rG   rH   rI   )r`   r8   ra   rb   rJ   )pagerN   model)rP   _get_api_listr   r   r"   r   r   r   ItemListParamsr   r   
r.   r=   r`   r8   ra   rb   r9   r:   r;   r<   r/   r/   r0   list   *   8
z
Items.listr9   r:   r;   r<   r    c                C  sJ   |s	t d||st d|| jtd||dt||||dtdS )j  
        Delete an item from a conversation with the given IDs.

        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
        rG   rW   rX   rY   rp   rZ   rP   _deleter   r   r    r.   rU   r=   r9   r:   r;   r<   r/   r/   r0   delete   s   zItems.delete)r)   r*   )r)   r3   r=   r>   r?   r@   r8   rA   r9   rB   r:   rC   r;   rD   r<   rE   r)   r$   rU   r>   r=   r>   r8   rA   r9   rB   r:   rC   r;   rD   r<   rE   r)   r"   )r=   r>   r`   rc   r8   rA   ra   rd   rb   re   r9   rB   r:   rC   r;   rD   r<   rE   r)   rf   rU   r>   r=   r>   r9   rB   r:   rC   r;   rD   r<   rE   r)   r    __name__
__module____qualname____doc__r   r1   r5   r   r   rT   r^   rn   ru   r/   r/   r/   r0   r%      @    	36Vc                	   @  r'   )4r&   r(   r)   AsyncItemsWithRawResponsec                 C  r+   r,   )r   r-   r/   r/   r0   r1     r2   zAsyncItems.with_raw_responseAsyncItemsWithStreamingResponsec                 C  r+   r4   )r   r-   r/   r/   r0   r5     r6   z"AsyncItems.with_streaming_responseNr7   r=   r>   r?   r@   r8   rA   r9   rB   r:   rC   r;   rD   r<   rE   r$   c                  sf   |s
t d|| jtd|dtd|itjI dH t||||td|itjI dH dtdI dH S )	rF   rG   rH   rI   r?   Nr8   rJ   rL   )rP   rQ   r   r   r   rR   r   r$   rS   r/   r/   r0   rT     s   
zAsyncItems.createrU   r"   c                  sr   |s
t d||st d|tt| jtd||dt||||td|itjI dH dtt	tdI dH S )	rV   rG   rW   rX   rY   r8   NrJ   rZ   )
rP   r   r"   r[   r   r   r   r   r\   r   r]   r/   r/   r0   r^   L  s*   
zAsyncItems.retriever_   r`   rc   ra   rd   rb   re   OAsyncPaginator[ConversationItem, AsyncConversationCursorPage[ConversationItem]]c          
      C  rg   rh   )rP   rk   r   r   r"   r   r   r   rl   r   r   rm   r/   r/   r0   rn   ~  ro   zAsyncItems.listrp   r    c                  sR   |s
t d||st d|| jtd||dt||||dtdI dH S )rq   rG   rW   rX   rY   rp   rZ   Nrr   rt   r/   r/   r0   ru     s   zAsyncItems.delete)r)   r   )r)   r   rv   rw   )r=   r>   r`   rc   r8   rA   ra   rd   rb   re   r9   rB   r:   rC   r;   rD   r<   rE   r)   r   rx   ry   r/   r/   r/   r0   r&     r~   c                   @     e Zd ZdddZdS )	r*   r?   r%   r)   Nonec                 C  B   || _ t|j| _t|j| _t|j| _t|j| _d S N)_itemsr	   Zto_raw_response_wrapperrT   r^   rn   ru   r.   r?   r/   r/   r0   __init__     
zItemsWithRawResponse.__init__Nr?   r%   r)   r   rz   r{   r|   r   r/   r/   r/   r0   r*         r*   c                   @  r   )	r   r?   r&   r)   r   c                 C  r   r   )r   r	   Zasync_to_raw_response_wrapperrT   r^   rn   ru   r   r/   r/   r0   r     r   z"AsyncItemsWithRawResponse.__init__Nr?   r&   r)   r   r   r/   r/   r/   r0   r     r   r   c                   @  r   )	r3   r?   r%   r)   r   c                 C  :   || _ t|j| _t|j| _t|j| _t|j| _d S r   )r   r   rT   r^   rn   ru   r   r/   r/   r0   r        
z#ItemsWithStreamingResponse.__init__Nr   r   r/   r/   r/   r0   r3     r   r3   c                   @  r   )	r   r?   r&   r)   r   c                 C  r   r   )r   r   rT   r^   rn   ru   r   r/   r/   r0   r   +  r   z(AsyncItemsWithStreamingResponse.__init__Nr   r   r/   r/   r/   r0   r   *  r   r   );
__future__r   typingr   r   r   r   Ztyping_extensionsr   Zhttpx r	   _typesr
   r   r   r   r   r   r   Z_utilsr   r   r   Z_compatr   Z	_resourcer   r   	_responser   r   Z
paginationr   r   Z_base_clientr   r   Ztypes.conversationsr   r   r   Z types.conversations.conversationr    Z#types.responses.response_includabler!   Z%types.conversations.conversation_itemr"   Z)types.responses.response_input_item_paramr#   Z*types.conversations.conversation_item_listr$   __all__r%   r&   r*   r   r3   r   r/   r/   r/   r0   <module>   s6   $ m m