o
    r)i^                     @  sx  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 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l/m0Z0 ddl1m2Z2 ddgZ3G dd deZ4G dd deZ5G dd dZ6G dd dZ7G dd dZ8G dd dZ9dS )     )annotations)AnyListIterablecast)LiteralN   )_legacy_response)BodyOmitQueryHeadersNotGivenomit	not_given)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.   h/var/www/html/voicebot/backend/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
        )r2   r,   r.   r.   r/   with_streaming_response)      zItems.with_streaming_responseNincludeextra_headersextra_query
extra_bodytimeoutconversation_idstritems Iterable[ResponseInputItemParam]r7   List[ResponseIncludable] | Omitr8   Headers | Noner9   Query | Noner:   Body | Noner;   'float | httpx.Timeout | None | NotGivenr#   c                C  sR   |s	t d|| j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//itemsr>   r7   r8   r9   r:   r;   querybodyoptionscast_to)
ValueError_postr   r   ItemCreateParamsr   r#   r-   r<   r>   r7   r8   r9   r:   r;   r.   r.   r/   create2   s   
zItems.createitem_idr!   c                C  sf   |s	t d||st d|tt| j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
        rF   6Expected a non-empty value for `item_id` but received rG   /items/r7   rI   rM   rN   )	rO   r   r!   _getr   r   r   ItemRetrieveParamsr   r-   rT   r<   r7   r8   r9   r:   r;   r.   r.   r/   retrieve`   s$   zItems.retrieveafterr7   limitorderr8   r9   r:   r;   r^   
str | Omitr_   
int | Omitr`   Literal['asc', 'desc'] | Omit,SyncConversationCursorPage[ConversationItem]c          
      C  V   |s	t d|| j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
        rF   rG   rH   )r^   r7   r_   r`   rI   )pagerM   model)
rO   _get_api_listr   r!   r   r   r   ItemListParamsr   r   
r-   r<   r^   r7   r_   r`   r8   r9   r:   r;   r.   r.   r/   list   *   8
z
Items.listr8   r9   r:   r;   r   c                C  sL   |s	t d||st d|| j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
        rF   rV   rG   rW   rn   rX   rO   _deleter   r   r-   rT   r<   r8   r9   r:   r;   r.   r.   r/   delete   s   zItems.delete)r(   r)   )r(   r2   r<   r=   r>   r?   r7   r@   r8   rA   r9   rB   r:   rC   r;   rD   r(   r#   rT   r=   r<   r=   r7   r@   r8   rA   r9   rB   r:   rC   r;   rD   r(   r!   )r<   r=   r^   ra   r7   r@   r_   rb   r`   rc   r8   rA   r9   rB   r:   rC   r;   rD   r(   rd   rT   r=   r<   r=   r8   rA   r9   rB   r:   rC   r;   rD   r(   r   __name__
__module____qualname____doc__r   r0   r4   r   r   rS   r\   rl   rs   r.   r.   r.   r/   r$      @    	34Vc                	   @  r&   )4r%   r'   r(   AsyncItemsWithRawResponsec                 C  r*   r+   )r}   r,   r.   r.   r/   r0     r1   zAsyncItems.with_raw_responseAsyncItemsWithStreamingResponsec                 C  r*   r3   )r~   r,   r.   r.   r/   r4     r5   z"AsyncItems.with_streaming_responseNr6   r<   r=   r>   r?   r7   r@   r8   rA   r9   rB   r:   rC   r;   rD   r#   c                  sf   |s
t d|| j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 )	rE   rF   rG   rH   r>   Nr7   rI   rK   )rO   rP   r   r   rQ   r   r#   rR   r.   r.   r/   rS     s   
zAsyncItems.createrT   r!   c                  st   |s
t d||st d|tt| jd| d| t||||td|itjI dH dtttdI dH S )	rU   rF   rV   rG   rW   r7   NrI   rX   )	rO   r   r!   rY   r   r   r   rZ   r   r[   r.   r.   r/   r\   H  s&   
zAsyncItems.retriever]   r^   ra   r_   rb   r`   rc   OAsyncPaginator[ConversationItem, AsyncConversationCursorPage[ConversationItem]]c          
      C  re   rf   )
rO   ri   r   r!   r   r   r   rj   r   r   rk   r.   r.   r/   rl   x  rm   zAsyncItems.listrn   r   c                  sT   |s
t d||st d|| jd| d| t||||dtdI dH S )ro   rF   rV   rG   rW   rn   rX   Nrp   rr   r.   r.   r/   rs     s   zAsyncItems.delete)r(   r}   )r(   r~   rt   ru   )r<   r=   r^   ra   r7   r@   r_   rb   r`   rc   r8   rA   r9   rB   r:   rC   r;   rD   r(   r   rv   rw   r.   r.   r.   r/   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	   to_raw_response_wrapperrS   r\   rl   rs   r-   r>   r.   r.   r/   __init__     
zItemsWithRawResponse.__init__Nr>   r$   r(   r   rx   ry   rz   r   r.   r.   r.   r/   r)         r)   c                   @  r   )	r}   r>   r%   r(   r   c                 C  r   r   )r   r	   async_to_raw_response_wrapperrS   r\   rl   rs   r   r.   r.   r/   r     r   z"AsyncItemsWithRawResponse.__init__Nr>   r%   r(   r   r   r.   r.   r.   r/   r}     r   r}   c                   @  r   )	r2   r>   r$   r(   r   c                 C  :   || _ t|j| _t|j| _t|j| _t|j| _d S r   )r   r   rS   r\   rl   rs   r   r.   r.   r/   r        
z#ItemsWithStreamingResponse.__init__Nr   r   r.   r.   r.   r/   r2     r   r2   c                   @  r   )	r~   r>   r%   r(   r   c                 C  r   r   )r   r   rS   r\   rl   rs   r   r.   r.   r/   r   #  r   z(AsyncItemsWithStreamingResponse.__init__Nr   r   r.   r.   r.   r/   r~   "  r   r~   ):
__future__r   typingr   r   r   r   typing_extensionsr   httpx r	   _typesr
   r   r   r   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r   types.conversationsr   r   r    types.conversations.conversationr   #types.responses.response_includabler    %types.conversations.conversation_itemr!   )types.responses.response_input_item_paramr"   *types.conversations.conversation_item_listr#   __all__r$   r%   r)   r}   r2   r~   r.   r.   r.   r/   <module>   s6   $ i i