region:us
# Table of Contents

* [Structure of ContentWriterFlow](#structure-of-contentwriterflow)
* [ContentWritrerFlow](#ContentWritrerFlow)
  * [ContentWriterFlow](#ContentWritrerFlow.ContentWriterFlow)
    * [detect\_finish\_or\_continue](#ContentWritrerFlow.ContentWriterFlow.detect_finish_or_continue)
* [\_\_init\_\_](#__init__)



# Structure of ContentWriterFlow

```
               goal
                |
                v
        +---------------+
        |  Controller   | --------<<<<-----------+
        +---------------+                        |
                |                                |
                | (command, command args)        |
                |                                |
                v                                |
        +------------------+                     |
        |   Executor       |  Each branch is an  |
        | (Tree Structure) |  executor           |
        +------------------+                     |
                |                                ^
                | (summary)                      |
                |                                |
                v                                |             
                |                                |
                +-> goes back to the Controller>-+

```

This is an abstract class. It is inherited by [CodeWriterFlow](https://huggingface.co/aiflows/CodeWriterFlowModule) and [PlanWriterFlow](https://huggingface.co/aiflows/PlanWriterFlowModule)



<a id="ContentWritrerFlow"></a>

# ContentWritrerFlow

<a id="ContentWritrerFlow.ContentWriterFlow"></a>

## ContentWriterFlow Objects

```python
class ContentWriterFlow(CircularFlow, ABC)
```

This is an abstract class for writing content (plan, code)
The ContentWriterFlow is made of a controller and a branching executor.
Each time the controller is called, the controller decides whether to write content
or to finish. If the content writer executor is called, the executor will write content
in an interactive way, finally, the user is able to give feedback to the content, so that
the controller can decide whether to write content again or to finish.

*Configuration Parameters*:
- `name`: Name of the flow.
- `description`: description of the flow.
- `max_round`: Max round of execution of the CircularFlow.
- `subflows_config`:
    - `Controller` (dict): The controller that decides whether to write content or to finish.
    - `Executor` (dict): A branching flow, we configure the specific executor in the subflows of the executor.
- `early_exit_key`: The key of the early exit variable in the output payload of the executor.
- `topology`: The topology of the subflows, this describes the I/O interface instances.

*Input Interface*:
- `goal`

*Output Interface*:
- `answer`
- `status`

<a id="ContentWritrerFlow.ContentWriterFlow.detect_finish_or_continue"></a>

#### detect\_finish\_or\_continue

```python
@abstractmethod
@CircularFlow.output_msg_payload_processor
def detect_finish_or_continue(output_payload: Dict[str, Any],
                              src_flow) -> Dict[str, Any]
```

1. Writing content to file;
2. Finish and early exit.

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

# \_\_init\_\_

