o
    ØRWjå   ã                   @  s(  d dl 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! 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 )é    )Úannotations)ÚLiteralNé   )Ú_legacy_response)ÚBodyÚOmitÚQueryÚHeadersÚNotGivenÚomitÚ	not_given)Úpath_templateÚmaybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_streamed_response_wrapperÚ"async_to_streamed_response_wrapper)ÚSyncCursorPageÚAsyncCursorPage)ÚAsyncPaginatorÚmake_request_options)Úmessage_list_params)ÚChatCompletionStoreMessageÚMessagesÚAsyncMessagesc                   @  óH   e Zd 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	S )!r   ú_
    Given a list of messages comprising a conversation, the model will return a response.
    ÚreturnÚMessagesWithRawResponsec                 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$   úy/home/esfera/Documents/content_generation/venv/lib/python3.10/site-packages/openai/resources/chat/completions/messages.pyÚwith_raw_response   ó   zMessages.with_raw_responseÚMessagesWithStreamingResponsec                 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 Messages.with_streaming_responseN©ÚafterÚlimitÚorderÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚcompletion_idÚstrr-   ú
str | Omitr.   ú
int | Omitr/   úLiteral['asc', 'desc'] | Omitr0   úHeaders | Noner1   úQuery | Noner2   úBody | Noner3   ú'float | httpx.Timeout | None | NotGivenú*SyncCursorPage[ChatCompletionStoreMessage]c          	      C  óT   |s	t d|›�ƒ‚| jtd|d�tt t||||t|||dœtjƒddid�td�S ©	aò  Get the messages in a stored chat completion.

        Only Chat Completions that have
        been created with the `store` parameter set to `true` will be returned.

        Args:
          after: Identifier for the last message from the previous pagination request.

          limit: Number of messages to retrieve.

          order: Sort order for messages by timestamp. Use `asc` for ascending order or `desc`
              for descending order. Defaults to `asc`.

          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
        z<Expected a non-empty value for `completion_id` but received z*/chat/completions/{completion_id}/messages)r4   )r-   r.   r/   Úbearer_authT)r0   r1   r2   r3   ÚqueryÚsecurity)ÚpageÚoptionsÚmodel)	Ú
ValueErrorÚ_get_api_listr   r   r   r   r   r   ÚMessageListParams©	r#   r4   r-   r.   r/   r0   r1   r2   r3   r$   r$   r%   Úlist/   ó*   #
ýúóîzMessages.list)r   r   )r   r(   )r4   r5   r-   r6   r.   r7   r/   r8   r0   r9   r1   r:   r2   r;   r3   r<   r   r=   ©
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r&   r*   r   r   rJ   r$   r$   r$   r%   r      ó    	ôc                   @  r   )!r   r   r   ÚAsyncMessagesWithRawResponsec                 C  r    r!   )rR   r"   r$   r$   r%   r&   o   r'   zAsyncMessages.with_raw_responseÚ"AsyncMessagesWithStreamingResponsec                 C  r    r)   )rS   r"   r$   r$   r%   r*   y   r+   z%AsyncMessages.with_streaming_responseNr,   r4   r5   r-   r6   r.   r7   r/   r8   r0   r9   r1   r:   r2   r;   r3   r<   úWAsyncPaginator[ChatCompletionStoreMessage, AsyncCursorPage[ChatCompletionStoreMessage]]c          	      C  r>   r?   )	rF   rG   r   r   r   r   r   r   rH   rI   r$   r$   r%   rJ   ‚   rK   zAsyncMessages.list)r   rR   )r   rS   )r4   r5   r-   r6   r.   r7   r/   r8   r0   r9   r1   r:   r2   r;   r3   r<   r   rT   rL   r$   r$   r$   r%   r   j   rQ   c                   @  ó   e Zd Zddd„ZdS )	r   Úmessagesr   r   ÚNonec                 C  ó   || _ t |j¡| _d S ©N)Ú	_messagesr   Úto_raw_response_wrapperrJ   ©r#   rV   r$   r$   r%   Ú__init__¾   ó   
ÿz MessagesWithRawResponse.__init__N©rV   r   r   rW   ©rM   rN   rO   r]   r$   r$   r$   r%   r   ½   ó    r   c                   @  rU   )	rR   rV   r   r   rW   c                 C  rX   rY   )rZ   r   Úasync_to_raw_response_wrapperrJ   r\   r$   r$   r%   r]   Ç   r^   z%AsyncMessagesWithRawResponse.__init__N©rV   r   r   rW   r`   r$   r$   r$   r%   rR   Æ   ra   rR   c                   @  rU   )	r(   rV   r   r   rW   c                 C  ó   || _ t|jƒ| _d S rY   )rZ   r   rJ   r\   r$   r$   r%   r]   Ð   ó   
ÿz&MessagesWithStreamingResponse.__init__Nr_   r`   r$   r$   r$   r%   r(   Ï   ra   r(   c                   @  rU   )	rS   rV   r   r   rW   c                 C  rd   rY   )rZ   r   rJ   r\   r$   r$   r%   r]   Ù   re   z+AsyncMessagesWithStreamingResponse.__init__Nrc   r`   r$   r$   r$   r%   rS   Ø   ra   rS   )+Ú
__future__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.chat.completionsr   Ú(types.chat.chat_completion_store_messager   Ú__all__r   r   r   rR   r(   rS   r$   r$   r$   r%   Ú<module>   s(   $SS			