
    qi^                       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Z3 G d de      Z4 G d de      Z5 G d d      Z6 G d d      Z7 G d d      Z8 G d d      Z9y)     )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       Zedd       Zeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	eddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ
eeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Zddded
	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)r%   ,Manage conversations and conversation items.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
        )ItemsWithRawResponseselfs    V/opt/pipecat/venv/lib/python3.12/site-packages/openai/resources/conversations/items.pywith_raw_responsezItems.with_raw_response   s     $D))    c                    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
        )ItemsWithStreamingResponser,   s    r.   with_streaming_responsezItems.with_streaming_response)   s     *$//r0   Nincludeextra_headersextra_query
extra_bodytimeoutc                   |st        d|      | j                  d| dt        d|it        j                        t        ||||t        d|it        j                              t              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//itemsitemsr6   r7   r8   r9   r:   querybodyoptionscast_to)
ValueError_postr   r   ItemCreateParamsr   r$   r-   conversation_idr@   r6   r7   r8   r9   r:   s           r.   createzItems.create2   s    > ]^m]pqrrzzo.f5 '5!13E3V3VW(+'%%y'&:<N<_<_` )  
 	
r0   c                  |st        d|      |st        d|      t        t        | j                  d| d| t	        ||||t        d|it        j                              t        t        t                          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
        r=   6Expected a non-empty value for `item_id` but received r>   /items/r6   rA   rE   rF   )	rG   r   r"   _getr   r   r   ItemRetrieveParamsr   r-   item_idrK   r6   r7   r8   r9   r:   s           r.   retrievezItems.retrieve`   s    : ]^m]pqrrUV]U`abbII!/!2''C,"/ +)#)9g*>@T@g@gh S"23  

 	
r0   afterr6   limitorderr7   r8   r9   r:   c                   |st        d|      | j                  d| dt        t           t	        ||||	t        ||||dt        j                              t        t        t                    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
        r=   r>   r?   )rX   r6   rY   rZ   rA   )pagerE   model)
rG   _get_api_listr   r"   r   r   r   ItemListParamsr   r   
r-   rK   rX   r6   rY   rZ   r7   r8   r9   r:   s
             r.   listz
Items.list   s    p ]^m]pqrr!!o.f5+,<=(+'%%!&#*!&!&	 %33 s,-% " 
 	
r0   r7   r8   r9   r:   c          	         |st        d|      |st        d|      | j                  d| d| t        ||||      t              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
        r=   rO   r>   rP   rc   rQ   rG   _deleter   r    r-   rU   rK   r7   r8   r9   r:   s          r.   deletezItems.delete   ss    0 ]^m]pqrrUV]U`abb||o.ggY?(+Q[el !  
 	
r0   )returnr+   )rj   r3   rK   strr@   z Iterable[ResponseInputItemParam]r6   List[ResponseIncludable] | Omitr7   Headers | Noner8   Query | Noner9   Body | Noner:   'float | httpx.Timeout | None | NotGivenrj   r$   rU   rl   rK   rl   r6   rm   r7   rn   r8   ro   r9   rp   r:   rq   rj   r"   )rK   rl   rX   
str | Omitr6   rm   rY   
int | OmitrZ   Literal['asc', 'desc'] | Omitr7   rn   r8   ro   r9   rp   r:   rq   rj   z,SyncConversationCursorPage[ConversationItem]rU   rl   rK   rl   r7   rn   r8   ro   r9   rp   r:   rq   rj   r    __name__
__module____qualname____doc__r   r/   r4   r   r   rL   rV   rb   ri    r0   r.   r%   r%      s   6* * 0 0 48 )-$("&;D,
,
 0	,

 1,
 &,
 ",
  ,
 9,
 
,
f 48 )-$("&;D.
.
 	.

 1.
 &.
 ".
  .
 9.
 
.
h !37 /3 )-$("&;DM
M
 	M

 1M
 M
 -M
 &M
 "M
  M
 9M
 
6M
l )-$("&;D"
"
 	"
 &"
 ""
  "
 9"
 
"
r0   c            	         e Zd ZdZedd       Zedd       Zeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	eddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ
eeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Zddded
	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)r&   r(   c                    t        |       S r*   )AsyncItemsWithRawResponser,   s    r.   r/   zAsyncItems.with_raw_response  s     )..r0   c                    t        |       S r2   )AsyncItemsWithStreamingResponser,   s    r.   r4   z"AsyncItems.with_streaming_response  s     /t44r0   Nr5   c               $  K   |st        d|      | j                  d| dt        d|it        j                         d{   t        ||||t        d|it        j                         d{         t               d{   S 7 G7 7 w)	r<   r=   r>   r?   r@   Nr6   rA   rC   )rG   rH   r   r   rI   r   r$   rJ   s           r.   rL   zAsyncItems.create  s     > ]^m]pqrrZZo.f5,gu-=?Q?b?bcc(+'%19g2FHZHkHkll )   
 
 	
c m
s6   A BB

+B.B/BBBBBc               6  K   |st        d|      |st        d|      t        t        | j                  d| d| t	        ||||t        d|it        j                         d{         t        t        t                     d{         S 7 -7 
w)	rN   r=   rO   r>   rP   r6   NrA   rQ   )	rG   r   r"   rR   r   r   r   rS   r   rT   s           r.   rV   zAsyncItems.retrieveH  s     : ]^m]pqrrUV]U`abb))!/!2''C,"/ +)# 5y'6JL`LsLs tt S"23  
 

 	
 u
s$   A%B'B($BB
	BBrW   c                   |st        d|      | j                  d| dt        t           t	        ||||	t        ||||dt        j                              t        t        t                    S r\   )
rG   r_   r   r"   r   r   r   r`   r   r   ra   s
             r.   rb   zAsyncItems.listx  s    p ]^m]pqrr!!o.f5,-=>(+'%%!&#*!&!&	 %33 s,-% " 
 	
r0   rc   c          	        K   |st        d|      |st        d|      | j                  d| d| t        ||||      t               d{   S 7 w)re   r=   rO   r>   rP   rc   rQ   Nrf   rh   s          r.   ri   zAsyncItems.delete  s     0 ]^m]pqrrUV]U`abb\\o.ggY?(+Q[el ! " 
 
 	
 
s   AAAA)rj   r   )rj   r   rk   rr   )rK   rl   rX   rs   r6   rm   rY   rt   rZ   ru   r7   rn   r8   ro   r9   rp   r:   rq   rj   zOAsyncPaginator[ConversationItem, AsyncConversationCursorPage[ConversationItem]]rv   rw   r|   r0   r.   r&   r&     s   6/ / 5 5 48 )-$("&;D,
,
 0	,

 1,
 &,
 ",
  ,
 9,
 
,
f 48 )-$("&;D.
.
 	.

 1.
 &.
 ".
  .
 9.
 
.
h !37 /3 )-$("&;DM
M
 	M

 1M
 M
 -M
 &M
 "M
  M
 9M
 
YM
l )-$("&;D"
"
 	"
 &"
 ""
  "
 9"
 
"
r0   c                      e Zd ZddZy)r+   c                2   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        y N)_itemsr
   to_raw_response_wrapperrL   rV   rb   ri   r-   r@   s     r.   __init__zItemsWithRawResponse.__init__  ss    &>>LL
 )@@NN
 %<<JJ
	 '>>LL
r0   Nr@   r%   rj   Nonerx   ry   rz   r   r|   r0   r.   r+   r+         
r0   r+   c                      e Zd ZddZy)r   c                2   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        y r   )r   r
   async_to_raw_response_wrapperrL   rV   rb   ri   r   s     r.   r   z"AsyncItemsWithRawResponse.__init__  ss    &DDLL
 )FFNN
 %BBJJ
	 'DDLL
r0   Nr@   r&   rj   r   r   r|   r0   r.   r   r     r   r0   r   c                      e Zd ZddZy)r3   c                    || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        y r   )r   r   rL   rV   rb   ri   r   s     r.   r   z#ItemsWithStreamingResponse.__init__  s[    2LL
 5NN
 1JJ
	 3LL
r0   Nr   r   r|   r0   r.   r3   r3     r   r0   r3   c                      e Zd ZddZy)r   c                    || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        y r   )r   r   rL   rV   rb   ri   r   s     r.   r   z(AsyncItemsWithStreamingResponse.__init__#  s[    8LL
 ;NN
 7JJ
	 9LL
r0   Nr   r   r|   r0   r.   r   r   "  r   r0   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   r3   r   r|   r0   r.   <module>r      s    # , , %    K K K < & : Y Q @ ] ] < E E O NL
!e
O e
Pe
! e
P
 
$
 
$
 
$
 
r0   