|
54 | 54 |
|
55 | 55 | logger = logging.getLogger(__name__)
|
56 | 56 |
|
57 |
| - |
58 |
| -def _log_response(response: CustomAgentOutput) -> None: |
59 |
| - """Log the model's response""" |
60 |
| - if "Success" in response.current_state.evaluation_previous_goal: |
61 |
| - emoji = "✅" |
62 |
| - elif "Failed" in response.current_state.evaluation_previous_goal: |
63 |
| - emoji = "❌" |
64 |
| - else: |
65 |
| - emoji = "🤷" |
66 |
| - |
67 |
| - logger.info(f"{emoji} Eval: {response.current_state.evaluation_previous_goal}") |
68 |
| - logger.info(f"🧠 New Memory: {response.current_state.important_contents}") |
69 |
| - logger.info(f"🤔 Thought: {response.current_state.thought}") |
70 |
| - logger.info(f"🎯 Next Goal: {response.current_state.next_goal}") |
71 |
| - for i, action in enumerate(response.action): |
72 |
| - logger.info( |
73 |
| - f"🛠️ Action {i + 1}/{len(response.action)}: {action.model_dump_json(exclude_unset=True)}" |
74 |
| - ) |
75 |
| - |
76 |
| - |
77 | 57 | Context = TypeVar('Context')
|
78 | 58 |
|
79 | 59 |
|
@@ -180,6 +160,24 @@ def __init__(
|
180 | 160 | state=self.state.message_manager_state,
|
181 | 161 | )
|
182 | 162 |
|
| 163 | + def _log_response(self, response: CustomAgentOutput) -> None: |
| 164 | + """Log the model's response""" |
| 165 | + if "Success" in response.current_state.evaluation_previous_goal: |
| 166 | + emoji = "✅" |
| 167 | + elif "Failed" in response.current_state.evaluation_previous_goal: |
| 168 | + emoji = "❌" |
| 169 | + else: |
| 170 | + emoji = "🤷" |
| 171 | + |
| 172 | + logger.info(f"{emoji} Eval: {response.current_state.evaluation_previous_goal}") |
| 173 | + logger.info(f"🧠 New Memory: {response.current_state.important_contents}") |
| 174 | + logger.info(f"🤔 Thought: {response.current_state.thought}") |
| 175 | + logger.info(f"🎯 Next Goal: {response.current_state.next_goal}") |
| 176 | + for i, action in enumerate(response.action): |
| 177 | + logger.info( |
| 178 | + f"🛠️ Action {i + 1}/{len(response.action)}: {action.model_dump_json(exclude_unset=True)}" |
| 179 | + ) |
| 180 | + |
183 | 181 | def _setup_action_models(self) -> None:
|
184 | 182 | """Setup dynamic action models from controller's registry"""
|
185 | 183 | # Get the dynamic action model from controller's registry
|
@@ -236,7 +234,7 @@ async def get_next_action(self, input_messages: list[BaseMessage]) -> AgentOutpu
|
236 | 234 | # cut the number of actions to max_actions_per_step if needed
|
237 | 235 | if len(parsed.action) > self.settings.max_actions_per_step:
|
238 | 236 | parsed.action = parsed.action[: self.settings.max_actions_per_step]
|
239 |
| - _log_response(parsed) |
| 237 | + self._log_response(parsed) |
240 | 238 | return parsed
|
241 | 239 |
|
242 | 240 | async def _run_planner(self) -> Optional[str]:
|
|
0 commit comments