Proper Doc
Browse files
README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
| 4 |
-
|
| 5 |
# Table of Contents
|
| 6 |
|
|
|
|
| 7 |
* [ControllerAtomicFlow](#ControllerAtomicFlow)
|
| 8 |
* [Command](#ControllerAtomicFlow.Command)
|
| 9 |
* [ControllerAtomicFlow](#ControllerAtomicFlow.ControllerAtomicFlow)
|
|
@@ -20,7 +20,19 @@ license: mit
|
|
| 20 |
* [search\_page\_titles](#wikipediaAPI.WikipediaAPIWrapper.search_page_titles)
|
| 21 |
* [ControllerExecutorFlow](#ControllerExecutorFlow)
|
| 22 |
* [ControllerExecutorFlow](#ControllerExecutorFlow.ControllerExecutorFlow)
|
| 23 |
-
* [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
<a id="ControllerAtomicFlow"></a>
|
| 26 |
|
|
@@ -119,18 +131,14 @@ This method instantiates the flow from a configuration file.
|
|
| 119 |
#### run
|
| 120 |
|
| 121 |
```python
|
| 122 |
-
def run(
|
| 123 |
```
|
| 124 |
|
| 125 |
This method runs the flow. Note that the response of the LLM is in the JSON format, but it's not a hard constraint (it can hallucinate and return an invalid JSON)
|
| 126 |
|
| 127 |
**Arguments**:
|
| 128 |
|
| 129 |
-
- `
|
| 130 |
-
|
| 131 |
-
**Returns**:
|
| 132 |
-
|
| 133 |
-
`Dict[str, Any]`: The output data of the flow (thought, reasoning, criticism, command, command_args)
|
| 134 |
|
| 135 |
<a id="__init__"></a>
|
| 136 |
|
|
@@ -177,18 +185,14 @@ Default: "A Flow that queries the wikipedia API for a page content."
|
|
| 177 |
#### run
|
| 178 |
|
| 179 |
```python
|
| 180 |
-
def run(
|
| 181 |
```
|
| 182 |
|
| 183 |
Runs the WikiSearch Atomic Flow. It's used to execute a Wikipedia search and get page summaries.
|
| 184 |
|
| 185 |
**Arguments**:
|
| 186 |
|
| 187 |
-
- `
|
| 188 |
-
|
| 189 |
-
**Returns**:
|
| 190 |
-
|
| 191 |
-
`Dict[str, Any]`: The output data dictionary
|
| 192 |
|
| 193 |
<a id="wikipediaAPI"></a>
|
| 194 |
|
|
@@ -223,7 +227,7 @@ It limits the Document content by doc_content_chars_max.
|
|
| 223 |
#### validate\_environment
|
| 224 |
|
| 225 |
```python
|
| 226 |
-
@root_validator()
|
| 227 |
def validate_environment(cls, values: Dict) -> Dict
|
| 228 |
```
|
| 229 |
|
|
@@ -286,7 +290,7 @@ Run Wikipedia search and get page summaries.
|
|
| 286 |
## ControllerExecutorFlow Objects
|
| 287 |
|
| 288 |
```python
|
| 289 |
-
class ControllerExecutorFlow(
|
| 290 |
```
|
| 291 |
|
| 292 |
This class implements a ControllerExecutorFlow. It's composed of a ControllerAtomicFlow and an ExecutorFlow.
|
|
@@ -346,25 +350,81 @@ By default, the topology is the one shown in the illustration above
|
|
| 346 |
- `flow_config`: The configuration of the flow (see Configuration Parameters).
|
| 347 |
- `subflows`: A list of subflows. Required when instantiating the subflow programmatically (it replaces subflows_config from flow_config).
|
| 348 |
|
| 349 |
-
<a id="ControllerExecutorFlow.ControllerExecutorFlow.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 350 |
|
| 351 |
-
|
|
|
|
|
|
|
| 352 |
|
| 353 |
```python
|
| 354 |
-
|
| 355 |
-
def detect_finish_or_continue(
|
| 356 |
-
output_payload: Dict[str, Any],
|
| 357 |
-
src_flow: ControllerAtomicFlow) -> Dict[str, Any]
|
| 358 |
```
|
| 359 |
|
| 360 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 361 |
|
| 362 |
**Arguments**:
|
| 363 |
|
| 364 |
-
- `
|
| 365 |
-
- `src_flow` (`ControllerAtomicFlow`): The ControllerAtomicFlow.
|
| 366 |
|
| 367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
|
| 369 |
-
|
| 370 |
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
|
|
|
| 4 |
# Table of Contents
|
| 5 |
|
| 6 |
+
* [run](#run)
|
| 7 |
* [ControllerAtomicFlow](#ControllerAtomicFlow)
|
| 8 |
* [Command](#ControllerAtomicFlow.Command)
|
| 9 |
* [ControllerAtomicFlow](#ControllerAtomicFlow.ControllerAtomicFlow)
|
|
|
|
| 20 |
* [search\_page\_titles](#wikipediaAPI.WikipediaAPIWrapper.search_page_titles)
|
| 21 |
* [ControllerExecutorFlow](#ControllerExecutorFlow)
|
| 22 |
* [ControllerExecutorFlow](#ControllerExecutorFlow.ControllerExecutorFlow)
|
| 23 |
+
* [generate\_reply](#ControllerExecutorFlow.ControllerExecutorFlow.generate_reply)
|
| 24 |
+
* [get\_next\_state](#ControllerExecutorFlow.ControllerExecutorFlow.get_next_state)
|
| 25 |
+
* [set\_up\_flow\_state](#ControllerExecutorFlow.ControllerExecutorFlow.set_up_flow_state)
|
| 26 |
+
* [call\_controller](#ControllerExecutorFlow.ControllerExecutorFlow.call_controller)
|
| 27 |
+
* [call\_executor](#ControllerExecutorFlow.ControllerExecutorFlow.call_executor)
|
| 28 |
+
* [register\_data\_to\_state](#ControllerExecutorFlow.ControllerExecutorFlow.register_data_to_state)
|
| 29 |
+
* [run](#ControllerExecutorFlow.ControllerExecutorFlow.run)
|
| 30 |
+
|
| 31 |
+
<a id="run"></a>
|
| 32 |
+
|
| 33 |
+
# run
|
| 34 |
+
|
| 35 |
+
A simple script to run a Flow that can be used for development and debugging.
|
| 36 |
|
| 37 |
<a id="ControllerAtomicFlow"></a>
|
| 38 |
|
|
|
|
| 131 |
#### run
|
| 132 |
|
| 133 |
```python
|
| 134 |
+
def run(input_message: FlowMessage)
|
| 135 |
```
|
| 136 |
|
| 137 |
This method runs the flow. Note that the response of the LLM is in the JSON format, but it's not a hard constraint (it can hallucinate and return an invalid JSON)
|
| 138 |
|
| 139 |
**Arguments**:
|
| 140 |
|
| 141 |
+
- `input_message` (`FlowMessage`): The input data of the flow.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
<a id="__init__"></a>
|
| 144 |
|
|
|
|
| 185 |
#### run
|
| 186 |
|
| 187 |
```python
|
| 188 |
+
def run(input_message: FlowMessage)
|
| 189 |
```
|
| 190 |
|
| 191 |
Runs the WikiSearch Atomic Flow. It's used to execute a Wikipedia search and get page summaries.
|
| 192 |
|
| 193 |
**Arguments**:
|
| 194 |
|
| 195 |
+
- `input_message` (`FlowMessage`): The input message
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
|
| 197 |
<a id="wikipediaAPI"></a>
|
| 198 |
|
|
|
|
| 227 |
#### validate\_environment
|
| 228 |
|
| 229 |
```python
|
| 230 |
+
@root_validator(pre=True)
|
| 231 |
def validate_environment(cls, values: Dict) -> Dict
|
| 232 |
```
|
| 233 |
|
|
|
|
| 290 |
## ControllerExecutorFlow Objects
|
| 291 |
|
| 292 |
```python
|
| 293 |
+
class ControllerExecutorFlow(CompositeFlow)
|
| 294 |
```
|
| 295 |
|
| 296 |
This class implements a ControllerExecutorFlow. It's composed of a ControllerAtomicFlow and an ExecutorFlow.
|
|
|
|
| 350 |
- `flow_config`: The configuration of the flow (see Configuration Parameters).
|
| 351 |
- `subflows`: A list of subflows. Required when instantiating the subflow programmatically (it replaces subflows_config from flow_config).
|
| 352 |
|
| 353 |
+
<a id="ControllerExecutorFlow.ControllerExecutorFlow.generate_reply"></a>
|
| 354 |
+
|
| 355 |
+
#### generate\_reply
|
| 356 |
+
|
| 357 |
+
```python
|
| 358 |
+
def generate_reply()
|
| 359 |
+
```
|
| 360 |
+
|
| 361 |
+
This method generates the reply of the flow. It's called when the flow is finished.
|
| 362 |
|
| 363 |
+
<a id="ControllerExecutorFlow.ControllerExecutorFlow.get_next_state"></a>
|
| 364 |
+
|
| 365 |
+
#### get\_next\_state
|
| 366 |
|
| 367 |
```python
|
| 368 |
+
def get_next_state()
|
|
|
|
|
|
|
|
|
|
| 369 |
```
|
| 370 |
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
<a id="ControllerExecutorFlow.ControllerExecutorFlow.set_up_flow_state"></a>
|
| 374 |
+
|
| 375 |
+
#### set\_up\_flow\_state
|
| 376 |
+
|
| 377 |
+
```python
|
| 378 |
+
def set_up_flow_state()
|
| 379 |
+
```
|
| 380 |
+
|
| 381 |
+
Sets up the flow state.
|
| 382 |
+
|
| 383 |
+
<a id="ControllerExecutorFlow.ControllerExecutorFlow.call_controller"></a>
|
| 384 |
+
|
| 385 |
+
#### call\_controller
|
| 386 |
+
|
| 387 |
+
```python
|
| 388 |
+
def call_controller()
|
| 389 |
+
```
|
| 390 |
+
|
| 391 |
+
Calls the controller: the flow that decides which command to call next.
|
| 392 |
+
|
| 393 |
+
<a id="ControllerExecutorFlow.ControllerExecutorFlow.call_executor"></a>
|
| 394 |
+
|
| 395 |
+
#### call\_executor
|
| 396 |
+
|
| 397 |
+
```python
|
| 398 |
+
def call_executor()
|
| 399 |
+
```
|
| 400 |
+
|
| 401 |
+
Calls the flow that executes the command instructed by the ControllerAtomicFlow.
|
| 402 |
+
|
| 403 |
+
<a id="ControllerExecutorFlow.ControllerExecutorFlow.register_data_to_state"></a>
|
| 404 |
+
|
| 405 |
+
#### register\_data\_to\_state
|
| 406 |
+
|
| 407 |
+
```python
|
| 408 |
+
def register_data_to_state(input_message)
|
| 409 |
+
```
|
| 410 |
+
|
| 411 |
+
This method registers the input message data to the flow state. It's everytime a new input message is received.
|
| 412 |
|
| 413 |
**Arguments**:
|
| 414 |
|
| 415 |
+
- `input_message` (`FlowMessage`): The input message
|
|
|
|
| 416 |
|
| 417 |
+
<a id="ControllerExecutorFlow.ControllerExecutorFlow.run"></a>
|
| 418 |
+
|
| 419 |
+
#### run
|
| 420 |
+
|
| 421 |
+
```python
|
| 422 |
+
def run(input_message: FlowMessage)
|
| 423 |
+
```
|
| 424 |
+
|
| 425 |
+
Runs the WikiSearch Atomic Flow. It's used to execute a Wikipedia search and get page summaries.
|
| 426 |
+
|
| 427 |
+
**Arguments**:
|
| 428 |
|
| 429 |
+
- `input_message` (`FlowMessage`): The input message
|
| 430 |
|