File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,22 +42,29 @@ def wrapper(*args, **kwargs):
4242 try :
4343 if len (args ) > 0 :
4444 kwargs ["path" ] = args [0 ]
45- if len (args ) > 1 and args [ 1 ] == ParserType . AUTO :
45+ if len (args ) > 1 :
4646 router_priority = kwargs .get ("router_priority" , "speed" )
47- parser_type = ParserType [router (kwargs ["path" ], router_priority )]
48- kwargs ["routed" ] = True
47+ if args [1 ] == ParserType .AUTO :
48+ parser_type = ParserType [router (kwargs ["path" ], router_priority )]
49+ logger .debug (f"Auto-detected parser type: { parser_type } " )
50+ kwargs ["routed" ] = True
51+ else :
52+ parser_type = args [1 ]
4953 kwargs ["parser_type" ] = parser_type
50- logger .debug (f"Auto-detected parser type: { parser_type } " )
5154 return func (** kwargs )
5255 except Exception as e :
53- if kwargs .get ("parser_type" ) == ParserType .LLM_PARSE :
56+ if kwargs .get ("parser_type" ) == ParserType .LLM_PARSE and kwargs .get (
57+ "routed" , False
58+ ):
5459 logger .warning (
5560 f"LLM_PARSE failed with error: { e } . Retrying with STATIC_PARSE."
5661 )
5762 kwargs ["parser_type" ] = ParserType .STATIC_PARSE
5863 kwargs ["routed" ] = False
5964 return func (** kwargs )
60- elif kwargs .get ("parser_type" ) == ParserType .STATIC_PARSE :
65+ elif kwargs .get ("parser_type" ) == ParserType .STATIC_PARSE and kwargs .get (
66+ "routed" , False
67+ ):
6168 logger .warning (
6269 f"STATIC_PARSE failed with error: { e } . Retrying with LLM_PARSE."
6370 )
You can’t perform that action at this time.
0 commit comments