15
15
import logging
16
16
import time
17
17
from abc import ABC , abstractmethod
18
- from typing import List , TypeVar , Union
18
+ from typing import Any , Dict , List , TypeVar , Union
19
19
20
20
from langchain_core .messages import AIMessage , BaseMessage , HumanMessage
21
21
from rclpy .impl .rcutils_logger import RcutilsLogger
@@ -59,9 +59,8 @@ def get_prompt(self) -> str:
59
59
pass
60
60
61
61
@abstractmethod
62
- def validate_scene (self , simulation_config : SimulationConfig ) -> bool :
63
- """Task should be able to verify if given scene is suitable for specific task
64
- for example: GrabCarrotTask should verify if there is any carrots in the scene
62
+ def validate_config (self , simulation_config : SimulationConfig ) -> bool :
63
+ """Task should be able to verify if given config is suitable for specific task
65
64
66
65
Args:
67
66
simulation_config (SimulationConfig): initial scene setup
@@ -136,7 +135,7 @@ class Scenario:
136
135
"""Single instances are run separatly by benchmark"""
137
136
138
137
def __init__ (self , task : Task , simulation_config : SimulationConfig ) -> None :
139
- if not task .validate_scene (simulation_config ):
138
+ if not task .validate_config (simulation_config ):
140
139
raise ValueError ("This scene is invalid for this task." )
141
140
self .task = task
142
141
self .simulation_config = simulation_config
@@ -149,13 +148,13 @@ class Benchmark:
149
148
150
149
def __init__ (
151
150
self ,
152
- simulation_bridge : SimulationBridge ,
151
+ simulation_bridge : SimulationBridge [ SimulationConfig ] ,
153
152
scenarios : list [Scenario ],
154
153
logger : loggers_type | None = None ,
155
154
) -> None :
156
155
self .simulation_bridge = simulation_bridge
157
156
self .scenarios = enumerate (iter (scenarios ))
158
- self .results = []
157
+ self .results : List [ Dict [ str , Any ]] = []
159
158
if logger :
160
159
self ._logger = logger
161
160
else :
@@ -164,7 +163,7 @@ def __init__(
164
163
@classmethod
165
164
def create_scenarios (
166
165
cls , tasks : List [Task ], simulation_configs : List [SimulationConfig ]
167
- ):
166
+ ) -> list [ Any ] :
168
167
scenarios = []
169
168
for task in tasks :
170
169
for sim_conf in simulation_configs :
@@ -235,7 +234,7 @@ def run_next(self, agent):
235
234
"initial_score" : initial_result ,
236
235
"final_score" : result ,
237
236
"total_time" : f"{ total_time :.3f} " ,
238
- "numer_of_tool_calls " : tool_calls_num ,
237
+ "number_of_tool_calls " : tool_calls_num ,
239
238
}
240
239
)
241
240
0 commit comments