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 @@ -804,14 +804,19 @@ def process_block_body(
804804 retry_count += 1
805805 error = f"Retry on error is triggered in a repeat block. Error detail: { repr (exc )} "
806806 print (f"\n \033 [0;31m{ error } \033 [0m\n " )
807- if (
808- background
809- and background .data
810- and background .data [- 1 ]["content" ].endswith (error )
811- ):
807+ repeating_same_error = False
808+ if background and background .data :
809+ bg_data = background .data
810+ if isinstance (bg_data , list ):
811+ last_error = bg_data [- 1 ]["content" ]
812+ if isinstance (last_error , str ):
813+ if last_error .endswith (error ):
814+ repeating_same_error = True
815+ if repeating_same_error :
812816 error = "The previous error occurs multiple times."
813817 background = lazy_messages_concat (
814- background , [{"role" : "assistant" , "content" : error }]
818+ background ,
819+ PdlList ([{"role" : "assistant" , "content" : error }]),
815820 )
816821 else :
817822 raise PDLRuntimeError (
You can’t perform that action at this time.
0 commit comments