1
1
import logging
2
2
3
+ from termcolor import colored
4
+
3
5
from debug_gym .agents .base_agent import register_agent
4
6
from debug_gym .agents .rewrite_agent import RewriteAgent
5
7
from debug_gym .llms .base import LLM
@@ -33,7 +35,10 @@ def try_rewrite(self, task_name):
33
35
return info .done
34
36
35
37
def run (self , task_name = None , debug = False ):
36
- self .llm .logger = DebugGymLogger (name = "LLM" , level = logging .ERROR )
38
+ self .logger .level = logging .DEBUG
39
+ self .llm .logger = DebugGymLogger (
40
+ name = "LLM" , level = logging .ERROR , log_dir = self .logger .log_file .parent
41
+ )
37
42
self .human = LLM .instantiate (llm_name = "human" , logger = self .logger )
38
43
39
44
self .history .reset ()
@@ -55,10 +60,12 @@ def run(self, task_name=None, debug=False):
55
60
56
61
llm_done = self .try_rewrite (task_name )
57
62
if llm_done :
58
- self .logger .info (
59
- f"*** The rewrite-only agent with { self .llm .model_name } managed to solve the task with the current context. ***"
60
- )
63
+ msg = f"*** The rewrite-only agent with { self .llm .model_name } managed to solve the task with the current context. ***"
64
+ self .logger .info (colored (msg , "green" ))
61
65
break
66
+ else :
67
+ msg = f"*** The rewrite-only agent with { self .llm .model_name } failed to solve the task with the current context. ***"
68
+ self .logger .info (colored (msg , "red" ))
62
69
63
70
# If the LLM did not manage to solve the task, we continue with the guided approach.
64
71
prompt = self .build_prompt (info )
@@ -68,7 +75,7 @@ def run(self, task_name=None, debug=False):
68
75
breakpoint ()
69
76
70
77
# step the environment with the human response
71
- info = self .env .step (human_response .response )
78
+ info = self .env .step (human_response .tool )
72
79
# log the human response
73
80
self .history .step (info , human_response )
74
81
0 commit comments