@@ -931,7 +931,7 @@ def test_prepare_import_files_request_valid_layout_parser_with_processor_path(se
931931 corpus_name = test_rag_constants .TEST_RAG_CORPUS_RESOURCE_NAME ,
932932 paths = [test_rag_constants .TEST_DRIVE_FOLDER ],
933933 transformation_config = create_transformation_config (),
934- parser = test_rag_constants .TEST_LAYOUT_PARSER_WITH_PROCESSOR_PATH_CONFIG ,
934+ layout_parser = test_rag_constants .TEST_LAYOUT_PARSER_WITH_PROCESSOR_PATH_CONFIG ,
935935 )
936936 import_files_request_eq (
937937 request ,
@@ -945,7 +945,7 @@ def test_prepare_import_files_request_valid_layout_parser_with_processor_version
945945 corpus_name = test_rag_constants .TEST_RAG_CORPUS_RESOURCE_NAME ,
946946 paths = [test_rag_constants .TEST_DRIVE_FOLDER ],
947947 transformation_config = create_transformation_config (),
948- parser = test_rag_constants .TEST_LAYOUT_PARSER_WITH_PROCESSOR_VERSION_PATH_CONFIG ,
948+ layout_parser = test_rag_constants .TEST_LAYOUT_PARSER_WITH_PROCESSOR_VERSION_PATH_CONFIG ,
949949 )
950950 import_files_request_eq (
951951 request ,
@@ -961,10 +961,45 @@ def test_prepare_import_files_request_invalid_layout_parser_name(self):
961961 corpus_name = test_rag_constants .TEST_RAG_CORPUS_RESOURCE_NAME ,
962962 paths = [test_rag_constants .TEST_DRIVE_FOLDER ],
963963 transformation_config = create_transformation_config (),
964- parser = layout_parser ,
964+ layout_parser = layout_parser ,
965965 )
966966 e .match ("processor_name must be of the format" )
967967
968+ def test_prepare_import_files_request_llm_parser (self ):
969+ request = prepare_import_files_request (
970+ corpus_name = test_rag_constants .TEST_RAG_CORPUS_RESOURCE_NAME ,
971+ paths = [test_rag_constants .TEST_DRIVE_FOLDER ],
972+ transformation_config = create_transformation_config (),
973+ llm_parser = test_rag_constants .TEST_LLM_PARSER_CONFIG ,
974+ )
975+ import_files_request_eq (
976+ request ,
977+ test_rag_constants .TEST_IMPORT_REQUEST_LLM_PARSER ,
978+ )
979+
980+ def test_layout_parser_and_llm_parser_both_set_error (self ):
981+ with pytest .raises (ValueError ) as e :
982+ rag .import_files (
983+ corpus_name = test_rag_constants .TEST_RAG_CORPUS_RESOURCE_NAME ,
984+ paths = [test_rag_constants .TEST_DRIVE_FOLDER ],
985+ transformation_config = create_transformation_config (),
986+ layout_parser = test_rag_constants .TEST_LAYOUT_PARSER_WITH_PROCESSOR_PATH_CONFIG ,
987+ llm_parser = test_rag_constants .TEST_LLM_PARSER_CONFIG ,
988+ )
989+ e .match ("Only one of layout_parser or llm_parser may be passed in at a time" )
990+
991+ @pytest .mark .asyncio
992+ async def test_layout_parser_and_llm_parser_both_set_error_async (self ):
993+ with pytest .raises (ValueError ) as e :
994+ await rag .import_files_async (
995+ corpus_name = test_rag_constants .TEST_RAG_CORPUS_RESOURCE_NAME ,
996+ paths = [test_rag_constants .TEST_DRIVE_FOLDER ],
997+ transformation_config = create_transformation_config (),
998+ layout_parser = test_rag_constants .TEST_LAYOUT_PARSER_WITH_PROCESSOR_PATH_CONFIG ,
999+ llm_parser = test_rag_constants .TEST_LLM_PARSER_CONFIG ,
1000+ )
1001+ e .match ("Only one of layout_parser or llm_parser may be passed in at a time" )
1002+
9681003 def test_set_embedding_model_config_set_both_error (self ):
9691004 embedding_model_config = rag .RagEmbeddingModelConfig (
9701005 vertex_prediction_endpoint = rag .VertexPredictionEndpoint (
0 commit comments