File size: 5,839 Bytes
5374a2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
{
    "class_name": "SequentialWorkFlowGraph",
    "goal": "Answer user questions accurately and concisely by decomposing the problem into analysis and generate.",
    "tasks": [
        {
            "name": "generate_answer",
            "description": "Draft an answer using the retrieved context.",
            "inputs": [
                {
                    "name": "question",
                    "type": "str",
                    "description": "The original question from the user.",
                    "required": true
                }
            ],
            "outputs": [
                {
                    "name": "draft_answer",
                    "type": "str",
                    "description": "A concise, direct answer to the question.",
                    "required": true
                }
            ],
            "prompt": null,
            "prompt_template": {
                "class_name": "StringTemplate",
                "instruction": "You can search and integrate the context to generate answers. You should provide the final answer (Yes or No) in the 'answer' field. Format your answer in <answer>xxx</answer>."
            },
            "system_prompt": "You are a helpful and highly intelligent assistant.",
            "parse_mode": "xml",
            "parse_func": null,
            "parse_title": null,
            "tool_names": null
        },
        {
            "name": "critique_answer",
            "description": "Check the drafted answer for correctness, faithfulness to the context, and alignment with the question.",
            "inputs": [
                {
                    "name": "question",
                    "type": "str",
                    "description": "The original question from the user.",
                    "required": true
                },
                {
                    "name": "draft_answer",
                    "type": "str",
                    "description": "The answer proposed by generate_answer.",
                    "required": true
                }
            ],
            "outputs": [
                {
                    "name": "is_valid",
                    "type": "bool",
                    "description": "Whether the draft answer is correct and well-supported by the context.",
                    "required": true
                },
                {
                    "name": "issues",
                    "type": "list[str]",
                    "description": "List of detected issues (e.g., hallucination, missing details, ambiguity).",
                    "required": false
                },
                {
                    "name": "suggested_improvements",
                    "type": "str",
                    "description": "Textual suggestions on how to improve the answer, if needed.",
                    "required": false
                }
            ],
            "prompt": null,
            "prompt_template": {
                "class_name": "StringTemplate",
                "instruction": "You are an Answer Critique Agent.\nCompare the draft answer to the context and question.\n1) Mark if the answer is fully supported and correctly addresses the question.\n2) If not valid, list concrete issues and suggest how to fix them.\nReturn XML with <is_valid>, <issues> (items as <issue>), and <suggested_improvements>."
            },
            "system_prompt": "You are a helpful and highly intelligent assistant.",
            "parse_mode": "xml",
            "parse_func": null,
            "parse_title": null,
            "tool_names": null
        },
        {
            "name": "refine_answer",
            "description": "Refine or rewrite the answer based on critique, preserving factual alignment with the context.",
            "inputs": [
                {
                    "name": "question",
                    "type": "str",
                    "description": "The original question from the user.",
                    "required": true
                },
                {
                    "name": "draft_answer",
                    "type": "str",
                    "description": "The initial answer to be refined.",
                    "required": true
                },
                {
                    "name": "is_valid",
                    "type": "bool",
                    "description": "Validation flag from critique_answer.",
                    "required": true
                },
                {
                    "name": "suggested_improvements",
                    "type": "str",
                    "description": "Guidance from the critique_answer step on how to improve the answer.",
                    "required": false
                }
            ],
            "outputs": [
                {
                    "name": "answer",
                    "type": "str",
                    "description": "Final, concise, and validated answer ready to return to the user.",
                    "required": true
                }
            ],
            "prompt": null,
            "prompt_template": {
                "class_name": "StringTemplate",
                "instruction": "You are an Answer Refinement Agent.\nIf is_valid is true, you may lightly polish the draft answer for clarity and brevity.\nIf is_valid is false, use the suggested improvements and context to rewrite the answer so that it is correct, fully supported, and concise (1\u20133 sentences).\nYou should provide the final answer (Yes or No) in the 'answer' field. Format your answer in <answer>xxx</answer>."
            },
            "system_prompt": "You are a helpful and highly intelligent assistant.",
            "parse_mode": "xml",
            "parse_func": null,
            "parse_title": null,
            "tool_names": null
        }
    ]
}