Skip to content

Commit 1f76e35

Browse files
committed
minor convenient updates
1 parent 0fc1732 commit 1f76e35

File tree

2 files changed

+54
-10
lines changed

2 files changed

+54
-10
lines changed

_sandbox

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# import gradio as gr
2+
# import pandas as pd
3+
4+
# df = pd.DataFrame({"A": [14, 4, 5, 4, 1], "B": [5, 2, 54, 3, 2], "C": [20, 20, 7, 3, 8]})
5+
6+
7+
# # Highlight entire rows based on conditions
8+
# def highlight_rows(row):
9+
# if row["A"] > 4:
10+
# return ["background-color: darkblue"] * len(row)
11+
# else:
12+
# return [""] * len(row)
13+
14+
15+
# styler = df.style.apply(highlight_rows, axis=1)
16+
17+
# with gr.Blocks() as demo:
18+
# gr.Dataframe(styler)
19+
# demo.launch()
20+
21+
22+
def format_function_call(func_name, kwargs=None):
23+
"""Format a function name and kwargs dict into a Python function call string."""
24+
if kwargs is None:
25+
kwargs = {}
26+
27+
if not kwargs:
28+
return f"{func_name}()"
29+
30+
args_str = ", ".join(f"{key}={repr(value)}" for key, value in kwargs.items())
31+
return f"{func_name}({args_str})"
32+
33+
34+
print(format_function_call("my_function", {"arg1": 42, "arg2": """Marc's 17" laptop"""}))
35+
print(format_function_call("my_function", {"arg1": 42, "arg2": "17' pole"}))

main_workarena_debug.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,45 @@
77
"""
88

99
import logging
10+
from copy import deepcopy
1011

1112
import bgym
1213

1314
from agentlab.agents.tool_use_agent.tool_use_agent import (
1415
DEFAULT_PROMPT_CONFIG,
15-
GPT_4_1_MINI,
16-
OPENAI_MODEL_CONFIG,
16+
GPT_4_1,
1717
ToolUseAgentArgs,
1818
)
1919
from agentlab.experiments.study import Study
2020

2121
logging.getLogger().setLevel(logging.INFO)
2222

23-
agent_config = ToolUseAgentArgs(
24-
model_args=GPT_4_1_MINI,
25-
config=DEFAULT_PROMPT_CONFIG,
26-
)
23+
config = deepcopy(DEFAULT_PROMPT_CONFIG)
24+
# config.keep_last_n_obs = 1
25+
config.obs.use_som = True
2726

2827

29-
agent_config.config.action_subsets = ("workarena",) # use the workarena action set
28+
agent_configs = [
29+
ToolUseAgentArgs(
30+
model_args=GPT_4_1,
31+
config=config,
32+
),
33+
# ToolUseAgentArgs(
34+
# model_args=GPT_4_1,
35+
# config=config,
36+
# ),
37+
]
3038

31-
agent_args = [agent_config]
39+
for agent_config in agent_configs:
40+
agent_config.config.action_subsets = ("workarena",) # use the workarena action set
3241

3342

3443
# ## select the benchmark to run on
3544
# benchmark = "miniwob_tiny_test"
3645
benchmark = "workarena_l1"
3746

3847

39-
benchmark = bgym.DEFAULT_BENCHMARKS[benchmark]() # type: bgym.Benchmark
48+
benchmark = bgym.DEFAULT_BENCHMARKS[benchmark](n_repeats=4) # type: bgym.Benchmark
4049
benchmark = benchmark.subset_from_glob("task_name", "*create*")
4150

4251
# for env_args in benchmark.env_args_list:
@@ -58,7 +67,7 @@
5867
study.find_incomplete(include_errors=True)
5968

6069
else:
61-
study = Study(agent_args, benchmark, logging_level_stdout=logging.WARNING)
70+
study = Study(agent_configs, benchmark, logging_level_stdout=logging.WARNING)
6271

6372
study.run(
6473
n_jobs=n_jobs,

0 commit comments

Comments
 (0)