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_CoderFlow](#CtrlExMem_CoderFlow)
|
| 4 |
+
* [CtrlExMem\_CoderFlow](#CtrlExMem_CoderFlow.CtrlExMem_CoderFlow)
|
| 5 |
+
* [run\_coder](#run_coder)
|
| 6 |
+
* [Planner\_CoderFlow](#Planner_CoderFlow)
|
| 7 |
+
* [Planner\_CoderFlow](#Planner_CoderFlow.Planner_CoderFlow)
|
| 8 |
+
* [Controller\_CoderFlow](#Controller_CoderFlow)
|
| 9 |
+
* [Controller\_CoderFlow](#Controller_CoderFlow.Controller_CoderFlow)
|
| 10 |
+
* [UpdatePlanAtomicFlow](#UpdatePlanAtomicFlow)
|
| 11 |
+
* [UpdatePlanAtomicFlow](#UpdatePlanAtomicFlow.UpdatePlanAtomicFlow)
|
| 12 |
+
* [CoderFlow](#CoderFlow)
|
| 13 |
+
* [CoderFlow](#CoderFlow.CoderFlow)
|
| 14 |
+
* [run](#CoderFlow.CoderFlow.run)
|
| 15 |
+
* [\_\_init\_\_](#__init__)
|
| 16 |
+
|
| 17 |
+
<a id="CtrlExMem_CoderFlow"></a>
|
| 18 |
+
|
| 19 |
+
# CtrlExMem\_CoderFlow
|
| 20 |
+
|
| 21 |
+
<a id="CtrlExMem_CoderFlow.CtrlExMem_CoderFlow"></a>
|
| 22 |
+
|
| 23 |
+
## CtrlExMem\_CoderFlow Objects
|
| 24 |
+
|
| 25 |
+
```python
|
| 26 |
+
class CtrlExMem_CoderFlow(CtrlExMemFlow)
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
This class inherits from the CtrlExMemFlow class from AbstractBossFlowModule.
|
| 30 |
+
See: https://huggingface.co/Tachi67/AbstractBossFlowModule/blob/main/CtrlExMemFlow.py
|
| 31 |
+
|
| 32 |
+
*Input Interface*:
|
| 33 |
+
- `plan`
|
| 34 |
+
- `logs`
|
| 35 |
+
- `code_library`: the signatures and docstring of the functions in the code library.
|
| 36 |
+
- `memory_files`
|
| 37 |
+
- `goal`
|
| 38 |
+
|
| 39 |
+
*Output Interface*
|
| 40 |
+
- `result` (str): The result of the flow, the result will be returned to the caller.
|
| 41 |
+
- `summary` (str): The summary of the flow, the summary will be logged into the logs of the caller flow.
|
| 42 |
+
|
| 43 |
+
<a id="run_coder"></a>
|
| 44 |
+
|
| 45 |
+
# run\_coder
|
| 46 |
+
|
| 47 |
+
<a id="Planner_CoderFlow"></a>
|
| 48 |
+
|
| 49 |
+
# Planner\_CoderFlow
|
| 50 |
+
|
| 51 |
+
<a id="Planner_CoderFlow.Planner_CoderFlow"></a>
|
| 52 |
+
|
| 53 |
+
## Planner\_CoderFlow Objects
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
class Planner_CoderFlow(PlanWriterFlow)
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
Planner of the coder flow, it inherits from PlanWriterFlow, see: https://huggingface.co/Tachi67/PlanWriterFlowModule
|
| 60 |
+
|
| 61 |
+
<a id="Controller_CoderFlow"></a>
|
| 62 |
+
|
| 63 |
+
# Controller\_CoderFlow
|
| 64 |
+
|
| 65 |
+
<a id="Controller_CoderFlow.Controller_CoderFlow"></a>
|
| 66 |
+
|
| 67 |
+
## Controller\_CoderFlow Objects
|
| 68 |
+
|
| 69 |
+
```python
|
| 70 |
+
class Controller_CoderFlow(ChatAtomicFlow)
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
Refer to: https://huggingface.co/Tachi67/JarvisFlowModule/blob/main/Controller_JarvisFlow.py
|
| 74 |
+
|
| 75 |
+
<a id="UpdatePlanAtomicFlow"></a>
|
| 76 |
+
|
| 77 |
+
# UpdatePlanAtomicFlow
|
| 78 |
+
|
| 79 |
+
<a id="UpdatePlanAtomicFlow.UpdatePlanAtomicFlow"></a>
|
| 80 |
+
|
| 81 |
+
## UpdatePlanAtomicFlow Objects
|
| 82 |
+
|
| 83 |
+
```python
|
| 84 |
+
class UpdatePlanAtomicFlow(AtomicFlow)
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
This flow updates the plan file with the updated plan. The controller should pass the updated plan to this flow.
|
| 88 |
+
This design (controller reflect on the existing plan--update plan) is intended to let the controller more aware of the
|
| 89 |
+
plan it has. However one setback is that this process in then not deterministic.
|
| 90 |
+
|
| 91 |
+
*Input Interface*
|
| 92 |
+
- `updated_plan`: the updated plan in string format
|
| 93 |
+
|
| 94 |
+
*Output Interface*
|
| 95 |
+
- `result`: the result of the update plan operation
|
| 96 |
+
|
| 97 |
+
<a id="CoderFlow"></a>
|
| 98 |
+
|
| 99 |
+
# CoderFlow
|
| 100 |
+
|
| 101 |
+
<a id="CoderFlow.CoderFlow"></a>
|
| 102 |
+
|
| 103 |
+
## CoderFlow Objects
|
| 104 |
+
|
| 105 |
+
```python
|
| 106 |
+
class CoderFlow(AbstractBossFlow)
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
Coder flow is one executor branch of the Jarvis flow. At a higher level, it is a flow that
|
| 110 |
+
writes and runs code given a goal. In the Jarvis flow, the Coder flow in invoked by the controller,
|
| 111 |
+
The Coder flow receives the goal generated by the controller, writes and runs code in an interactive fashion.
|
| 112 |
+
|
| 113 |
+
The Coder flow has the similar structure as the Jarvis flow (inherited from AbstractBossFlow).
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
*Input Interface (expected input)*
|
| 117 |
+
- `goal` (str): The goal from the caller (source flow, i.e. JarvisFlow)
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
*Output Interface (expected output)*
|
| 121 |
+
- `result` (str): The result of the flow, the result will be returned to the caller (i.e. JarvisFlow).
|
| 122 |
+
- `summary` (str): The summary of the flow, the summary will be logged into the logs of the caller flow (i.e. JarvisFlow).
|
| 123 |
+
|
| 124 |
+
Typical workflow of Coder:
|
| 125 |
+
0. JarvisFlow calls Coder with a goal.
|
| 126 |
+
1. MemoryReading reads plans, logs and code library.
|
| 127 |
+
2. Planner makes plan based on goal.
|
| 128 |
+
3. Extend library with the goal given by the controller.
|
| 129 |
+
4. Run code with code (possibly calls the newly written function) given by the controller.
|
| 130 |
+
5. Finish and give an answer.
|
| 131 |
+
|
| 132 |
+
<a id="CoderFlow.CoderFlow.run"></a>
|
| 133 |
+
|
| 134 |
+
#### run
|
| 135 |
+
|
| 136 |
+
```python
|
| 137 |
+
def run(input_data: Dict[str, Any]) -> Dict[str, Any]
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
The run function of the Coder flow.
|
| 141 |
+
|
| 142 |
+
**Arguments**:
|
| 143 |
+
|
| 144 |
+
- `input_data` (`Dict[str, Any]`): The input data of the flow.
|
| 145 |
+
|
| 146 |
+
**Returns**:
|
| 147 |
+
|
| 148 |
+
`Dict[str, Any]`: The output data of the flow.
|
| 149 |
+
|
| 150 |
+
<a id="__init__"></a>
|
| 151 |
+
|
| 152 |
+
# \_\_init\_\_
|
| 153 |
+
|