o
    ¨Ýjy[  ã                   @  sl  d dl mZ 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mZmZ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)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0 ddgZ1G dd„ deƒZ2G dd„ deƒZ3G dd„ dƒZ4G dd„ dƒZ5G dd„ dƒZ6G dd„ dƒZ7dS )é    )Úannotations)ÚOptional)ÚLiteralNé   )Ú_legacy_response)ÚBodyÚOmitÚQueryÚHeadersÚNotGivenÚomitÚ	not_given)Úpath_templateÚmaybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)ÚStreamedBinaryAPIResponseÚAsyncStreamedBinaryAPIResponseÚto_streamed_response_wrapperÚ"async_to_streamed_response_wrapperÚ#to_custom_streamed_response_wrapperÚ)async_to_custom_streamed_response_wrapper)ÚSyncCursorPageÚAsyncCursorPage)ÚAsyncPaginatorÚmake_request_options)ÚAgentTurnResult)ÚAgentResultArtifactsÚAsyncAgentResultArtifacts)Úartifact_list_params)ÚSessionArtifact)ÚSessionArtifactDeletedÚ	ArtifactsÚAsyncArtifactsc                	   @  ó’   e Zd Zed/dd„ƒZed0dd„ƒZd1dd„Zdddedœd2dd„Ze	e	e	e	dddedœd3d'd(„Z
dddedœd4d*d+„Zdddedœd5d-d.„ZdS )6r#   ÚreturnÚArtifactsWithRawResponsec                 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,   új/var/www/html/chatgpt/venv/lib/python3.10/site-packages/openai/resources/beta/agents/sessions/artifacts.pyÚwith_raw_response#   ó   zArtifacts.with_raw_responseÚArtifactsWithStreamingResponsec                 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
        )r0   r*   r,   r,   r-   Úwith_streaming_response-   ó   z!Artifacts.with_streaming_responseÚresultr   r   c                 C  ó
   t | |ƒS ©zCBeta: download artifacts scoped to the exact completed result turn.)r   ©r+   r4   r,   r,   r-   Ú
for_result6   ó   þzArtifacts.for_resultN©Úextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚartifact_idÚstrÚ
session_idr;   úHeaders | Noner<   úQuery | Noner=   úBody | Noner>   ú(float | httpx2.Timeout | None | NotGivenr!   c             	   C  ó`   |s	t d|›�ƒ‚|st d|›�ƒ‚ddi|pi ¥}| jtd||d�t||||ddid	�td
�S )áø  Retrieves immutable metadata for one durable session artifact.

        See
        [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).

        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
        ú9Expected a non-empty value for `session_id` but received ú:Expected a non-empty value for `artifact_id` but received úOpenAI-Betaú	agents=v1ú5/agents/sessions/{session_id}/artifacts/{artifact_id}©rA   r?   Úbearer_authT©r;   r<   r=   r>   Úsecurity©ÚoptionsZcast_to©Ú
ValueErrorÚ_getr   r   r!   ©r+   r?   rA   r;   r<   r=   r>   r,   r,   r-   Úretrieve@   ó$   ÿûõzArtifacts.retrieve©ÚafterÚenvironment_idÚlimitÚorderr;   r<   r=   r>   rZ   ú
str | Omitr[   úOptional[str] | Omitr\   ú
int | Omitr]   úLiteral['asc', 'desc'] | OmitúSyncCursorPage[SessionArtifact]c          
      C  óf   |s	t d|›�ƒ‚ddi|pi ¥}| jtd|d�tt t||||	t||||dœtjƒddid	�td
�S ©aÜ  Lists immutable artifacts published by completed hosted session turns.

        See
        [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).

        Args:
          after: Return resources after this resource ID in the selected order.

          environment_id: Restrict the listing to artifacts produced by this environment.

          limit: The maximum number of resources to return, between 1 and 100. Defaults to 20.

          order: The order in which resources are returned. Defaults to `desc`.

              - `asc` - Returns resources in ascending order.
              - `desc` - Returns resources 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
        rH   rJ   rK   z'/agents/sessions/{session_id}/artifacts)rA   )rZ   r[   r\   r]   rN   T)r;   r<   r=   r>   ÚqueryrP   )ÚpagerR   Úmodel)	rT   Ú_get_api_listr   r   r!   r   r   r    ÚArtifactListParams©
r+   rA   rZ   r[   r\   r]   r;   r<   r=   r>   r,   r,   r-   Úlistm   ó.   (
üù	òízArtifacts.listr"   c             	   C  rF   )á0  
        Deletes an immutable session artifact without deleting its live environment file
        or original Files API object. See
        [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).

        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
        rH   rI   rJ   rK   rL   rM   rN   TrO   rQ   ©rT   Ú_deleter   r   r"   rV   r,   r,   r-   Údelete®   rX   zArtifacts.deleteú+_legacy_response.HttpxBinaryResponseContentc             	   C  sr   |s	t d|›�ƒ‚|st d|›�ƒ‚ddi|pi ¥}ddi|p i ¥}| jtd||d�t||||d	d
id�tjd�S )á  
        Downloads immutable session artifact bytes after the execution environment
        expires. See
        [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).

        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
        rH   rI   ÚAcceptúapplication/octet-streamrJ   rK   ú=/agents/sessions/{session_id}/artifacts/{artifact_id}/contentrM   rN   TrO   rQ   ©rT   rU   r   r   r   ZHttpxBinaryResponseContentrV   r,   r,   r-   ÚcontentÛ   s*   ýûózArtifacts.content)r&   r'   )r&   r0   )r4   r   r&   r   ©r?   r@   rA   r@   r;   rB   r<   rC   r=   rD   r>   rE   r&   r!   )rA   r@   rZ   r^   r[   r_   r\   r`   r]   ra   r;   rB   r<   rC   r=   rD   r>   rE   r&   rb   ©r?   r@   rA   r@   r;   rB   r<   rC   r=   rD   r>   rE   r&   r"   ©r?   r@   rA   r@   r;   rB   r<   rC   r=   rD   r>   rE   r&   rq   ©Ú__name__Ú
__module__Ú__qualname__r   r.   r2   r8   r   rW   r   rk   rp   rw   r,   r,   r,   r-   r#   "   ó<    	
ö1óHö4öc                	   @  r%   )6r$   r&   ÚAsyncArtifactsWithRawResponsec                 C  r(   r)   )r€   r*   r,   r,   r-   r.     r/   z AsyncArtifacts.with_raw_responseÚ#AsyncArtifactsWithStreamingResponsec                 C  r(   r1   )r�   r*   r,   r,   r-   r2     r3   z&AsyncArtifacts.with_streaming_responser4   r   r   c                 C  r5   r6   )r   r7   r,   r,   r-   r8      r9   zAsyncArtifacts.for_resultNr:   r?   r@   rA   r;   rB   r<   rC   r=   rD   r>   rE   r!   c             	   Ã  óh   �|s
t d|›�ƒ‚|st d|›�ƒ‚ddi|pi ¥}| jtd||d�t||||ddid	�td
�I dH S )rG   rH   rI   rJ   rK   rL   rM   rN   TrO   rQ   NrS   rV   r,   r,   r-   rW   *  ó&   €ÿûõzAsyncArtifacts.retrieverY   rZ   r^   r[   r_   r\   r`   r]   ra   úAAsyncPaginator[SessionArtifact, AsyncCursorPage[SessionArtifact]]c          
      C  rc   rd   )	rT   rh   r   r   r!   r   r   r    ri   rj   r,   r,   r-   rk   W  rl   zAsyncArtifacts.listr"   c             	   Ã  r‚   )rm   rH   rI   rJ   rK   rL   rM   rN   TrO   rQ   Nrn   rV   r,   r,   r-   rp   ˜  rƒ   zAsyncArtifacts.deleterq   c             	   Ã  sz   �|s
t d|›�ƒ‚|st d|›�ƒ‚ddi|pi ¥}ddi|p!i ¥}| jtd||d�t||||d	d
id�tjd�I dH S )rr   rH   rI   rs   rt   rJ   rK   ru   rM   rN   TrO   rQ   Nrv   rV   r,   r,   r-   rw   Å  s,   €ýûózAsyncArtifacts.content)r&   r€   )r&   r�   )r4   r   r&   r   rx   )rA   r@   rZ   r^   r[   r_   r\   r`   r]   ra   r;   rB   r<   rC   r=   rD   r>   rE   r&   r„   ry   rz   r{   r,   r,   r,   r-   r$     r   c                   @  ó   e Zd Zddd„ZdS )	r'   Ú	artifactsr#   r&   ÚNonec                 C  óB   || _ t |j¡| _t |j¡| _t |j¡| _t |j¡| _d S ©N)Ú
_artifactsr   Zto_raw_response_wrapperrW   rk   rp   rw   ©r+   r†   r,   r,   r-   Ú__init__÷  ó   ÿÿÿ
ÿz!ArtifactsWithRawResponse.__init__N©r†   r#   r&   r‡   ©r|   r}   r~   rŒ   r,   r,   r,   r-   r'   ö  ó    r'   c                   @  r…   )	r€   r†   r$   r&   r‡   c                 C  rˆ   r‰   )rŠ   r   Zasync_to_raw_response_wrapperrW   rk   rp   rw   r‹   r,   r,   r-   rŒ   	  r�   z&AsyncArtifactsWithRawResponse.__init__N©r†   r$   r&   r‡   r�   r,   r,   r,   r-   r€     r�   r€   c                   @  r…   )	r0   r†   r#   r&   r‡   c                 C  ó<   || _ t|jƒ| _t|jƒ| _t|jƒ| _t|jtƒ| _d S r‰   )rŠ   r   rW   rk   rp   r   rw   r   r‹   r,   r,   r-   rŒ     ó   ÿÿÿ
þz'ArtifactsWithStreamingResponse.__init__NrŽ   r�   r,   r,   r,   r-   r0     r�   r0   c                   @  r…   )	r�   r†   r$   r&   r‡   c                 C  r’   r‰   )rŠ   r   rW   rk   rp   r   rw   r   r‹   r,   r,   r-   rŒ   .  r“   z,AsyncArtifactsWithStreamingResponse.__init__Nr‘   r�   r,   r,   r,   r-   r�   -  r�   r�   )8Ú
__future__r   Útypingr   Ztyping_extensionsr   Zhttpx2Ú r   Ú_typesr   r   r	   r
   r   r   r   Z_utilsr   r   Z_compatr   Z	_resourcer   r   Ú	_responser   r   r   r   r   r   Z
paginationr   r   Z_base_clientr   r   Zlib.beta.agents._resultr   Zlib.beta.agents._artifactsr   r   Ztypes.beta.agents.sessionsr    Z+types.beta.agents.sessions.session_artifactr!   Z3types.beta.agents.sessions.session_artifact_deletedr"   Ú__all__r#   r$   r'   r€   r0   r�   r,   r,   r,   r-   Ú<module>   s4   $  k k