### Structure of CodeWriterFlow
```
goal
|
v
+---------------+
| Controller | --------<<<<-----------+
+---------------+ |
| |
| (command, command args) |
| |
v |
+------------------+ |
| Executor | Each branch is an |
| (Tree Structure) | executor |
+------------------+ |
| ^
| (summary) |
| |
v |
| |
+-> goes back to the Controller>-+
```
Structure of the Executors:
```
+-------------------+
| Branching |
| Executor |
+-------------------+
/ | \
/ | \
/ | \
/ | \
write_code ask_user test
```
About the branches:
- [ask_user](https://huggingface.co/Tachi67/CodeWriterFlowModule/blob/main/CodeWriterAskUserFlow.py): Ask user for info / confirmation, etc.
- [write_code](https://huggingface.co/Tachi67/InteractiveCodeGenFlowModule): Generates code (user edit is allowed) and fetches user feedback.
- [test](https://huggingface.co/Tachi67/TestCodeFlowModule): Test the code, user can provide test suites, if nothing is provided, syntax of the code is checked.
How it works:
Controller calls write_code until user is satisfied in the feedback, then controller calls test to test the code, if test passes, finish.
# Table of Contents
* [run\_codewriter](#run_codewriter)
* [CodeWriterCtrlFlow](#CodeWriterCtrlFlow)
* [CodeWriterCtrlFlow](#CodeWriterCtrlFlow.CodeWriterCtrlFlow)
* [CodeWriterAskUserFlow](#CodeWriterAskUserFlow)
* [CodeWriterAskUserFlow](#CodeWriterAskUserFlow.CodeWriterAskUserFlow)
* [run](#CodeWriterAskUserFlow.CodeWriterAskUserFlow.run)
* [CodeWriterFlow](#CodeWriterFlow)
* [CodeWriterFlow](#CodeWriterFlow.CodeWriterFlow)
* [\_\_init\_\_](#__init__)
# run\_codewriter
# CodeWriterCtrlFlow
## CodeWriterCtrlFlow Objects
```python
class CodeWriterCtrlFlow(ChatAtomicFlow)
```
refer to https://huggingface.co/Tachi67/JarvisFlowModule/blob/main/Controller_JarvisFlow.py
# CodeWriterAskUserFlow
## CodeWriterAskUserFlow Objects
```python
class CodeWriterAskUserFlow(HumanStandardInputFlow)
```
This class is used to ask for user feedback whenever the controller is unsure of something, or need confirmation, etc.
*Expected Input*:
- `question`: The question asked by the controller
*Expected Behaviour*:
- The question is displayed, and the user gives feedback by inputing string.
*Expected Ouput*:
- `feedback`: The input of the user.
- `code`: No code was written.
#### run
```python
def run(input_data: Dict[str, Any]) -> Dict[str, Any]
```
Run the flow.
**Arguments**:
- `input_data`: The input data.
**Returns**:
The output data.
# CodeWriterFlow
## CodeWriterFlow Objects
```python
class CodeWriterFlow(ContentWriterFlow)
```
This flow inherits from ContentWriterFlow, it is used to write code in an interactive way.
In the subflow of the executor, we specify an InteractiveCodeGenFlow (https://huggingface.co/Tachi67/InteractiveCodeGenFlowModule)
*Input Interface*:
- `goal`
*Output Interface*:
- `code`
- `result`
- `summary`
- `status`
# \_\_init\_\_