46
46
EmbeddingModelConfig ,
47
47
JiraSource ,
48
48
LayoutParserConfig ,
49
+ LlmParserConfig ,
49
50
Pinecone ,
50
51
RagCorpus ,
51
52
RagFile ,
@@ -475,6 +476,7 @@ def import_files(
475
476
use_advanced_pdf_parsing : Optional [bool ] = False ,
476
477
partial_failures_sink : Optional [str ] = None ,
477
478
layout_parser : Optional [LayoutParserConfig ] = None ,
479
+ llm_parser : Optional [LlmParserConfig ] = None ,
478
480
) -> ImportRagFilesResponse :
479
481
"""
480
482
Import files to an existing RagCorpus, wait until completion.
@@ -592,7 +594,10 @@ def import_files(
592
594
to the table.
593
595
layout_parser: Configuration for the Document AI Layout Parser Processor
594
596
to use for document parsing. Optional.
595
- If not None,`use_advanced_pdf_parsing` must be False.
597
+ If not None, the other parser configs must be None.
598
+ llm_parser: Configuration for the LLM Parser to use for document parsing.
599
+ Optional.
600
+ If not None, the other parser configs must be None.
596
601
Returns:
597
602
ImportRagFilesResponse.
598
603
"""
@@ -605,6 +610,15 @@ def import_files(
605
610
"Only one of use_advanced_pdf_parsing or layout_parser may be "
606
611
"passed in at a time"
607
612
)
613
+ if use_advanced_pdf_parsing and llm_parser is not None :
614
+ raise ValueError (
615
+ "Only one of use_advanced_pdf_parsing or llm_parser may be "
616
+ "passed in at a time"
617
+ )
618
+ if layout_parser is not None and llm_parser is not None :
619
+ raise ValueError (
620
+ "Only one of layout_parser or llm_parser may be passed in at a time"
621
+ )
608
622
corpus_name = _gapic_utils .get_corpus_name (corpus_name )
609
623
request = _gapic_utils .prepare_import_files_request (
610
624
corpus_name = corpus_name ,
@@ -617,6 +631,7 @@ def import_files(
617
631
use_advanced_pdf_parsing = use_advanced_pdf_parsing ,
618
632
partial_failures_sink = partial_failures_sink ,
619
633
layout_parser = layout_parser ,
634
+ llm_parser = llm_parser ,
620
635
)
621
636
client = _gapic_utils .create_rag_data_service_client ()
622
637
try :
@@ -638,6 +653,7 @@ async def import_files_async(
638
653
use_advanced_pdf_parsing : Optional [bool ] = False ,
639
654
partial_failures_sink : Optional [str ] = None ,
640
655
layout_parser : Optional [LayoutParserConfig ] = None ,
656
+ llm_parser : Optional [LlmParserConfig ] = None ,
641
657
) -> operation_async .AsyncOperation :
642
658
"""
643
659
Import files to an existing RagCorpus asynchronously.
@@ -755,7 +771,10 @@ async def import_files_async(
755
771
to the table.
756
772
layout_parser: Configuration for the Document AI Layout Parser Processor
757
773
to use for document parsing. Optional.
758
- If not None,`use_advanced_pdf_parsing` must be False.
774
+ If not None, the other parser configs must be None.
775
+ llm_parser: Configuration for the LLM Parser to use for document parsing.
776
+ Optional.
777
+ If not None, the other parser configs must be None.
759
778
Returns:
760
779
operation_async.AsyncOperation.
761
780
"""
@@ -768,6 +787,15 @@ async def import_files_async(
768
787
"Only one of use_advanced_pdf_parsing or layout_parser may be "
769
788
"passed in at a time"
770
789
)
790
+ if use_advanced_pdf_parsing and llm_parser is not None :
791
+ raise ValueError (
792
+ "Only one of use_advanced_pdf_parsing or llm_parser may be "
793
+ "passed in at a time"
794
+ )
795
+ if layout_parser is not None and llm_parser is not None :
796
+ raise ValueError (
797
+ "Only one of layout_parser or llm_parser may be passed in at a time"
798
+ )
771
799
corpus_name = _gapic_utils .get_corpus_name (corpus_name )
772
800
request = _gapic_utils .prepare_import_files_request (
773
801
corpus_name = corpus_name ,
@@ -780,6 +808,7 @@ async def import_files_async(
780
808
use_advanced_pdf_parsing = use_advanced_pdf_parsing ,
781
809
partial_failures_sink = partial_failures_sink ,
782
810
layout_parser = layout_parser ,
811
+ llm_parser = llm_parser ,
783
812
)
784
813
async_client = _gapic_utils .create_rag_data_service_async_client ()
785
814
try :
0 commit comments