File tree 3 files changed +10
-5
lines changed
vertexai/preview/rag/utils
3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 91
91
TEST_DRIVE_FOLDER = (
92
92
f"https://drive.google.com/corp/drive/folders/{ TEST_DRIVE_FOLDER_ID } "
93
93
)
94
+ TEST_DRIVE_FOLDER_2 = (
95
+ f"https://drive.google.com/drive/folders/{ TEST_DRIVE_FOLDER_ID } ?resourcekey=0-eiOT3"
96
+ )
94
97
TEST_IMPORT_FILES_CONFIG_DRIVE_FOLDER = ImportRagFilesConfig ()
95
98
TEST_IMPORT_FILES_CONFIG_DRIVE_FOLDER .google_drive_source .resource_ids = [
96
99
GoogleDriveSource .ResourceId (
Original file line number Diff line number Diff line change @@ -374,11 +374,11 @@ def test_prepare_import_files_request_list_gcs_uris(self):
374
374
)
375
375
import_files_request_eq (request , tc .TEST_IMPORT_REQUEST_GCS )
376
376
377
- def test_prepare_import_files_request_drive_folders ( self ):
378
- paths = [ tc . TEST_DRIVE_FOLDER ]
377
+ @ pytest . mark . parametrize ( "path" , [ tc . TEST_DRIVE_FOLDER , tc . TEST_DRIVE_FOLDER_2 ])
378
+ def test_prepare_import_files_request_drive_folders ( self , path ):
379
379
request = prepare_import_files_request (
380
380
corpus_name = tc .TEST_RAG_CORPUS_RESOURCE_NAME ,
381
- paths = paths ,
381
+ paths = [ path ] ,
382
382
chunk_size = tc .TEST_CHUNK_SIZE ,
383
383
chunk_overlap = tc .TEST_CHUNK_OVERLAP ,
384
384
)
Original file line number Diff line number Diff line change @@ -97,10 +97,12 @@ def convert_path_to_resource_id(
97
97
# Google Drive source
98
98
path_list = path .split ("/" )
99
99
if "file" in path_list :
100
- resource_id = path_list [5 ]
100
+ index = path_list .index ("file" ) + 2
101
+ resource_id = path_list [index ].split ("?" )[0 ]
101
102
resource_type = GoogleDriveSource .ResourceId .ResourceType .RESOURCE_TYPE_FILE
102
103
elif "folders" in path_list :
103
- resource_id = path_list [6 ]
104
+ index = path_list .index ("folders" ) + 1
105
+ resource_id = path_list [index ].split ("?" )[0 ]
104
106
resource_type = (
105
107
GoogleDriveSource .ResourceId .ResourceType .RESOURCE_TYPE_FOLDER
106
108
)
You can’t perform that action at this time.
0 commit comments