nbaldwin commited on
Commit
5eb5cb9
·
1 Parent(s): c4d9a5c

new version compatible

Browse files
ControllerAtomicFlow.yaml CHANGED
@@ -1,5 +1,6 @@
1
  name: "ControllerFlow"
2
  description: "Proposes the next action to take towards achieving the goal, and prepares the input for the executor."
 
3
  enable_cache: True
4
 
5
  #######################################################
 
1
  name: "ControllerFlow"
2
  description: "Proposes the next action to take towards achieving the goal, and prepares the input for the executor."
3
+ _target_: flow_modules.aiflows.ControllerExecutorFlowModule.ControllerAtomicFlow.instantiate_from_default_config
4
  enable_cache: True
5
 
6
  #######################################################
ControllerExecutorFlow.yaml CHANGED
@@ -1,7 +1,7 @@
1
  name: "CtrlEx"
2
  description: "ControllerExecutor (i.e., MRKL, ReAct) interaction implementation with Flows that approaches the problem solving in two phases: one Flow chooses the next step and another Flow executes it. This is repeated until the controller Flow concludes on an answer."
3
  max_rounds: 30
4
-
5
  ### Information used by the default interface specification implementation
6
  input_interface:
7
  - "goal"
@@ -14,7 +14,7 @@ subflows_config:
14
  Controller:
15
  name: "ControllerAtomicFlow"
16
  description: "A flow that calls other flows to solve a problem."
17
- _target_: flow_modules.aiflows.ControllerAtomicFlow.instantiate_from_default_config
18
  commands:
19
  finish:
20
  description: "Signal that the objective has been satisfied, and returns the answer to the user."
 
1
  name: "CtrlEx"
2
  description: "ControllerExecutor (i.e., MRKL, ReAct) interaction implementation with Flows that approaches the problem solving in two phases: one Flow chooses the next step and another Flow executes it. This is repeated until the controller Flow concludes on an answer."
3
  max_rounds: 30
4
+ _target_: flow_modules.aiflows.ControllerExecutorFlowModule.ControllerExecutorFlow.instantiate_from_default_config
5
  ### Information used by the default interface specification implementation
6
  input_interface:
7
  - "goal"
 
14
  Controller:
15
  name: "ControllerAtomicFlow"
16
  description: "A flow that calls other flows to solve a problem."
17
+ _target_: flow_modules.aiflows.ControllerExecutorFlowModule.ControllerAtomicFlow.instantiate_from_default_config
18
  commands:
19
  finish:
20
  description: "Signal that the objective has been satisfied, and returns the answer to the user."
WikiSearchAtomicFlow.yaml CHANGED
@@ -1,6 +1,6 @@
1
  name: WikiSearchAtomicFlow
2
  description: "A Flow that queries the wikipedia API for a page content."
3
-
4
  keep_raw_response: false
5
 
6
  lang: en
 
1
  name: WikiSearchAtomicFlow
2
  description: "A Flow that queries the wikipedia API for a page content."
3
+ _target_: flow_modules.aiflows.ControllerExecutorFlowModule.WikiSearchAtomicFlow.instantiate_from_default_config
4
  keep_raw_response: false
5
 
6
  lang: en
demo.yaml CHANGED
@@ -4,7 +4,11 @@ max_rounds: 30
4
  ### Subflows specification
5
  subflows_config:
6
  Controller:
7
- _target_: flow_modules.aiflows.ControllerExecutorFlowModule.ControllerAtomicFlow.instantiate_from_default_config
 
 
 
 
8
  commands:
9
  wiki_search:
10
  description: "Performs a search on Wikipedia."
@@ -22,6 +26,8 @@ subflows_config:
22
 
23
 
24
  wiki_search:
25
- _target_: flow_modules.aiflows.ControllerExecutorFlowModule.WikiSearchAtomicFlow.instantiate_from_default_config
26
  name: "WikiSearchAtomicFlow"
27
  description: "A flow that searches Wikipedia for information."
 
 
 
4
  ### Subflows specification
5
  subflows_config:
6
  Controller:
7
+ _target_: aiflows.base_flows.AtomicFlow.instantiate_from_default_config
8
+ name: "Proxy Controller"
9
+ description: "A flow that acts as a proxy for the controller."
10
+ flow_endpoint: ControllerAtomicFlow
11
+ user_id: local
12
  commands:
13
  wiki_search:
14
  description: "Performs a search on Wikipedia."
 
26
 
27
 
28
  wiki_search:
29
+ _target_: aiflows.base_flows.AtomicFlow.instantiate_from_default_config
30
  name: "WikiSearchAtomicFlow"
31
  description: "A flow that searches Wikipedia for information."
32
+ flow_endpoint: WikiSearchAtomicFlow
33
+ user_id: local
run.py CHANGED
@@ -58,26 +58,39 @@ if __name__ == "__main__":
58
 
59
 
60
  #3. ~~~~ Serve The Flow ~~~~
61
- serve_utils.recursive_serve_flow(
 
 
 
 
 
 
 
 
62
  cl = cl,
63
- flow_type="ControllerExecutorFlowModule",
64
- default_config=cfg,
65
- default_state=None,
66
- default_dispatch_point="coflows_dispatch"
67
  )
68
 
 
 
 
 
 
 
69
  #4. ~~~~~Start A Worker Thread~~~~~
70
- run_dispatch_worker_thread(cl, dispatch_point="coflows_dispatch", flow_modules_base_path=FLOW_MODULES_PATH)
71
 
72
  #5. ~~~~~Mount the flow and get its proxy~~~~~~
73
- proxy_flow = serve_utils.recursive_mount(
74
  cl=cl,
75
- client_id="local",
76
- flow_type="ControllerExecutorFlowModule",
77
- config_overrides=None,
78
- initial_state=None,
79
- dispatch_point_override=None,
80
- )
 
81
 
82
  #6. ~~~ Get the data ~~~
83
  data = {
 
58
 
59
 
60
  #3. ~~~~ Serve The Flow ~~~~
61
+
62
+
63
+ serve_utils.serve_flow(
64
+ cl = cl,
65
+ flow_class_name="flow_modules.aiflows.ControllerExecutorFlowModule.WikiSearchAtomicFlow",
66
+ flow_endpoint="WikiSearchAtomicFlow",
67
+ )
68
+
69
+ serve_utils.serve_flow(
70
  cl = cl,
71
+ flow_class_name="flow_modules.aiflows.ControllerExecutorFlowModule.ControllerAtomicFlow",
72
+ flow_endpoint="ControllerAtomicFlow",
 
 
73
  )
74
 
75
+ serve_utils.serve_flow(
76
+ cl = cl,
77
+ flow_class_name="flow_modules.aiflows.ControllerExecutorFlowModule.ControllerExecutorFlow",
78
+ flow_endpoint="ControllerExecutorFlow",
79
+ )
80
+
81
  #4. ~~~~~Start A Worker Thread~~~~~
82
+ run_dispatch_worker_thread(cl)
83
 
84
  #5. ~~~~~Mount the flow and get its proxy~~~~~~
85
+ proxy_flow= serve_utils.get_flow_instance(
86
  cl=cl,
87
+ flow_endpoint="ControllerExecutorFlow",
88
+ user_id="local",
89
+ config_overrides = cfg
90
+ )
91
+
92
+
93
+
94
 
95
  #6. ~~~ Get the data ~~~
96
  data = {