|
# 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\_\_ |
|
|
|
|