File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -792,14 +792,19 @@ def process_block_body(
792792 retry_count += 1
793793 error = f"Retry on error is triggered in a repeat block. Error detail: { repr (exc )} "
794794 print (f"\n \033 [0;31m{ error } \033 [0m\n " )
795- if (
796- background
797- and background .data
798- and background .data [- 1 ]["content" ].endswith (error )
799- ):
795+ repeating_same_error = False
796+ if background and background .data :
797+ bg_data = background .data
798+ if isinstance (bg_data , list ):
799+ last_error = bg_data [- 1 ]["content" ]
800+ if isinstance (last_error , str ):
801+ if last_error .endswith (error ):
802+ repeating_same_error = True
803+ if repeating_same_error :
800804 error = "The previous error occurs multiple times."
801805 background = lazy_messages_concat (
802- background , [{"role" : "assistant" , "content" : error }]
806+ background ,
807+ PdlList ([{"role" : "assistant" , "content" : error }]),
803808 )
804809 else :
805810 raise PDLRuntimeError (
You can’t perform that action at this time.
0 commit comments