File size: 1,678 Bytes
310b87e
 
 
3f6b5c2
 
 
 
 
310b87e
f5ba9f9
3f6b5c2
 
 
 
 
 
 
 
 
 
 
 
 
f5ba9f9
3f6b5c2
0ce69a9
3f6b5c2
f5ba9f9
3f6b5c2
310b87e
3f6b5c2
f5ba9f9
 
 
3f6b5c2
 
 
 
 
 
 
 
 
 
 
 
 
 
310b87e
3f6b5c2
310b87e
3f6b5c2
310b87e
3f6b5c2
 
310b87e
3f6b5c2
 
310b87e
3f6b5c2
310b87e
3f6b5c2
310b87e
3f6b5c2
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
---
license: mit
---
# Table of Contents

* [InterpreterAtomicFlow](#InterpreterAtomicFlow)
  * [InterpreterAtomicFlow](#InterpreterAtomicFlow.InterpreterAtomicFlow)
    * [set\_up\_flow\_state](#InterpreterAtomicFlow.InterpreterAtomicFlow.set_up_flow_state)
    * [run](#InterpreterAtomicFlow.InterpreterAtomicFlow.run)

<a id="InterpreterAtomicFlow"></a>

# InterpreterAtomicFlow

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

## InterpreterAtomicFlow Objects

```python
class InterpreterAtomicFlow(AtomicFlow)
```

This flow is used to run the code passed from the caller.
*Input Interface*:
- `code`
- `language`

*Output Interface*:
- `interpreter_output`: output of the code interpreter
- `code_runs`: whether the code runs successfully or not

*Configuration Parameters*:
- None

**Full credits to open-interpreter (https://github.com/KillianLucas/open-interpreter)
for the usage of code interpreters (package `code_interpreters`) and the function truncate_output()**

I'm extracting the code interpreter part from open-interpreter because the litellm version of open-interpreter
is not compatible with that of the current version of aiflows(v.0.1.7).

<a id="InterpreterAtomicFlow.InterpreterAtomicFlow.set_up_flow_state"></a>

#### set\_up\_flow\_state

```python
def set_up_flow_state()
```

class-specific flow state: language and code, which describes the programming language and the code to run.

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

#### run

```python
def run(input_message: FlowMessage)
```

Run the code interpreter and return the output.

**Arguments**:

- `input_message` (`FlowMessage`): The input message of the flow.