@@ -198,51 +198,6 @@ def delete(
198198 cast_to = type (None ),
199199 )
200200
201- def _prepare_responses_input (self , input : ResponseInputParam ):
202- for input_item in input : # type: ResponseInputItemParam
203- if "content" not in input_item : # skip non-content message
204- continue
205- content_list = input_item ["content" ]
206-
207- if not isinstance (content_list , list ): # skip non-list content
208- continue
209-
210- for content in content_list : # type: ResponseInputContentParam
211- self ._prepare_responses_input_file (content = content )
212-
213- def _prepare_responses_input_file (self , content : ResponseInputContentParam ):
214- if "type" not in content : # skip non-type content
215- return
216- content_type = content ["type" ]
217- if (
218- content_type not in RESPONSES_MULTIMODAL_CONTENT_DATA_KEYS .keys ()
219- ): # skip non-multimodal content
220- return
221- content_data_key = RESPONSES_MULTIMODAL_CONTENT_DATA_KEYS [content_type ]
222- if content_data_key not in content : # skip non-url content
223- return
224- content_data : str = content [content_data_key ]
225-
226- parsed = urlparse (content_data )
227- if parsed .scheme != FILE_PATH_SCHEME : # skip non-file-scheme content
228- return
229-
230- # Decode percent-encoded parts in the path
231- decoded_path = unquote_plus (parsed .path )
232-
233- if parsed .netloc :
234- # Handle cases like file://hostname/share/path or Windows UNC
235- # For simplicity, prefix double-slash for network path
236- full_path = f"{ parsed .netloc } { decoded_path } "
237- else :
238- full_path = decoded_path
239-
240- file_path = Path (full_path )
241- file = self ._client .files .create (file = file_path , purpose = "user_data" )
242- self ._client .files .wait_for_processing (id = file .id )
243- content [content_data_key ] = None # replace with file id
244- content ["file_id" ] = file .id
245-
246201
247202class AsyncResponses (AsyncAPIResource ):
248203 @cached_property
0 commit comments