Skip to content

Commit 4a5dfcd

Browse files
authored
fix: megamind steps done (#703)
1 parent 795a9b0 commit 4a5dfcd

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/rai_bench/rai_bench/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def parse_tool_calling_benchmark_args():
5252
type=int,
5353
nargs="+",
5454
help="Number of extra tools calls agent can make and still pass the task",
55-
default=0,
55+
default=[0],
5656
)
5757
parser.add_argument(
5858
"--complexities",

src/rai_core/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "rai_core"
7-
version = "2.5.1"
7+
version = "2.5.2"
88
description = "Core functionality for RAI framework"
99
authors = ["Maciej Majek <maciej.majek@robotec.ai>", "Bartłomiej Boczek <bartlomiej.boczek@robotec.ai>", "Kajetan Rachwał <kajetan.rachwal@robotec.ai>"]
1010
readme = "README.md"

src/rai_core/rai/agents/langchain/core/megamind.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class StepSuccess(BaseModel):
4545
"""Output of success attacher"""
4646

4747
success: bool = Field(description="Whether the task was completed successfully")
48-
explanation: str = Field(description="Explanation of what happened")
48+
explanation: str = Field(description="Summarize briefly what happened")
4949

5050

5151
class MegamindState(MessagesState):
@@ -102,7 +102,9 @@ def analyzer_node(
102102
state["step_success"] = StepSuccess(
103103
success=analysis.success, explanation=analysis.explanation
104104
)
105-
state["steps_done"].append(f"{state['step_success'].explanation}")
105+
state["steps_done"].append(
106+
f"objective: {state['step']}, success: {state['step_success'].success}, explanation: {state['step_success'].explanation}"
107+
)
106108
return state
107109

108110

@@ -158,7 +160,7 @@ def create_react_structured_agent(
158160
return graph.compile()
159161

160162

161-
def create_handoff_tool(agent_name: str, description: str = None):
163+
def create_handoff_tool(agent_name: str, description: Optional[str] = None):
162164
"""Create a handoff tool for transferring tasks to specialist agents."""
163165
name = f"transfer_to_{agent_name}"
164166
description = description or f" {agent_name} for help."
@@ -221,9 +223,10 @@ def plan_step(
221223
state["step"] = None
222224

223225
megamind_prompt = f"You are given objective to complete: {state['original_task']}"
224-
for provider in context_providers:
225-
megamind_prompt += provider.get_context()
226-
megamind_prompt += "\n"
226+
if context_providers:
227+
for provider in context_providers:
228+
megamind_prompt += provider.get_context()
229+
megamind_prompt += "\n"
227230
if state["steps_done"]:
228231
megamind_prompt += "\n\n"
229232
megamind_prompt += "Steps that were already done successfully:\n"

0 commit comments

Comments
 (0)