Skip to content

Commit 1c8bc14

Browse files
committed
feat: make use of error messages in memory
1 parent 7ae6d4a commit 1c8bc14

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/balatrollm/strategies.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,28 @@ def render_gamestate(self, state_name: str, game_state: dict[str, Any]) -> str:
8080
game_state=game_state,
8181
)
8282

83-
def render_memory(self, responses: list[Any]) -> str:
83+
def render_memory(
84+
self,
85+
responses: list[Any],
86+
last_response_is_invalid: str | None = None,
87+
last_tool_called_failed: str | None = None,
88+
) -> str:
8489
"""Render the memory template.
8590
8691
Args:
8792
responses: List of previous LLM responses for context.
93+
last_response_is_invalid: Error message if last response was invalid.
94+
last_tool_called_failed: Error message if last tool call failed.
8895
8996
Returns:
9097
Rendered memory/history content as a string.
9198
"""
9299
template = self.jinja_env.get_template("MEMORY.md.jinja")
93-
return template.render(responses=responses)
100+
return template.render(
101+
responses=responses,
102+
last_response_is_invalid=last_response_is_invalid,
103+
last_tool_called_failed=last_tool_called_failed,
104+
)
94105

95106
def load_tools(self) -> dict[str, Any]:
96107
"""Load tools from the strategy-specific TOOLS.json file.

0 commit comments

Comments
 (0)