Upload 6 files
Browse filesFiles changed (2)
- InteractiveCodeGenFlow.py+30
- README.md+68-43
20 unmodified lines2122232425262728293031323334352 unmodified lines383940414243444546474849505152535455565758596061629 unmodified lines7273747576777879808182838420 unmodified lines - `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.
""" REQUIRED_KEYS_CONFIG = ["max_rounds", "early_exit_key", "topology", "memory_files"]
2 unmodified lines memory_files: Dict[str, Any], **kwargs ): """ This function initializes the flow. :param memory_files: the memory files that are used in the flow. :type memory_files: Dict[str, Any] :param kwargs: the keyword arguments. :type kwargs: Any """ super().__init__(**kwargs) self.memory_files = memory_files
@classmethod def instantiate_from_config(cls, config): """ This function instantiates the flow from a configuration. :param config: the configuration of the flow. :type config: Dict[str, Any] :return: the instantiated flow. :rtype: Flow """ flow_config = deepcopy(config)
kwargs = {"flow_config": flow_config}9 unmodified lines return cls(**kwargs)
def run(self, input_data: Dict[str, Any]) -> Dict[str, Any]: """ This function runs the flow. :param input_data: the input data to the flow. :type input_data: Dict[str, Any] :return: the output data from the flow. :rtype: Dict[str, Any] """ # ~~~ sets the input_data in the flow_state dict ~~~ self._state_update_dict(update_data=input_data)
12345678910111213141516171819202122232425262728293031323334353637383940414243123456789101122 unmodified lines343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103### Structure of InteractiveCodeGenFlow
``` goal | | | v +------------------+ | MemReading | Reads in the memory in the memory files. (https://huggingface.co/Tachi67/MemoryReadingFlowModule)https://huggingface.co/Tachi67/MemoryReadingFlowModule +------------------+ | | (code_library: function signatures of the library) | v +------------------+ | CodeGenerator | Generates code given goal, function signatures of the library. (https://huggingface.co/Tachi67/CodeGeneratorFlowModule) +------------------+ | | (code, language_of_code) | v +-------------------+ | CodeFileEdit | Edit a temp code file with the code generated. (https://huggingface.co/Tachi67/CodeFileEditFlowModule) +-------------------+ | | (temp_code_file_location) | v +------------------+ | ParseFeedback | Opens up the temp file until user closes the file, parse for user feedback. (https://huggingface.co/Tachi67/ParseFeedbackFlowModule) +------------------+ | | (code, feedback) | v code, feedback
```
Memory_files:- library.py
# 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>22 unmodified lines- `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\_\_
```pythondef __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@classmethoddef 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
```pythondef 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\_\_InteractiveCodeGenFlow.py+30
README.md+68-43