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 @@ -799,14 +799,19 @@ def process_block_body(
799799 retry_count += 1
800800 error = f"Retry on error is triggered in a repeat block. Error detail: { repr (exc )} "
801801 print (f"\n \033 [0;31m{ error } \033 [0m\n " )
802- if (
803- background
804- and background .data
805- and background .data [- 1 ]["content" ].endswith (error )
806- ):
802+ repeating_same_error = False
803+ if background and background .data :
804+ bg_data = background .data
805+ if isinstance (bg_data , list ):
806+ last_error = bg_data [- 1 ]["content" ]
807+ if isinstance (last_error , str ):
808+ if last_error .endswith (error ):
809+ repeating_same_error = True
810+ if repeating_same_error :
807811 error = "The previous error occurs multiple times."
808812 background = lazy_messages_concat (
809- background , [{"role" : "assistant" , "content" : error }]
813+ background ,
814+ PdlList ([{"role" : "assistant" , "content" : error }]),
810815 )
811816 else :
812817 raise PDLRuntimeError (
You can’t perform that action at this time.
0 commit comments