File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
browsergym/core/src/browsergym/utils Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,13 @@ async def app_lifespan(server: FastMCP) -> AsyncIterator[AppContext]:
126126mcp = FastMCP ("BrowserGym" , lifespan = app_lifespan )
127127
128128
129+ def format_func_call (func : Callable , args , kwargs ) -> str :
130+ args_str = ", " .join (repr (arg ) for arg in args )
131+ kwargs_str = ", " .join (f"{ k } ={ repr (v )} " for k , v in kwargs .items ())
132+ all_args_str = ", " .join (filter (None , [args_str , kwargs_str ]))
133+ return f"{ func .__name__ } ({ all_args_str } )"
134+
135+
129136def fn_wrapper (func : Callable , validate : bool = True ):
130137 async def decorator (* args , ** kwargs ):
131138 """
@@ -146,7 +153,7 @@ async def decorator(*args, **kwargs):
146153
147154 fn = getattr (fn_context , func .__name__ )
148155
149- gym .last_action = fn . __name__
156+ gym .last_action = format_func_call ( fn , args , kwargs )
150157 info , send_message_to_user , report_infeasible_instructions = await asyncio .to_thread (
151158 gym .pre_step
152159 )
You can’t perform that action at this time.
0 commit comments