o
    ¨ÝjjY  ã                   @  s„  d dl mZ d dlmZ d dlmZmZmZ d dlm	Z	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mZ dd	lmZ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-m.Z.m/Z/m0Z0m1Z1m2Z2 ddl3m4Z4m5Z5 ddl6m7Z7 ddgZ8G dd„ deƒZ9G 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)ÚPathLike)ÚMappingÚOptionalÚSequence)ÚLiteralÚoverloadNé   )Ú_legacy_response)ÚBodyÚOmitÚQueryÚHeadersÚNotGivenÚ	FileTypesÚomitÚ	not_given)Úpath_templateÚrequired_argsÚmaybe_transformÚasync_maybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_streamed_response_wrapperÚ"async_to_streamed_response_wrapper)ÚSyncTokenPageÚAsyncTokenPage)ÚAsyncPaginatorÚmake_request_options)ÚStagedAgentFileÚPreparedAgentFilesÚuploadÚprepareÚasync_uploadÚasync_prepareÚdirectory_filesÚasync_directory_files)Úfile_list_paramsÚfile_create_params)ÚEnvironmentFileÚFilesÚ
AsyncFilesc                	   @  óè   e Zd Zed?dd„ƒZed@dd„ƒZddded	œdAdd„Zddded	œdBdd„Zddded	œdCd$d%„Z	e
ddded	œdDd*d+„ƒZe
ddded	œdEd.d+„ƒZeg d/¢g d0¢ƒeeddded1œdFd4d+„ƒZeeeeddded5œdGd=d>„ZdS )Hr+   ÚreturnÚFilesWithRawResponsec                 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© r4   új/var/www/html/chatgpt/venv/lib/python3.10/site-packages/openai/resources/beta/agents/environments/files.pyÚwith_raw_response$   ó   zFiles.with_raw_responseÚFilesWithStreamingResponsec                 C  r0   ©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
        )r8   r2   r4   r4   r5   Úwith_streaming_response.   ó   zFiles.with_streaming_responseN©Úextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚfilesú!Mapping[str, str | PathLike[str]]r=   úHeaders | Noner>   úQuery | Noner?   úBody | Noner@   ú(float | httpx2.Timeout | None | NotGivenr!   c                C  s   t | |||||dœƒS )ú9Beta: upload selected files for a new hosted environment.r<   )r#   ©r3   rA   r=   r>   r?   r@   r4   r4   r5   r#   7   s
   
ýzFiles.prepareÚrootústr | PathLike[str]ÚdestinationÚstrÚincludeúSequence[str]c                C  s   | j t|||ƒ||||d�S )ú8Beta: prepare an explicitly selected directory snapshot.r<   )r#   r&   ©r3   rI   rK   rM   r=   r>   r?   r@   r4   r4   r5   Úprepare_directoryG   s   ý÷zFiles.prepare_directoryÚenvironment_idÚfiler   Úpathr    c             
   C  s   t | |||||||dœƒS )ú;Beta: upload and stage one file in an existing environment.r<   )r"   ©r3   rR   rS   rT   r=   r>   r?   r@   r4   r4   r5   r"   _   s   ûzFiles.uploadÚfile_idÚtypeúLiteral['file_id']r*   c          	      C  ó   dS ©a/  
        Copies inline bytes or a Files API file into a connected execution environment,
        replacing an existing regular file at the same path. Upload between turns and
        wait for success before starting the next turn. See
        [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files).

        Args:
          file_id: The ID of the uploaded file.

          path: The absolute destination path inside `/workspace`.

          type: The type of the object. Always `file_id`.

          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
        Nr4   ©	r3   rR   rW   rT   rX   r=   r>   r?   r@   r4   r4   r5   Úcreates   ó   $zFiles.createÚdataúLiteral['inline']c          	      C  rZ   ©a9  
        Copies inline bytes or a Files API file into a connected execution environment,
        replacing an existing regular file at the same path. Upload between turns and
        wait for success before starting the next turn. See
        [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files).

        Args:
          data: The standard-base64-encoded file contents.

          path: The absolute destination path inside `/workspace`.

          type: The type of the object. Always `inline`.

          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
        Nr4   ©	r3   rR   r_   rT   rX   r=   r>   r?   r@   r4   r4   r5   r]   ™   r^   ©rW   rT   rX   ©r_   rT   rX   ©rW   r_   r=   r>   r?   r@   ú
str | Omitú&Literal['file_id'] | Literal['inline']c          
   
   C  s`   |s	t d|›�ƒ‚ddi|pi ¥}| jtd|d�t||||dœtjƒt||||	ddid	�td
�S ©Nú=Expected a non-empty value for `environment_id` but received úOpenAI-Betaú	agents=v1ú+/agents/environments/{environment_id}/files©rR   )rW   rT   rX   r_   Úbearer_authT)r=   r>   r?   r@   Úsecurity)ÚbodyÚoptionsZcast_to)Ú
ValueErrorÚ_postr   r   r)   ÚFileCreateParamsr   r*   ©
r3   rR   rW   rT   rX   r_   r=   r>   r?   r@   r4   r4   r5   r]   ¿   s,   
üù	ûî©ÚlimitÚorderÚpagerT   r=   r>   r?   r@   rw   úOptional[int] | Omitrx   úLiteral['asc', 'desc'] | Omitry   úOptional[str] | OmitúSyncTokenPage[EnvironmentFile]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 live files on a connected execution environment with optional directory
        filtering and opaque cursor pagination. See
        [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files).

        Args:
          limit: The maximum number of files to return, between 1 and 100.

          order: Sort by case-sensitive path components. Defaults to descending.

              - `asc` - Returns resources in ascending order.
              - `desc` - Returns resources in descending order.

          page: The opaque token from the previous page. Keep the same path, order, and limit.

          path: Restrict the listing to this absolute workspace directory.

          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
        ri   rj   rk   rl   rm   )rw   rx   ry   rT   rn   T)r=   r>   r?   r@   Úqueryro   )ry   rq   Úmodel)	rr   Ú_get_api_listr   r   r*   r   r   r(   ÚFileListParams©
r3   rR   rw   rx   ry   rT   r=   r>   r?   r@   r4   r4   r5   Úlistç   ó.   (
üù	òíz
Files.list)r.   r/   )r.   r8   ©rA   rB   r=   rC   r>   rD   r?   rE   r@   rF   r.   r!   ©rI   rJ   rK   rL   rM   rN   r=   rC   r>   rD   r?   rE   r@   rF   r.   r!   ©rR   rL   rS   r   rT   rL   r=   rC   r>   rD   r?   rE   r@   rF   r.   r    ©rR   rL   rW   rL   rT   rL   rX   rY   r=   rC   r>   rD   r?   rE   r@   rF   r.   r*   ©rR   rL   r_   rL   rT   rL   rX   r`   r=   rC   r>   rD   r?   rE   r@   rF   r.   r*   ©rR   rL   rW   rf   rT   rL   rX   rg   r_   rf   r=   rC   r>   rD   r?   rE   r@   rF   r.   r*   )rR   rL   rw   rz   rx   r{   ry   rf   rT   r|   r=   rC   r>   rD   r?   rE   r@   rF   r.   r}   ©Ú__name__Ú
__module__Ú__qualname__r   r6   r:   r   r#   rQ   r"   r   r]   r   r   r…   r4   r4   r4   r5   r+   #   ób    	ù÷÷
ô%
ô%ó+óc                	   @  r-   )Hr,   r.   ÚAsyncFilesWithRawResponsec                 C  r0   r1   )r’   r2   r4   r4   r5   r6   *  r7   zAsyncFiles.with_raw_responseÚAsyncFilesWithStreamingResponsec                 C  r0   r9   )r“   r2   r4   r4   r5   r:   4  r;   z"AsyncFiles.with_streaming_responseNr<   rA   rB   r=   rC   r>   rD   r?   rE   r@   rF   r!   c                Ã  s   �t | |||||dœƒI dH S )rG   r<   N)r%   rH   r4   r4   r5   r#   =  s   €

ýzAsyncFiles.preparerI   rJ   rK   rL   rM   rN   c                Ã  s*   �| j t|||ƒI dH ||||d�I dH S )rO   Nr<   )r#   r'   rP   r4   r4   r5   rQ   M  s   €ý÷zAsyncFiles.prepare_directoryrR   rS   r   rT   r    c             
   Ã  s"   �t | |||||||dœƒI dH S )rU   r<   N)r$   rV   r4   r4   r5   r"   e  s   €
ûzAsyncFiles.uploadrW   rX   rY   r*   c          	      Ã  ó   �dS r[   r4   r\   r4   r4   r5   r]   y  ó   €$zAsyncFiles.creater_   r`   c          	      Ã  r”   ra   r4   rb   r4   r4   r5   r]   Ÿ  r•   rc   rd   re   rf   rg   c          
   
   Ã  sn   �|s
t d|›�ƒ‚ddi|pi ¥}| jtd|d�t||||dœtjƒI d H t||||	ddid	�td
�I d H S rh   )rr   rs   r   r   r)   rt   r   r*   ru   r4   r4   r5   r]   Å  s.   €
üù	ûîrv   rw   rz   rx   r{   ry   r|   ú@AsyncPaginator[EnvironmentFile, AsyncTokenPage[EnvironmentFile]]c          
      C  r~   r   )	rr   r‚   r   r   r*   r   r   r(   rƒ   r„   r4   r4   r5   r…   í  r†   zAsyncFiles.list)r.   r’   )r.   r“   r‡   rˆ   r‰   rŠ   r‹   rŒ   )rR   rL   rw   rz   rx   r{   ry   rf   rT   r|   r=   rC   r>   rD   r?   rE   r@   rF   r.   r–   r�   r4   r4   r4   r5   r,   )  r‘   c                   @  ó   e Zd Zddd„ZdS )	r/   rA   r+   r.   ÚNonec                 C  ó&   || _ t |j¡| _t |j¡| _d S ©N)Ú_filesr
   Zto_raw_response_wrapperr]   r…   ©r3   rA   r4   r4   r5   Ú__init__0  ó   ÿ
ÿzFilesWithRawResponse.__init__N©rA   r+   r.   r˜   ©rŽ   r�   r�   r�   r4   r4   r4   r5   r/   /  ó    r/   c                   @  r—   )	r’   rA   r,   r.   r˜   c                 C  r™   rš   )r›   r
   Zasync_to_raw_response_wrapperr]   r…   rœ   r4   r4   r5   r�   <  rž   z"AsyncFilesWithRawResponse.__init__N©rA   r,   r.   r˜   r    r4   r4   r4   r5   r’   ;  r¡   r’   c                   @  r—   )	r8   rA   r+   r.   r˜   c                 C  ó"   || _ t|jƒ| _t|jƒ| _d S rš   )r›   r   r]   r…   rœ   r4   r4   r5   r�   H  ó   ÿ
ÿz#FilesWithStreamingResponse.__init__NrŸ   r    r4   r4   r4   r5   r8   G  r¡   r8   c                   @  r—   )	r“   rA   r,   r.   r˜   c                 C  r£   rš   )r›   r   r]   r…   rœ   r4   r4   r5   r�   T  r¤   z(AsyncFilesWithStreamingResponse.__init__Nr¢   r    r4   r4   r4   r5   r“   S  r¡   r“   )?Ú
__future__r   Úosr   Útypingr   r   r   Ztyping_extensionsr   r   Zhttpx2Ú r
   Ú_typesr   r   r   r   r   r   r   r   Z_utilsr   r   r   r   Z_compatr   Z	_resourcer   r   Ú	_responser   r   Z
paginationr   r   Z_base_clientr   r   Zlib.beta.agents._filesr    r!   r"   r#   r$   r%   r&   r'   Ztypes.beta.agents.environmentsr(   r)   Z/types.beta.agents.environments.environment_filer*   Ú__all__r+   r,   r/   r’   r8   r“   r4   r4   r4   r5   Ú<module>   s6   ((
    