File size: 2,597 Bytes
d832d4e
 
 
 
075da16
 
 
 
d832d4e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
075da16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d832d4e
 
 
 
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
# Table of Contents

* [InteractiveCodeGenFlow](#InteractiveCodeGenFlow)
  * [InteractiveCodeGenFlow](#InteractiveCodeGenFlow.InteractiveCodeGenFlow)
    * [\_\_init\_\_](#InteractiveCodeGenFlow.InteractiveCodeGenFlow.__init__)
    * [instantiate\_from\_config](#InteractiveCodeGenFlow.InteractiveCodeGenFlow.instantiate_from_config)
    * [run](#InteractiveCodeGenFlow.InteractiveCodeGenFlow.run)
* [run](#run)
* [\_\_init\_\_](#__init__)

<a id="InteractiveCodeGenFlow"></a>

# InteractiveCodeGenFlow

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

## InteractiveCodeGenFlow Objects

```python
class InteractiveCodeGenFlow(SequentialFlow)
```

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

*Input Interface*:
- `goal`

*Output Interface*:
- `code`
- `feedback`
- `temp_code_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="InteractiveCodeGenFlow.InteractiveCodeGenFlow.__init__"></a>

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

```python
def __init__(memory_files: Dict[str, Any], **kwargs)
```

This function initializes the flow.

**Arguments**:

- `memory_files` (`Dict[str, Any]`): the memory files that are used in the flow.
- `kwargs` (`Any`): the keyword arguments.

<a id="InteractiveCodeGenFlow.InteractiveCodeGenFlow.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**:

`Flow`: the instantiated flow.

<a id="InteractiveCodeGenFlow.InteractiveCodeGenFlow.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 to the flow.

**Returns**:

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

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

# run

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

# \_\_init\_\_