
    ^hH                     t    S SK JrJrJrJr  S SKrS SKJrJr  S SK	J
r
Jr  SSKJr  \" 5       r " S S\5      rg)	    )Any	CoroutineOptionalUnionN)GCSBucketBaseGCSLoggingConfig)CreateFileRequest
FileObject   )VertexAIFilesTransformationc                       \ rS rSrSr S\S\\   S\\   S\\   S\\   S\\	\
R                  4   S	\\   4S
 jrS\S\S\\   S\\   S\\   S\\   S\\	\
R                  4   S	\\   S\\\\\\4   4   4S jrSrg)VertexAIFilesHandler   zr
Handles Calling VertexAI in OpenAI Files API format v1/files/*

This implementation uploads files on GCS Buckets
create_file_dataapi_basevertex_credentialsvertex_projectvertex_locationtimeoutmax_retriesc                 .  #    U R                  0 S9I S h  vN nU R                  US   US   S9I S h  vN n	US   n
[        R                  UR	                  S5      S9u  pU R                  U	U
UUS9I S h  vN n[        R                  UUS	9$  Ny N] N7f)
N)kwargsvertex_instancepath_service_account)r   service_account_jsonbucket_namefile)openai_file_content)headersr   object_namelogging_payload)r   gcs_upload_response)get_gcs_logging_configconstruct_request_headersvertex_ai_files_transformation7transform_openai_file_content_to_vertex_ai_file_contentget_log_json_data_on_gcs3transform_gcs_bucket_response_to_openai_file_object)selfr   r   r   r   r   r   r   gcs_logging_configr   r   r!   r    r"   s                 ^/home/james-whalen/.local/lib/python3.13/site-packages/litellm/llms/vertex_ai/files/handler.pyasync_create_file&VertexAIFilesHandler.async_create_file   s      6:5P5P 6Q 6
 0
 66./@A!34J!K 7 
 
 )7*bb$4$8$8$@ c  	%
 %)$>$>##+	 %? %
 
 .aa- 3 b 
 	
)0


s2   BBBBAB6B7BBB	_is_asyncreturnc	           
      <    U(       a  U R                  UUUUUUUS9$ g)zV
Creates a file on VertexAI GCS Bucket

Only supported for Async litellm.acreate_file
)r   r   r   r   r   r   r   N)r-   )	r*   r/   r   r   r   r   r   r   r   s	            r,   create_file VertexAIFilesHandler.create_file<   s9    " ))!1!#5- /' *        N)__name__
__module____qualname____firstlineno____doc__r	   r   strr   floathttpxTimeoutintr-   boolr
   r   r   r2   __static_attributes__r5   r4   r,   r   r      s    	!
+!
 3-!
 %SM	!

 !!
 "#!
 uemm+,!
 c]!
F , 3-	
 %SM ! "# uemm+, c] 
z9S#z%9::	;r4   r   )typingr   r   r   r   r=   /litellm.integrations.gcs_bucket.gcs_bucket_baser   r   litellm.types.llms.openair	   r
   transformationr   r%   r   r5   r4   r,   <module>rF      s3    2 2  D 7!<!> H= Hr4   