55from opendevin .events .action import (
66 Action ,
77 NullAction ,
8- action_from_dict ,
98)
109from opendevin .events .observation import (
1110 NullObservation ,
1211)
12+ from opendevin .events .serialization .action import action_from_dict
13+ from opendevin .events .serialization .event import event_to_memory
1314
1415HISTORY_SIZE = 10
1516
@@ -139,10 +140,10 @@ def get_prompt(state: State) -> str:
139140 latest_action : Action = NullAction ()
140141 for action , observation in sub_history :
141142 if not isinstance (action , NullAction ):
142- history_dicts .append (action . to_memory ( ))
143+ history_dicts .append (event_to_memory ( action ))
143144 latest_action = action
144145 if not isinstance (observation , NullObservation ):
145- observation_dict = observation . to_memory ( )
146+ observation_dict = event_to_memory ( observation )
146147 history_dicts .append (observation_dict )
147148 history_str = json .dumps (history_dicts , indent = 2 )
148149 current_task = state .root_task .get_current_task ()
@@ -152,7 +153,7 @@ def get_prompt(state: State) -> str:
152153 plan_status += "\n If it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW."
153154 else :
154155 plan_status = "You're not currently working on any tasks. Your next action MUST be to mark a task as in_progress."
155- hint = get_hint (latest_action . to_dict ()[ 'action' ] )
156+ hint = get_hint (event_to_memory ( latest_action ). get ( 'action' , '' ) )
156157 logger .info ('HINT:\n ' + hint , extra = {'msg_type' : 'INFO' })
157158 task = state .get_current_user_intent ()
158159 return prompt % {
0 commit comments