Tachi67 commited on
Commit
7a5b123
·
1 Parent(s): 68f5c6b

Update run_planwriter.py

Browse files
Files changed (1) hide show
  1. run_planwriter.py +10 -12
run_planwriter.py CHANGED
@@ -2,12 +2,13 @@ import os
2
 
3
  import hydra
4
 
5
- from flows.backends.api_info import ApiInfo
6
- from flows.messages import InputMessage
7
- from flows.utils.general_helpers import read_yaml_file
8
 
9
- from flows import logging
10
- from flows.flow_cache import CACHING_PARAMETERS, clear_cache
 
11
 
12
  CACHING_PARAMETERS.do_caching = False # Set to True in order to disable caching
13
  # clear_cache() # Uncomment this line to clear the cache
@@ -22,7 +23,7 @@ dependencies = [
22
  {"url": "aiflows/ChatFlowModule", "revision": "a749ad10ed39776ba6721c37d0dc22af49ca0f17"},
23
  ]
24
 
25
- from flows import flow_verse
26
 
27
  flow_verse.sync_dependencies(dependencies)
28
 
@@ -32,15 +33,12 @@ if __name__ == "__main__":
32
  api_information = [ApiInfo(backend_used="openai", api_key=os.getenv("OPENAI_API_KEY"))]
33
  path_to_output_file = None
34
 
35
- # ~~~ setting api information into config ~~~
36
  current_dir = os.getcwd()
37
  cfg_path = os.path.join(current_dir, "PlanWriterFlow.yaml")
38
  cfg = read_yaml_file(cfg_path)
39
- cfg["subflows_config"]["Controller"]["backend"]["api_infos"] = api_information
40
- cfg["subflows_config"]["Executor"]["subflows_config"]["write_plan"]["subflows_config"]["PlanGenerator"]["backend"]["api_infos"] = api_information
41
-
42
- # # ~~~ setting memory file of planner (empty dict)~~~
43
- # cfg["subflows_config"]["Executor"]["subflows_config"]["write_plan"]["memory_files"] = {}
44
 
45
  # ~~~ instantiating the flow and input data ~~~
46
  PlanWriterFlow = hydra.utils.instantiate(cfg, _recursive_=False, _convert_="partial")
 
2
 
3
  import hydra
4
 
5
+ from aiflows.backends.api_info import ApiInfo
6
+ from aiflows.messages import InputMessage
7
+ from aiflows.utils.general_helpers import read_yaml_file
8
 
9
+ from aiflows import logging
10
+ from aiflows.flow_cache import CACHING_PARAMETERS, clear_cache
11
+ from aiflows.utils.general_helpers import update_api_infos
12
 
13
  CACHING_PARAMETERS.do_caching = False # Set to True in order to disable caching
14
  # clear_cache() # Uncomment this line to clear the cache
 
23
  {"url": "aiflows/ChatFlowModule", "revision": "a749ad10ed39776ba6721c37d0dc22af49ca0f17"},
24
  ]
25
 
26
+ from aiflows import flow_verse
27
 
28
  flow_verse.sync_dependencies(dependencies)
29
 
 
33
  api_information = [ApiInfo(backend_used="openai", api_key=os.getenv("OPENAI_API_KEY"))]
34
  path_to_output_file = None
35
 
 
36
  current_dir = os.getcwd()
37
  cfg_path = os.path.join(current_dir, "PlanWriterFlow.yaml")
38
  cfg = read_yaml_file(cfg_path)
39
+
40
+ # ~~~ setting api information into config ~~~
41
+ update_api_infos(cfg, api_information)
 
 
42
 
43
  # ~~~ instantiating the flow and input data ~~~
44
  PlanWriterFlow = hydra.utils.instantiate(cfg, _recursive_=False, _convert_="partial")