File size: 3,901 Bytes
12790c9
 
 
 
 
 
 
 
 
 
 
 
 
e0487cd
 
 
 
 
 
 
 
12790c9
e0487cd
 
 
 
 
 
12790c9
e0487cd
 
 
 
 
 
12790c9
e0487cd
 
 
 
 
 
 
 
 
 
 
12790c9
 
 
e0487cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12790c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e0487cd
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Table of Contents

* [Structure of InteractivePlanGenFlow](#structure-of-interactiveplangenflow)
* [run](#run)
* [InteractivePlanGenFlow](#InteractivePlanGenFlow)
  * [InteractivePlanGenFlow](#InteractivePlanGenFlow.InteractivePlanGenFlow)
    * [\_\_init\_\_](#InteractivePlanGenFlow.InteractivePlanGenFlow.__init__)
    * [instantiate\_from\_config](#InteractivePlanGenFlow.InteractivePlanGenFlow.instantiate_from_config)
    * [run](#InteractivePlanGenFlow.InteractivePlanGenFlow.run)
* [\_\_init\_\_](#__init__)


# Structure of InteractivePlanGenFlow

```
               goal
                |
                |
                |
                v
        +------------------+                     
        |   PlanGenerator  |  Generates plan given goal. (https://huggingface.co/aiflows/PlanGeneratorFlowModule)
        +------------------+                     
                |
                | (plan)
                |
                v
        +-------------------+
        |  PlanFileEdit     | Edit a temp file with the plan generated. (https://huggingface.co/aiflows/PlanFileEditFlowModule)
        +-------------------+                        
                |                                
                |  (temp_plan_file_location)
                |                                
                v                                
        +------------------+                     
        |   ParseFeedback  |  Opens up the temp file until user closes the file, parse for user feedback. (https://huggingface.co/aiflows/ParseFeedbackFlowModule)
        +------------------+                     
                |                                
                | (plan, feedback)                      
                |                                
                v                                            
             plan, feedback     

```



<a id="run"></a>

# run

<a id="InteractivePlanGenFlow"></a>

# InteractivePlanGenFlow

<a id="InteractivePlanGenFlow.InteractivePlanGenFlow"></a>

## InteractivePlanGenFlow Objects

```python
class InteractivePlanGenFlow(SequentialFlow)
```

This flow writes code in an interactive manner. It is a sequential flow composed of:
1. PlanGenerator: generates plan based on the goal.
2. PlanFileEditor: writes the generated plan to a temp file for the user to see, edit and provide feedback.
3. ParseFeedback: opens up the temp file with vscode and parses the feedback from the user.

*Input Interface*:
- `goal`
- `plan_file_location`

*Output Interface*:
- `plan`
- `feedback`
- `temp_plan_file_location`

*Configuration Parameters*:
- `input_interface`: the input interface of the flow.
- `output_interface`: the output interface of the flow.
- `subflows_config`: the configuration of the subflows.
- `early_exit_key`: the key in the state dict that indicates whether the flow should exit early.
- `topology`: the topology of the subflows.

<a id="InteractivePlanGenFlow.InteractivePlanGenFlow.__init__"></a>

#### \_\_init\_\_

```python
def __init__(**kwargs)
```

This function initializes the flow.

**Arguments**:

- `kwargs` (`Dict[str, Any]`): the configuration of the flow.

<a id="InteractivePlanGenFlow.InteractivePlanGenFlow.instantiate_from_config"></a>

#### instantiate\_from\_config

```python
@classmethod
def instantiate_from_config(cls, config)
```

This function instantiates the flow from a configuration.

**Arguments**:

- `config` (`Dict[str, Any]`): the configuration of the flow.

**Returns**:

`InteractivePlanGenFlow`: the instantiated flow.

<a id="InteractivePlanGenFlow.InteractivePlanGenFlow.run"></a>

#### run

```python
def run(input_data: Dict[str, Any]) -> Dict[str, Any]
```

This function runs the flow.

**Arguments**:

- `input_data` (`Dict[str, Any]`): the input data of the flow.

**Returns**:

`Dict[str, Any]`: the output data of the flow.

<a id="__init__"></a>

# \_\_init\_\_