File size: 2,008 Bytes
f2030ec
 
6175374
 
 
f2030ec
035821c
f2030ec
 
 
 
6175374
 
 
035821c
6175374
035821c
6175374
 
 
 
 
 
035821c
6175374
035821c
6175374
 
 
 
 
 
 
035821c
6175374
035821c
6175374
 
 
 
 
035821c
6175374
035821c
6175374
 
 
 
 
 
 
035821c
f2030ec
 
6175374
035821c
6175374
f2030ec
6175374
 
 
035821c
6175374
f2030ec
6175374
 
 
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
66
67
68
name: "ChatInteractiveFlow"
description: "Flow that enables chatting between a ChatAtomicFlow and a user providing the input."

max_rounds: null # Run until early exit is detected

input_interface:
  _target_: aiflows.interfaces.KeyInterface
  
output_interface:
  - "end_of_interaction"
  - "answer"

subflows_config:
  Assistant:
    _target_: flow_modules.aiflows.ChatFlowModule.ChatAtomicFlow.instantiate_from_default_config
  User:
    _target_: flow_modules.aiflows.HumanStandardInputFlowModule.HumanStandardInputFlow.instantiate_from_default_config

topology:
  - goal: "Query the assistant"

    ### Input Interface
    input_interface:
      _target_: aiflows.interfaces.KeyInterface
      additional_transformations:
        - _target_: aiflows.data_transformations.KeyMatchInput

    ### Flow Specification
    flow: Assistant
    reset_every_round: false

    ### Output Interface
    output_interface:
      _target_: aiflows.interfaces.KeyInterface
      additional_transformations:
        - _target_: aiflows.data_transformations.PrintPreviousMessages

  - goal: "Ask the user for input"

    ### Input Interface
    input_interface:
      _target_: aiflows.interfaces.KeyInterface
      additional_transformations:
        - _target_: aiflows.data_transformations.KeyMatchInput

    ### Flow Specification
    flow: User
    reset_every_round: true

    ### Output Interface
    output_interface:
      _target_: aiflows.interfaces.KeyInterface
      keys_to_rename:
        human_input: query
      additional_transformations:
        - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
          regex: '(?<=```answer)([\s\S]*?)(?=```)'
          input_key: "query"
          output_key: "answer"
          strip: True
          assert_unique: True
        - _target_: aiflows.data_transformations.EndOfInteraction
          end_of_interaction_string: "<END>"
          input_key: "query"
          output_key: "end_of_interaction"

early_exit_key: "end_of_interaction"