Skip to content

Commit 0f50b3f

Browse files
committed
feat: implemented save to file and load from file functionality
1 parent aec4779 commit 0f50b3f

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import os
2+
import pickle
3+
4+
5+
def load_config_from_file(file_path: str='./.config.pkl',) -> dict:
6+
try:
7+
with open(file_path, 'rb') as file:
8+
loaded_config = pickle.load(file)
9+
except FileNotFoundError as FNFE:
10+
from dotenv import load_dotenv
11+
load_dotenv()
12+
return {
13+
"agent_type": "custom",
14+
"max_steps": 100,
15+
"max_actions_per_step": 10,
16+
"use_vision": True,
17+
"tool_call_in_content": True,
18+
"llm_provider": "openai",
19+
"llm_model_name": "gpt-4o",
20+
"llm_temperature": 1.0,
21+
"llm_base_url": '',
22+
"llm_api_key": '',
23+
"use_own_browser": False,
24+
"keep_browser_open": os.getenv("CHROME_PERSISTENT_SESSION", "False").lower() == "true",
25+
"headless": False,
26+
"disable_security": True,
27+
"enable_recording": True,
28+
"window_w": 1280,
29+
"window_h": 1100,
30+
"save_recording_path": "./tmp/record_videos",
31+
"save_trace_path": "./tmp/traces",
32+
"save_agent_history_path": "./tmp/agent_history",
33+
"task": "go to google.com and type 'OpenAI' click search and give me the first url",
34+
}
35+
return loaded_config
36+
37+
38+
def save_config_to_file(config, file_path: str='./.config.pkl',) -> None:
39+
with open(file_path, 'wb') as file:
40+
pickle.dump(config, file)

0 commit comments

Comments
 (0)